Skip to content

Commit

Permalink
fix: don't emit onchange on init
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Dec 30, 2020
1 parent d62d8e4 commit 2d7bf59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand All @@ -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;
}

Expand Down

0 comments on commit 2d7bf59

Please sign in to comment.