Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions src/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -470,12 +457,14 @@ export class Editor {

public async saveModule(): Promise<string> {
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;
}
Expand Down