add selectall command
This commit is contained in:
@@ -72,6 +72,7 @@ export class Editor extends EventEmitter {
|
|||||||
this.registerCommand('clearContent', require('./commands/clearContent').default)
|
this.registerCommand('clearContent', require('./commands/clearContent').default)
|
||||||
this.registerCommand('removeMarks', require('./commands/removeMarks').default)
|
this.registerCommand('removeMarks', require('./commands/removeMarks').default)
|
||||||
this.registerCommand('toggleBlockType', require('./commands/toggleBlockType').default)
|
this.registerCommand('toggleBlockType', require('./commands/toggleBlockType').default)
|
||||||
|
this.registerCommand('selectAll', require('./commands/selectAll').default)
|
||||||
|
|
||||||
if (this.options.injectCSS) {
|
if (this.options.injectCSS) {
|
||||||
require('./style.css')
|
require('./style.css')
|
||||||
|
|||||||
15
packages/core/src/commands/selectAll.ts
Normal file
15
packages/core/src/commands/selectAll.ts
Normal 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()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user