We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d1ff7b0 commit 020dab5Copy full SHA for 020dab5
src/actions/insert.ts
@@ -88,9 +88,12 @@ export class InsertAction {
88
return this.insertPrecondition(ws) ? 'enabled' : 'hidden';
89
},
90
callback: (scope: ContextMenuRegistry.Scope) => {
91
- const ws =
92
- scope.focusedNode?.workspace ??
93
- (scope.focusedNode?.getSourceBlock().workspace as WorkspaceSvg);
+ let ws;
+ if (scope.focusedNode instanceof Blockly.Block) {
+ ws = scope.focusedNode.workspace as WorkspaceSvg;
94
+ } else if (scope.focusedNode instanceof Blockly.Connection) {
95
+ ws = scope.focusedNode.getSourceBlock()?.workspace as WorkspaceSvg;
96
+ }
97
if (!ws) return false;
98
this.insertCallback(ws);
99
0 commit comments