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 161a9e5Copy full SHA for 161a9e5
src/actions/insert.ts
@@ -88,9 +88,13 @@ 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 block;
+ if (scope.focusedNode instanceof Blockly.Block) {
+ block = scope.focusedNode;
94
+ } else if (scope.focusedNode instanceof Blockly.Connection) {
95
+ block = scope.focusedNode.getSourceBlock();
96
+ }
97
+ const ws = block?.workspace as WorkspaceSvg | null;
98
if (!ws) return false;
99
this.insertCallback(ws);
100
0 commit comments