From 15158e0ae5181c4461765b1eae88283af9ed7c9d Mon Sep 17 00:00:00 2001 From: Liz Looney Date: Fri, 21 Nov 2025 23:11:19 -0800 Subject: [PATCH] Changed Editor.saveModule to only save if there are changes. --- src/editor/editor.ts | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/src/editor/editor.ts b/src/editor/editor.ts index a05dc508..8262b867 100644 --- a/src/editor/editor.ts +++ b/src/editor/editor.ts @@ -301,19 +301,6 @@ export class Editor { } } - public isModified(): boolean { - /* - // This code is helpful for debugging issues where the editor says - // 'Blocks have been modified!'. - if (this.getModuleContentText() !== this.moduleContentText) { - console.log('isModified will return true'); - console.log('this.getModuleContentText() is ' + this.getModuleContentText()); - console.log('this.moduleContentText is ' + this.moduleContentText); - } - */ - return this.getModuleContentText() !== this.moduleContentText; - } - public getBlocklyWorkspace(): Blockly.WorkspaceSvg { return this.blocklyWorkspace; } @@ -470,12 +457,14 @@ export class Editor { public async saveModule(): Promise { const moduleContentText = this.getModuleContentText(); - try { - await this.storage.saveFile(this.modulePath, moduleContentText); - this.moduleContentText = moduleContentText; - await storageProject.saveProjectInfo(this.storage, this.projectName); - } catch (e) { - throw e; + if (moduleContentText !== this.moduleContentText) { + try { + await this.storage.saveFile(this.modulePath, moduleContentText); + this.moduleContentText = moduleContentText; + await storageProject.saveProjectInfo(this.storage, this.projectName); + } catch (e) { + throw e; + } } return moduleContentText; }