Skip to content

Commit

Permalink
Setup panel editors to manage clean state on save
Browse files Browse the repository at this point in the history
  • Loading branch information
szschaler authored Dec 8, 2023
1 parent 547e771 commit 4c7299d
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion platform/src/Panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class Panel {
} else {
this.editor = editor;
}

// Reset undo manager
this.editor.session.getUndoManager().reset();

this.visible = true;
}
Expand Down Expand Up @@ -73,7 +76,10 @@ class Panel {
* @returns a promise
*/
save(fileHandler) {
return fileHandler.storeFile(this.getFileUrl(), this.getValueSha(), this.getValue());
let thisEditor = this.editor;
return fileHandler.storeFile(this.getFileUrl(), this.getValueSha(), this.getValue())
// Mark the editor clean if the save completed
.then((response) => { thisEditor.session.getUndoManager().markClean(); });
}

getEditor() {
Expand Down

0 comments on commit 4c7299d

Please sign in to comment.