diff --git a/app/edge/components/edit-edge-stack-form/editEdgeStackFormController.js b/app/edge/components/edit-edge-stack-form/editEdgeStackFormController.js index bcef9c9f6..5e6482ee4 100644 --- a/app/edge/components/edit-edge-stack-form/editEdgeStackFormController.js +++ b/app/edge/components/edit-edge-stack-form/editEdgeStackFormController.js @@ -5,7 +5,9 @@ export class EditEdgeStackFormController { } editorUpdate(cm) { - this.model.StackFileContent = cm.getValue(); - this.isEditorDirty = true; + if (this.model.StackFileContent.replace(/(\r\n|\n|\r)/gm, '') !== cm.getValue().replace(/(\r\n|\n|\r)/gm, '')) { + this.model.StackFileContent = cm.getValue(); + this.isEditorDirty = true; + } } } diff --git a/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateViewController.js b/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateViewController.js index e53e291e3..941d1870b 100644 --- a/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateViewController.js +++ b/app/portainer/views/custom-templates/edit-custom-template-view/editCustomTemplateViewController.js @@ -96,8 +96,10 @@ class EditCustomTemplateViewController { } editorUpdate(cm) { - this.formValues.FileContent = cm.getValue(); - this.state.isEditorDirty = true; + if (this.formValues.FileContent.replace(/(\r\n|\n|\r)/gm, '') !== cm.getValue().replace(/(\r\n|\n|\r)/gm, '')) { + this.formValues.FileContent = cm.getValue(); + this.state.isEditorDirty = true; + } } async uiCanExit() {