@@ -46,7 +46,6 @@ function initBlockTools() {
4646 // from various areas of Scratch
4747 let aceCompleteSchema = { } ;
4848 updateEditorSchema = ( runtime ) => {
49- console . log ( "schema updated" ) ;
5049 const vm = runtime . vm ;
5150
5251 aceCompleteSchema = {
@@ -63,16 +62,16 @@ function initBlockTools() {
6362 } ;
6463
6564 if ( typeof Scratch === "object" ) {
66- schema . window . push ( "Scratch" ) ;
67- schema [ "Scratch" ] = Object . getOwnPropertyNames ( Scratch ) ;
65+ aceCompleteSchema . window . push ( "Scratch" ) ;
66+ aceCompleteSchema [ "Scratch" ] = Object . getOwnPropertyNames ( Scratch ) ;
6867 }
6968 if ( typeof Blockly === "object" ) {
70- schema . window . push ( "Blockly" ) ;
71- schema [ "Blockly" ] = Object . getOwnPropertyNames ( Blockly ) ;
69+ aceCompleteSchema . window . push ( "Blockly" ) ;
70+ aceCompleteSchema [ "Blockly" ] = Object . getOwnPropertyNames ( Blockly ) ;
7271 }
7372 if ( typeof ScratchBlocks === "object" ) {
74- schema . window . push ( "ScratchBlocks" ) ;
75- schema [ "ScratchBlocks" ] = Object . getOwnPropertyNames ( ScratchBlocks ) ;
73+ aceCompleteSchema . window . push ( "ScratchBlocks" ) ;
74+ aceCompleteSchema [ "ScratchBlocks" ] = Object . getOwnPropertyNames ( ScratchBlocks ) ;
7675 }
7776 } ;
7877
@@ -302,12 +301,11 @@ class SPjavascriptV2 {
302301 this . isInSafari = / ^ ( (? ! c h r o m e | a n d r o i d ) .) * s a f a r i / i. test ( navigator . userAgent ) ;
303302 this . isEditorUnsandboxed = false ;
304303
304+ this . runtime . vm . on ( "EXTENSION_ADDED" , ( ) => updateEditorSchema ( this . runtime ) ) ;
305305 this . runtime . vm . on ( "workspaceUpdate" , ( ) => {
306306 if ( ! isScratchBlocksReady ) {
307307 isScratchBlocksReady = typeof ScratchBlocks === "object" ;
308308 if ( isScratchBlocksReady ) initBlockTools ( ) ;
309-
310- updateEditorSchema ( this . runtime ) ;
311309 }
312310 } ) ;
313311
0 commit comments