fix(web-editor): check for editor change before setting as dirty.

pull/5079/head
Felix Han 2021-05-20 10:22:07 +12:00
parent e54d99fd3d
commit 47d462f085
2 changed files with 8 additions and 4 deletions

View File

@ -5,7 +5,9 @@ export class EditEdgeStackFormController {
} }
editorUpdate(cm) { editorUpdate(cm) {
if (this.model.StackFileContent.replace(/(\r\n|\n|\r)/gm, '') !== cm.getValue().replace(/(\r\n|\n|\r)/gm, '')) {
this.model.StackFileContent = cm.getValue(); this.model.StackFileContent = cm.getValue();
this.isEditorDirty = true; this.isEditorDirty = true;
} }
} }
}

View File

@ -96,9 +96,11 @@ class EditCustomTemplateViewController {
} }
editorUpdate(cm) { editorUpdate(cm) {
if (this.formValues.FileContent.replace(/(\r\n|\n|\r)/gm, '') !== cm.getValue().replace(/(\r\n|\n|\r)/gm, '')) {
this.formValues.FileContent = cm.getValue(); this.formValues.FileContent = cm.getValue();
this.state.isEditorDirty = true; this.state.isEditorDirty = true;
} }
}
async uiCanExit() { async uiCanExit() {
if (this.formValues.FileContent !== this.oldFileContent && this.state.isEditorDirty) { if (this.formValues.FileContent !== this.oldFileContent && this.state.isEditorDirty) {