refactoring

This commit is contained in:
Philipp Kühn 2020-03-29 23:06:37 +02:00
parent 463d46da8c
commit add9090d39

View File

@ -7,7 +7,18 @@ declare module '../Editor' {
}
}
export default function setContent(next: Function, editor: Editor, content: string, emitUpdate: Boolean = true, parseOptions: any = {}): void {
export default function setContent(
next: Function,
editor: Editor,
content = null,
emitUpdate = true,
parseOptions = {},
): void {
if (content === null) {
next()
return
}
const { view, state, createDocument } = editor
const { doc, tr } = state
const document = createDocument(content, parseOptions)