From 82a57351a7abbe7540cc8778709cc3dea9216294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Tue, 17 Nov 2020 21:21:19 +0100 Subject: [PATCH] add editorProps to editorOptions --- packages/core/src/Editor.ts | 2 ++ packages/core/src/types.ts | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/core/src/Editor.ts b/packages/core/src/Editor.ts index 0c64ba10..330e547c 100644 --- a/packages/core/src/Editor.ts +++ b/packages/core/src/Editor.ts @@ -50,6 +50,7 @@ export class Editor extends EventEmitter { extensions: [], autofocus: false, editable: true, + editorProps: {}, parseOptions: {}, onInit: () => null, onUpdate: () => null, @@ -234,6 +235,7 @@ export class Editor extends EventEmitter { */ private createView() { this.view = new EditorView(this.options.element, { + ...this.options.editorProps, dispatchTransaction: this.dispatchTransaction.bind(this), state: EditorState.create({ doc: this.createDocument(this.options.content), diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts index 77999e19..d2a8727a 100644 --- a/packages/core/src/types.ts +++ b/packages/core/src/types.ts @@ -1,5 +1,10 @@ import { Node as ProseMirrorNode, ParseOptions } from 'prosemirror-model' -import { EditorView, Decoration, NodeView } from 'prosemirror-view' +import { + EditorView, + Decoration, + NodeView, + EditorProps, +} from 'prosemirror-view' import { EditorState, Transaction } from 'prosemirror-state' import { Extension } from './Extension' import { Node } from './Node' @@ -16,6 +21,7 @@ export interface EditorOptions { injectCSS: boolean, autofocus: FocusPosition, editable: boolean, + editorProps: EditorProps, parseOptions: ParseOptions, onInit: () => void, onUpdate: () => void,