add deleteSelection command
This commit is contained in:
@@ -66,6 +66,7 @@ export class Editor extends EventEmitter {
|
||||
this.createSchema()
|
||||
this.createView()
|
||||
this.registerCommand('clearContent', require('./commands/clearContent').default)
|
||||
this.registerCommand('deleteSelection', require('./commands/deleteSelection').default)
|
||||
this.registerCommand('focus', require('./commands/focus').default)
|
||||
this.registerCommand('insertHTML', require('./commands/insertHTML').default)
|
||||
this.registerCommand('insertText', require('./commands/insertText').default)
|
||||
|
||||
15
packages/core/src/commands/deleteSelection.ts
Normal file
15
packages/core/src/commands/deleteSelection.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { Editor } from '../Editor'
|
||||
import { deleteSelection } from 'prosemirror-commands'
|
||||
|
||||
type DeleteSelection = () => any
|
||||
|
||||
declare module '../Editor' {
|
||||
interface Editor {
|
||||
deleteSelection: DeleteSelection,
|
||||
}
|
||||
}
|
||||
|
||||
export default (next: Function, { state, view }: Editor): DeleteSelection => () => {
|
||||
deleteSelection(state, view.dispatch)
|
||||
next()
|
||||
}
|
||||
Reference in New Issue
Block a user