From 2d7bf59cd3ba09a4f1c224e4be7da7f82e7888d7 Mon Sep 17 00:00:00 2001 From: sibiraj-s Date: Wed, 30 Dec 2020 09:06:10 +0530 Subject: [PATCH] fix: don't emit onchange on init --- src/lib/editor.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/editor.component.ts b/src/lib/editor.component.ts index 7e8f8660..0176ce8a 100644 --- a/src/lib/editor.component.ts +++ b/src/lib/editor.component.ts @@ -96,7 +96,7 @@ export class NgxEditorComponent implements ControlValueAccessor, OnInit, OnDestr const newDoc = this.parse(value); tr.replaceWith(0, state.doc.content.size, newDoc) - .setMeta('PREVENT_EMIT', true); + .setMeta('PREVENT_ONCHANGE', true); // don't emit if both content is same if (doc !== null && doc.eq(tr.doc)) { @@ -117,7 +117,7 @@ export class NgxEditorComponent implements ControlValueAccessor, OnInit, OnDestr const { state } = this.view.state.applyTransaction(tr); this.view.updateState(state); - if (!tr.docChanged || !this.onChange || tr.getMeta('PREVENT_UPDATE')) { + if (!tr.docChanged || !this.onChange || tr.getMeta('PREVENT_ONCHANGE')) { return; }