From 8c8b738ae14b9a21cfc86fc34b5d4b59469ad550 Mon Sep 17 00:00:00 2001 From: sibiraj-s Date: Fri, 5 Feb 2021 14:56:27 +0530 Subject: [PATCH] fix: use DOM created by ProseMirror --- src/lib/Editor.ts | 4 +--- src/lib/editor.component.ts | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/Editor.ts b/src/lib/Editor.ts index 723dd971..a7ef0ccd 100644 --- a/src/lib/Editor.ts +++ b/src/lib/Editor.ts @@ -36,7 +36,6 @@ const DEFAULT_OPTIONS: Options = { class Editor { private options: Options; view: EditorView; - el: DocumentFragment; constructor(options: Options = DEFAULT_OPTIONS) { this.options = Object.assign({}, DEFAULT_OPTIONS, options); @@ -107,7 +106,6 @@ class Editor { const schema = this.schema; const doc = parseContent(content, schema); - this.el = document.createDocumentFragment(); const plugins: Plugin[] = options.plugins ?? []; @@ -117,7 +115,7 @@ class Editor { inputRules }); - this.view = new EditorView(this.el, { + this.view = new EditorView(null, { state: EditorState.create({ doc, schema, diff --git a/src/lib/editor.component.ts b/src/lib/editor.component.ts index c92e6518..032b2cce 100644 --- a/src/lib/editor.component.ts +++ b/src/lib/editor.component.ts @@ -150,7 +150,7 @@ export class NgxEditorComponent implements ControlValueAccessor, OnInit, OnChang this.registerCustomElements(); this.registerPlugins(); - this.renderer.appendChild(this.ngxEditor.nativeElement, this.editor.el); + this.renderer.appendChild(this.ngxEditor.nativeElement, this.editor.view.dom); const contentChangeSubscription = this.editor.valueChanges.subscribe(jsonDoc => { this.handleChange(jsonDoc);