add selectall command

This commit is contained in:
Philipp Kühn 2020-04-22 00:17:36 +02:00
parent 3d02da20ff
commit adb44f317c
2 changed files with 16 additions and 0 deletions

View File

@ -72,6 +72,7 @@ export class Editor extends EventEmitter {
this.registerCommand('clearContent', require('./commands/clearContent').default)
this.registerCommand('removeMarks', require('./commands/removeMarks').default)
this.registerCommand('toggleBlockType', require('./commands/toggleBlockType').default)
this.registerCommand('selectAll', require('./commands/selectAll').default)
if (this.options.injectCSS) {
require('./style.css')

View File

@ -0,0 +1,15 @@
import { Editor } from '../Editor'
import { selectAll } from 'prosemirror-commands'
type SelectAll = () => any
declare module '../Editor' {
interface Editor {
selectAll: SelectAll,
}
}
export default (next: Function, { state, view }: Editor): SelectAll => () => {
selectAll(state, view.dispatch)
next()
}