Skip to content

Commit 8604df7

Browse files
mjgallagewpatton
andauthored
Fix delete key deleting block in workspace rather than mutator (#114)
* Fix delete key deleting block in workspace rather than mutator Change-Id: If7b09796a0e6ddd56a27def357ea127226bdedda * Fix max-len lint error --------- Co-authored-by: Evan W. Patton <[email protected]>
1 parent 8a9ba70 commit 8604df7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/multiselect_shortcut.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ const registerShortcutDelete = function() {
2929
return false;
3030
}
3131
const selected = Blockly.common.getSelected();
32+
if (selected && selected.isInMutator) {
33+
// Blocks in the mutator workspace are always deletable.
34+
return selected.isDeletable();
35+
}
3236
const dragSelection = dragSelectionWeakMap.get(workspace);
3337
if (!dragSelection.size) {
3438
return deleteShortcut.check(selected);
@@ -76,6 +80,10 @@ const registerShortcutDelete = function() {
7680

7781
const selected = Blockly.common.getSelected();
7882
Blockly.Events.setGroup(true);
83+
if (selected && selected.isInMutator) {
84+
selected.checkAndDelete();
85+
return true;
86+
}
7987
const dragSelection = dragSelectionWeakMap.get(workspace);
8088

8189
// Handle the case where MultiselectDraggable is in use

0 commit comments

Comments
 (0)