Skip to content
Merged

Master #3023

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions extern/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,7 @@ Lang.Blocks = {
START_message_send_wait_2: ' message and wait',
Duplication_option: 'Duplicate',
cut_blocks: 'Cut',
AI_analyze_option: 'AI Analyze',
CONTEXT_COPY_option: 'Copy',
Delete_Blocks: 'Remove',
add_my_storage: 'add to my storage',
Expand Down
1 change: 1 addition & 0 deletions extern/lang/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -1553,6 +1553,7 @@ Lang.Blocks = {
TUT_repeat_until_gold: '부품에 도달할 때 까지 반복',
TUT_declare_function: '함수 선언',
TUT_call_function: '함수 호출',
AI_analyze_option: 'AI로 코드 분석하기',
CONTEXT_COPY_option: '코드 복사하기',
Delete_Blocks: '코드 삭제하기',
Duplication_option: '코드 복제하기',
Expand Down
34 changes: 30 additions & 4 deletions src/playground/block_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1421,10 +1421,29 @@ Entry.BlockView = class BlockView {
const { block, isInBlockMenu, copyable } = blockView;
const { options: EntryOptions = {} } = Entry;
const {
Blocks: { Duplication_option, CONTEXT_COPY_option, cut_blocks, Delete_Blocks },
Blocks: {
AI_analyze_option,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'AI_analyze_option' is not in camel case.

Duplication_option,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'Duplication_option' is not in camel case.

CONTEXT_COPY_option,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'CONTEXT_COPY_option' is not in camel case.

cut_blocks,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'cut_blocks' is not in camel case.

Delete_Blocks,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [eslint] <camelcase> reported by reviewdog 🐶
Identifier 'Delete_Blocks' is not in camel case.

},
Menus: { save_as_image },
} = Lang;

const aiAnalyze = {
text: AI_analyze_option,
enable: copyable && !isBoardReadOnly,
callback() {
// NOTICE : Entry.do는 필요할지 고려 > 뒤로가기 적용이 필요한지
const blocksData = { ...block.copy() };

Entry.dispatchEvent('analyzeBlock', {
data: JSON.stringify(blocksData),
});
},
};

const copyAndPaste = {
text: Duplication_option,
enable: copyable && !isBoardReadOnly,
Expand Down Expand Up @@ -1494,9 +1513,16 @@ Entry.BlockView = class BlockView {
}

if (!isInBlockMenu) {
options = [copyAndPaste, copy, cut, remove, addStorage, ...options, comment].filter(
(x) => x
);
options = [
Entry.aiAssistantEnable && aiAnalyze,
copyAndPaste,
copy,
cut,
remove,
addStorage,
...options,
comment,
].filter((x) => x);
}

return options;
Expand Down
3 changes: 3 additions & 0 deletions src/util/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,9 @@ Entry.parseOptions = function (options) {
if (this.fullScreenEnable === undefined) {
this.fullScreenEnable = true;
}
if (options.aiAssistantEnable) {
this.aiAssistantEnable = options.aiAssistantEnable;
}
this.modalContainer = options.modalContainer || $('body')[0];
};

Expand Down
Loading