Skip to content

Commit 1b2256a

Browse files
authored
final bug fix
1 parent fe48359 commit 1b2256a

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/extensions/sp_javascriptV2/index.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = /^((?!chrome|android).)*safari/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

Comments
 (0)