return editor for all core command types

This commit is contained in:
Philipp Kühn
2020-08-17 16:38:13 +02:00
parent 9ad1442bb6
commit 3c60bb6406
14 changed files with 49 additions and 47 deletions

View File

@@ -2,15 +2,15 @@ import { DOMParser } from 'prosemirror-model'
import { Editor } from '../Editor'
import elementFromString from '../utils/elementFromString'
type InsertHTML = (value: string) => any
type InsertHTMLCommand = (value: string) => Editor
declare module '../Editor' {
interface Editor {
insertHTML: InsertHTML,
insertHTML: InsertHTMLCommand,
}
}
export default (next: Function, editor: Editor): InsertHTML => value => {
export default (next: Function, editor: Editor) => (value: string) => {
const { view, state } = editor
const { selection } = state
const element = elementFromString(value)