add editorProps to editorOptions
This commit is contained in:
@@ -50,6 +50,7 @@ export class Editor extends EventEmitter {
|
|||||||
extensions: [],
|
extensions: [],
|
||||||
autofocus: false,
|
autofocus: false,
|
||||||
editable: true,
|
editable: true,
|
||||||
|
editorProps: {},
|
||||||
parseOptions: {},
|
parseOptions: {},
|
||||||
onInit: () => null,
|
onInit: () => null,
|
||||||
onUpdate: () => null,
|
onUpdate: () => null,
|
||||||
@@ -234,6 +235,7 @@ export class Editor extends EventEmitter {
|
|||||||
*/
|
*/
|
||||||
private createView() {
|
private createView() {
|
||||||
this.view = new EditorView(this.options.element, {
|
this.view = new EditorView(this.options.element, {
|
||||||
|
...this.options.editorProps,
|
||||||
dispatchTransaction: this.dispatchTransaction.bind(this),
|
dispatchTransaction: this.dispatchTransaction.bind(this),
|
||||||
state: EditorState.create({
|
state: EditorState.create({
|
||||||
doc: this.createDocument(this.options.content),
|
doc: this.createDocument(this.options.content),
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
import { Node as ProseMirrorNode, ParseOptions } from 'prosemirror-model'
|
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 { EditorState, Transaction } from 'prosemirror-state'
|
||||||
import { Extension } from './Extension'
|
import { Extension } from './Extension'
|
||||||
import { Node } from './Node'
|
import { Node } from './Node'
|
||||||
@@ -16,6 +21,7 @@ export interface EditorOptions {
|
|||||||
injectCSS: boolean,
|
injectCSS: boolean,
|
||||||
autofocus: FocusPosition,
|
autofocus: FocusPosition,
|
||||||
editable: boolean,
|
editable: boolean,
|
||||||
|
editorProps: EditorProps,
|
||||||
parseOptions: ParseOptions,
|
parseOptions: ParseOptions,
|
||||||
onInit: () => void,
|
onInit: () => void,
|
||||||
onUpdate: () => void,
|
onUpdate: () => void,
|
||||||
|
|||||||
Reference in New Issue
Block a user