restructure commands

This commit is contained in:
Philipp Kühn
2020-11-18 16:43:27 +01:00
parent 03f009d5f0
commit 3cd6c55279
37 changed files with 214 additions and 231 deletions

View File

@@ -1,7 +1,10 @@
import { TextSelection } from 'prosemirror-state'
import { Command } from '../types'
export default (content: string, emitUpdate: Boolean = false, parseOptions = {}): Command => ({ tr, editor, dispatch }) => {
/**
* Replace the whole document with new content.
*/
export const setContent = (content: string, emitUpdate: Boolean = false, parseOptions = {}): Command => ({ tr, editor, dispatch }) => {
const { createDocument } = editor
const { doc } = tr
const document = createDocument(content, parseOptions)