refactoring

This commit is contained in:
Philipp Kühn
2021-02-10 18:05:02 +01:00
parent f70974678b
commit 55ff908423
69 changed files with 519 additions and 527 deletions

View File

@@ -1,9 +1,15 @@
import { TextSelection } from 'prosemirror-state'
import { AnyObject, Command, Commands } from '../types'
/**
* Replace the whole document with new content.
*/
declare module '@tiptap/core' {
interface Commands {
/**
* Replace the whole document with new content.
*/
setContent: (content: string, emitUpdate?: Boolean, parseOptions?: AnyObject) => Command,
}
}
export const setContent: Commands['setContent'] = (content, emitUpdate = false, parseOptions = {}) => ({ tr, editor, dispatch }) => {
const { createDocument } = editor
const { doc } = tr
@@ -18,9 +24,3 @@ export const setContent: Commands['setContent'] = (content, emitUpdate = false,
return true
}
declare module '@tiptap/core' {
interface Commands {
setContent: (content: string, emitUpdate?: Boolean, parseOptions?: AnyObject) => Command,
}
}