add support for prosemirror commands

This commit is contained in:
Philipp Kühn
2020-09-21 18:40:32 +02:00
parent 432b30f1a6
commit c1a941a042
4 changed files with 52 additions and 10 deletions

View File

@@ -1,7 +1,7 @@
import { Editor } from '../Editor'
import { deleteSelection } from 'prosemirror-commands'
import { Command } from '../Editor'
import { deleteSelection as originalDeleteSelection } from 'prosemirror-commands'
type DeleteSelectionCommand = () => Editor
type DeleteSelectionCommand = () => Command
declare module '../Editor' {
interface Editor {
@@ -9,7 +9,6 @@ declare module '../Editor' {
}
}
export default (next: Function, { state, view }: Editor) => () => {
deleteSelection(state, view.dispatch)
next()
export const deleteSelection: DeleteSelectionCommand = () => ({ state, dispatch }) => {
return originalDeleteSelection(state, dispatch)
}

View File

@@ -1,6 +1,6 @@
export { blur } from './blur'
export { clearContent } from './clearContent'
// export { default as deleteSelection } from './deleteSelection'
export { deleteSelection } from './deleteSelection'
export { focus } from './focus'
export { insertHTML } from './insertHTML'
export { insertText } from './insertText'