Skip to content

Commit 283eea8

Browse files
authored
Merge pull request #3023 from entrylabs/develop
Master
2 parents 86c47f2 + ff44af5 commit 283eea8

4 files changed

Lines changed: 35 additions & 4 deletions

File tree

extern/lang/en.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,6 +1707,7 @@ Lang.Blocks = {
17071707
START_message_send_wait_2: ' message and wait',
17081708
Duplication_option: 'Duplicate',
17091709
cut_blocks: 'Cut',
1710+
AI_analyze_option: 'AI Analyze',
17101711
CONTEXT_COPY_option: 'Copy',
17111712
Delete_Blocks: 'Remove',
17121713
add_my_storage: 'add to my storage',

extern/lang/ko.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,7 @@ Lang.Blocks = {
15531553
TUT_repeat_until_gold: '부품에 도달할 때 까지 반복',
15541554
TUT_declare_function: '함수 선언',
15551555
TUT_call_function: '함수 호출',
1556+
AI_analyze_option: 'AI로 코드 분석하기',
15561557
CONTEXT_COPY_option: '코드 복사하기',
15571558
Delete_Blocks: '코드 삭제하기',
15581559
Duplication_option: '코드 복제하기',

src/playground/block_view.js

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1421,10 +1421,29 @@ Entry.BlockView = class BlockView {
14211421
const { block, isInBlockMenu, copyable } = blockView;
14221422
const { options: EntryOptions = {} } = Entry;
14231423
const {
1424-
Blocks: { Duplication_option, CONTEXT_COPY_option, cut_blocks, Delete_Blocks },
1424+
Blocks: {
1425+
AI_analyze_option,
1426+
Duplication_option,
1427+
CONTEXT_COPY_option,
1428+
cut_blocks,
1429+
Delete_Blocks,
1430+
},
14251431
Menus: { save_as_image },
14261432
} = Lang;
14271433

1434+
const aiAnalyze = {
1435+
text: AI_analyze_option,
1436+
enable: copyable && !isBoardReadOnly,
1437+
callback() {
1438+
// NOTICE : Entry.do는 필요할지 고려 > 뒤로가기 적용이 필요한지
1439+
const blocksData = { ...block.copy() };
1440+
1441+
Entry.dispatchEvent('analyzeBlock', {
1442+
data: JSON.stringify(blocksData),
1443+
});
1444+
},
1445+
};
1446+
14281447
const copyAndPaste = {
14291448
text: Duplication_option,
14301449
enable: copyable && !isBoardReadOnly,
@@ -1494,9 +1513,16 @@ Entry.BlockView = class BlockView {
14941513
}
14951514

14961515
if (!isInBlockMenu) {
1497-
options = [copyAndPaste, copy, cut, remove, addStorage, ...options, comment].filter(
1498-
(x) => x
1499-
);
1516+
options = [
1517+
Entry.aiAssistantEnable && aiAnalyze,
1518+
copyAndPaste,
1519+
copy,
1520+
cut,
1521+
remove,
1522+
addStorage,
1523+
...options,
1524+
comment,
1525+
].filter((x) => x);
15001526
}
15011527

15021528
return options;

src/util/init.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ Entry.parseOptions = function (options) {
611611
if (this.fullScreenEnable === undefined) {
612612
this.fullScreenEnable = true;
613613
}
614+
if (options.aiAssistantEnable) {
615+
this.aiAssistantEnable = options.aiAssistantEnable;
616+
}
614617
this.modalContainer = options.modalContainer || $('body')[0];
615618
};
616619

0 commit comments

Comments
 (0)