Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

이슈 8891 처리 #2874

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
7 changes: 4 additions & 3 deletions extern/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -1436,9 +1436,10 @@ Lang.Blocks = {
START_message_cast_wait: 'message and wait',
START_message_send_wait_1: 'Send',
START_message_send_wait_2: ' message and wait',
Duplication_option: 'copy & paste',
CONTEXT_COPY_option: 'copy code(s)',
Delete_Blocks: 'delete code(s)',
Duplication_option: 'Duplicate',
cut_blocks: 'Cut',
CONTEXT_COPY_option: 'Copy',
Delete_Blocks: 'Remove',
add_my_storage: 'add to my storage',
export_object: 'Export Object',
this_project: 'this project',
Expand Down
7 changes: 4 additions & 3 deletions extern/lang/ko.js
Original file line number Diff line number Diff line change
Expand Up @@ -1284,9 +1284,10 @@ Lang.Blocks = {
TUT_repeat_until_gold: '부품에 도달할 때 까지 반복',
TUT_declare_function: '함수 선언',
TUT_call_function: '함수 호출',
CONTEXT_COPY_option: '코드 복사',
Delete_Blocks: '코드 삭제',
Duplication_option: '코드 복사 & 붙여넣기',
CONTEXT_COPY_option: '코드 복사하기',
Delete_Blocks: '코드 삭제하기',
Duplication_option: '코드 복제하기',
cut_blocks: '코드 잘라내기',
Paste_blocks: '붙여넣기',
add_my_storage: '나의 보관함에 추가하기',
export_object: '오브젝트 파일로 내보내기',
Expand Down
51 changes: 37 additions & 14 deletions src/command/commands/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'use strict';
import isFunction from 'lodash/isFunction';

(function(c) {
(function (c) {
const COMMAND_TYPES = Entry.STATIC.COMMAND_TYPES;
let obj;

Expand All @@ -22,7 +22,10 @@ import isFunction from 'lodash/isFunction';
if (blocks instanceof Entry.Thread) {
blocks = blocks.toJSON();
}
return [['blocks', blocks], ['index', index]];
return [
['blocks', blocks],
['index', index],
];
},
undo: 'destroyThread',
recordable: Entry.STATIC.RECORDABLE.SUPPORT,
Expand All @@ -31,7 +34,7 @@ import isFunction from 'lodash/isFunction';
};

obj = _.clone(c[COMMAND_TYPES.addThread]);
obj.showMe = function(restrictor) {
obj.showMe = function (restrictor) {
if (restrictor.isTooltipFaded()) {
return;
}
Expand All @@ -54,7 +57,7 @@ import isFunction from 'lodash/isFunction';
});
};
obj.followCmd = true;
obj.restrict = function(data, domQuery, callback, restrictor) {
obj.restrict = function (data, domQuery, callback, restrictor) {
const nextCmd = restrictor.requestNextData().content;
if (nextCmd[0] === Entry.STATIC.COMMAND_TYPES.insertBlockFromBlockMenu) {
Entry.Command.editor.board.scrollToPointer(nextCmd[2][1]);
Expand Down Expand Up @@ -161,7 +164,10 @@ import isFunction from 'lodash/isFunction';
},
log(block, pointer) {
block = this.editor.board.findBlock(block.id);
return [['block', block], ['pointer', pointer]];
return [
['block', block],
['pointer', pointer],
];
},
undo: 'destroyBlock',
};
Expand Down Expand Up @@ -319,7 +325,7 @@ import isFunction from 'lodash/isFunction';
c[COMMAND_TYPES.insertBlockFollowSeparate] = obj;

obj = _.clone(c[COMMAND_TYPES.insertBlock]);
obj.restrict = function(data, domQuery, callback, restrictor) {
obj.restrict = function (data, domQuery, callback, restrictor) {
if (restrictor.toolTipRender) {
if (restrictor.toolTipRender) {
const target = Entry.Command.editor.board.code.getByPointer(data.content[2][1]);
Expand Down Expand Up @@ -408,7 +414,11 @@ import isFunction from 'lodash/isFunction';
block = block.view;
}

return [['block', blockPointer], ['x', block.x], ['y', block.y]];
return [
['block', blockPointer],
['x', block.x],
['y', block.y],
];
},
restrict(data, domQuery, callback, restrictor) {
Entry.Command.editor.board.scrollToPointer(data.content[1][1]);
Expand Down Expand Up @@ -469,7 +479,7 @@ import isFunction from 'lodash/isFunction';
};

obj = _.clone(c[COMMAND_TYPES.separateBlock]);
obj.restrict = function(data, domQuery, callback, restrictor) {
obj.restrict = function (data, domQuery, callback, restrictor) {
Entry.Command.editor.board.scrollToPointer(data.content[1][1]);
let isDone = false;
if (restrictor.toolTipRender) {
Expand Down Expand Up @@ -517,7 +527,7 @@ import isFunction from 'lodash/isFunction';
);
return tooltip;
};
obj.showMe = function(restrictor) {
obj.showMe = function (restrictor) {
if (restrictor.isTooltipFaded()) {
return;
}
Expand Down Expand Up @@ -598,15 +608,19 @@ import isFunction from 'lodash/isFunction';
console.error('moveBlock: target not exist ', block);
return [];
}
return [['block', block.pointer()], ['x', block.view.x], ['y', block.view.y]];
return [
['block', block.pointer()],
['x', block.view.x],
['y', block.view.y],
];
},
undo: 'moveBlock',
dom: ['playground', 'board', '&0'],
};

obj = _.clone(c[COMMAND_TYPES.moveBlock]);
obj.followCmd = true;
obj.restrict = function(data, domQuery, callback, restrictor) {
obj.restrict = function (data, domQuery, callback, restrictor) {
Entry.Command.editor.board.scrollToPointer(data.content[1][1]);
let isDone = false;
if (restrictor.toolTipRender) {
Expand Down Expand Up @@ -657,7 +671,7 @@ import isFunction from 'lodash/isFunction';
c[COMMAND_TYPES.moveBlockForDestroy] = obj;

obj = _.clone(c[COMMAND_TYPES.moveBlock]);
obj.restrict = function(data, domQuery, callback) {
obj.restrict = function (data, domQuery, callback) {
callback();
return new Entry.Tooltip(
[
Expand Down Expand Up @@ -693,7 +707,10 @@ import isFunction from 'lodash/isFunction';
return [-dx, -dy];
},
log(dx, dy) {
return [['dx', dx], ['dy', dy]];
return [
['dx', dx],
['dy', dy],
];
},
recordable: Entry.STATIC.RECORDABLE.SKIP,
undo: 'scrollBoard',
Expand Down Expand Up @@ -722,7 +739,10 @@ import isFunction from 'lodash/isFunction';
return [pointer, field._startValue || field.getValue()];
},
log(pointer, value) {
return [['pointer', pointer], ['value', value]];
return [
['pointer', pointer],
['value', value],
];
},
restrict(data, domQuery, callback, restrictor) {
let isDone = false;
Expand Down Expand Up @@ -899,6 +919,9 @@ import isFunction from 'lodash/isFunction';
do(block) {
block = this.editor.board.findBlock(block);
block.doDestroyBelow(true);
if (block.isParamBlockType()) {
block.thread.updateValueBlock();
}
},
state(block) {
block = this.editor.board.findBlock(block);
Expand Down
14 changes: 12 additions & 2 deletions src/playground/block_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,7 @@ Entry.BlockView = class BlockView {
const { block, isInBlockMenu, copyable } = blockView;
const { options: EntryOptions = {} } = Entry;
const {
Blocks: { Duplication_option, CONTEXT_COPY_option, Delete_Blocks },
Blocks: { Duplication_option, CONTEXT_COPY_option, cut_blocks, 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 'Duplication_option' is not in camel case.

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.

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.

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;

Expand All @@ -1441,6 +1441,16 @@ Entry.BlockView = class BlockView {
},
};

const cut = {
text: cut_blocks,
enable: copyable && block.isDeletable() && !isBoardReadOnly,
callback() {
block.copyToClipboard();
Entry.do('destroyBlockBelow', block);
blockView.getBoard().setSelectedBlock(null);
},
};

const remove = {
text: Delete_Blocks,
enable: block.isDeletable() && !isBoardReadOnly,
Expand Down Expand Up @@ -1484,7 +1494,7 @@ Entry.BlockView = class BlockView {
}

if (!isInBlockMenu) {
options = [copyAndPaste, copy, remove, addStorage, ...options, comment].filter(
options = [copyAndPaste, copy, cut, remove, addStorage, ...options, comment].filter(
(x) => x
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/playground/workspace.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ Entry.Workspace = class Workspace {
!blockView.isInBlockMenu &&
blockView.block.isDeletable()
) {
(function(block) {
(function (block) {
block.copyToClipboard();
Entry.do('destroyBlockBelow', block);
blockView.getBoard().setSelectedBlock(null);
Expand Down
Loading