Skip to content

Commit 161a9e5

Browse files
fix: make insert compile against rc/v12.0.0
1 parent d1ff7b0 commit 161a9e5

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/actions/insert.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,13 @@ export class InsertAction {
8888
return this.insertPrecondition(ws) ? 'enabled' : 'hidden';
8989
},
9090
callback: (scope: ContextMenuRegistry.Scope) => {
91-
const ws =
92-
scope.focusedNode?.workspace ??
93-
(scope.focusedNode?.getSourceBlock().workspace as WorkspaceSvg);
91+
let block;
92+
if (scope.focusedNode instanceof Blockly.Block) {
93+
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;
9498
if (!ws) return false;
9599
this.insertCallback(ws);
96100
},

0 commit comments

Comments
 (0)