File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -97,15 +97,19 @@ async function createWorkspace(): Promise<Blockly.WorkspaceSvg> {
9797 KeyboardNavigation . registerKeyboardNavigationStyles ( ) ;
9898 registerFlyoutCursor ( ) ;
9999 registerNavigationDeferringToolbox ( ) ;
100+ registerRunCodeShortcut ( ) ;
101+ Blockly . ContextMenuItems . registerCommentOptions ( ) ;
100102
103+ let navigation : KeyboardNavigation | null = null ;
101104 const workspace = (
102105 await createPlayground (
103106 blocklyDiv ,
104107 ( blocklyDiv , options ) => {
108+ if ( navigation ) {
109+ navigation . dispose ( ) ;
110+ }
105111 const ws = Blockly . inject ( blocklyDiv , options ) ;
106- Blockly . ContextMenuItems . registerCommentOptions ( ) ;
107- new KeyboardNavigation ( ws ) ;
108- registerRunCodeShortcut ( ) ;
112+ navigation = new KeyboardNavigation ( ws ) ;
109113
110114 // Disable blocks that aren't inside the setup or draw loops.
111115 ws . addChangeListener ( Blockly . Events . disableOrphans ) ;
You can’t perform that action at this time.
0 commit comments