Do not reset WYSIWYG editor to beginning on save (#21)
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone Build is passing

This commit is contained in:
Garrett Mills 2020-10-15 09:31:54 -05:00
parent d7b2b3156c
commit 74b7cdadc7
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

View File

@ -13,6 +13,7 @@ export class NormComponent extends EditorNodeContract implements OnInit {
public isFocused = false; public isFocused = false;
public initialValue = 'Click to edit...'; public initialValue = 'Click to edit...';
protected savedValue = 'Click to edit...';
public contents = ''; public contents = '';
private dirtyOverride = false; private dirtyOverride = false;
@ -21,15 +22,16 @@ export class NormComponent extends EditorNodeContract implements OnInit {
) { ) {
super(); super();
this.contents = this.initialValue; this.contents = this.initialValue;
this.savedValue = this.initialValue;
} }
public isDirty(): boolean | Promise<boolean> { public isDirty(): boolean | Promise<boolean> {
return this.dirtyOverride || this.contents !== this.initialValue; return this.dirtyOverride || this.contents !== this.savedValue;
} }
public writeChangesToNode(): void | Promise<void> { public writeChangesToNode(): void | Promise<void> {
this.nodeRec.value = this.contents; this.nodeRec.value = this.contents;
this.initialValue = this.contents; this.savedValue = this.contents;
} }
ngOnInit() { ngOnInit() {
@ -40,7 +42,9 @@ export class NormComponent extends EditorNodeContract implements OnInit {
if ( this.node.Value.Value ) { if ( this.node.Value.Value ) {
this.initialValue = this.node.Value.Value; this.initialValue = this.node.Value.Value;
this.savedValue = this.node.Value.Value;
} }
this.contents = this.initialValue; this.contents = this.initialValue;
}); });
} }