improve type handling for commands
This commit is contained in:
@@ -2,13 +2,15 @@ import { DOMParser } from 'prosemirror-model'
|
||||
import { Editor } from '../Editor'
|
||||
import elementFromString from '../utils/elementFromString'
|
||||
|
||||
type InsertHTML = (value: string) => any
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
insertHTML(value: string): Editor,
|
||||
insertHTML: InsertHTML,
|
||||
}
|
||||
}
|
||||
|
||||
export default function insertHTML(next: Function, editor: Editor, value: string): void {
|
||||
export default (next: Function, editor: Editor, value: string): InsertHTML => () => {
|
||||
const { view, state } = editor
|
||||
const { selection } = state
|
||||
const element = elementFromString(value)
|
||||
|
||||
Reference in New Issue
Block a user