mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-28 15:49:23 +08:00
add parseOptions to editorOptions
This commit is contained in:
parent
a4ad1572e8
commit
14c6bfce6f
@ -1,11 +1,6 @@
|
||||
import { EditorState, Plugin, Transaction } from 'prosemirror-state'
|
||||
import { EditorView } from 'prosemirror-view'
|
||||
import {
|
||||
Schema,
|
||||
DOMParser,
|
||||
ParseOptions,
|
||||
Node,
|
||||
} from 'prosemirror-model'
|
||||
import { Schema, DOMParser, Node } from 'prosemirror-model'
|
||||
import magicMethods from './utils/magicMethods'
|
||||
import elementFromString from './utils/elementFromString'
|
||||
import nodeIsActive from './utils/nodeIsActive'
|
||||
@ -55,6 +50,7 @@ export class Editor extends EventEmitter {
|
||||
extensions: [],
|
||||
autofocus: false,
|
||||
editable: true,
|
||||
parseOptions: {},
|
||||
onInit: () => null,
|
||||
onUpdate: () => null,
|
||||
onTransaction: () => null,
|
||||
@ -265,7 +261,7 @@ export class Editor extends EventEmitter {
|
||||
/**
|
||||
* Creates a ProseMirror document.
|
||||
*/
|
||||
public createDocument = (content: EditorContent, parseOptions: ParseOptions = {}): Node => {
|
||||
public createDocument = (content: EditorContent, parseOptions = this.options.parseOptions): Node => {
|
||||
if (content && typeof content === 'object') {
|
||||
try {
|
||||
return this.schema.nodeFromJSON(content)
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Node as ProseMirrorNode } from 'prosemirror-model'
|
||||
import { Node as ProseMirrorNode, ParseOptions } from 'prosemirror-model'
|
||||
import { EditorView, Decoration, NodeView } from 'prosemirror-view'
|
||||
import { EditorState, Transaction } from 'prosemirror-state'
|
||||
import { Extension } from './Extension'
|
||||
@ -16,6 +16,7 @@ export interface EditorOptions {
|
||||
injectCSS: boolean,
|
||||
autofocus: FocusPosition,
|
||||
editable: boolean,
|
||||
parseOptions: ParseOptions,
|
||||
onInit: () => void,
|
||||
onUpdate: () => void,
|
||||
onTransaction: (props: { transaction: Transaction }) => void,
|
||||
|
Loading…
Reference in New Issue
Block a user