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

master
Garrett Mills 4 years ago
parent d7b2b3156c
commit 74b7cdadc7
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246

@ -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;
}); });
} }

Loading…
Cancel
Save