Skip to content

Commit

Permalink
fix: use DOM created by ProseMirror
Browse files Browse the repository at this point in the history
  • Loading branch information
sibiraj-s committed Feb 5, 2021
1 parent a8ecb22 commit 8c8b738
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions src/lib/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -107,7 +106,6 @@ class Editor {
const schema = this.schema;

const doc = parseContent(content, schema);
this.el = document.createDocumentFragment();

const plugins: Plugin[] = options.plugins ?? [];

Expand All @@ -117,7 +115,7 @@ class Editor {
inputRules
});

this.view = new EditorView(this.el, {
this.view = new EditorView(null, {
state: EditorState.create({
doc,
schema,
Expand Down
2 changes: 1 addition & 1 deletion src/lib/editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8c8b738

Please sign in to comment.