From 74b7cdadc7ce74d21e41f7b89553fca20c562b39 Mon Sep 17 00:00:00 2001 From: garrettmills Date: Thu, 15 Oct 2020 09:31:54 -0500 Subject: [PATCH] Do not reset WYSIWYG editor to beginning on save (#21) --- src/app/components/nodes/norm/norm.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/app/components/nodes/norm/norm.component.ts b/src/app/components/nodes/norm/norm.component.ts index 5807f3d..399b96d 100644 --- a/src/app/components/nodes/norm/norm.component.ts +++ b/src/app/components/nodes/norm/norm.component.ts @@ -13,6 +13,7 @@ export class NormComponent extends EditorNodeContract implements OnInit { public isFocused = false; public initialValue = 'Click to edit...'; + protected savedValue = 'Click to edit...'; public contents = ''; private dirtyOverride = false; @@ -21,15 +22,16 @@ export class NormComponent extends EditorNodeContract implements OnInit { ) { super(); this.contents = this.initialValue; + this.savedValue = this.initialValue; } public isDirty(): boolean | Promise { - return this.dirtyOverride || this.contents !== this.initialValue; + return this.dirtyOverride || this.contents !== this.savedValue; } public writeChangesToNode(): void | Promise { this.nodeRec.value = this.contents; - this.initialValue = this.contents; + this.savedValue = this.contents; } ngOnInit() { @@ -40,7 +42,9 @@ export class NormComponent extends EditorNodeContract implements OnInit { if ( this.node.Value.Value ) { this.initialValue = this.node.Value.Value; + this.savedValue = this.node.Value.Value; } + this.contents = this.initialValue; }); }