mirror of
https://github.com/ueberdosis/tiptap.git
synced 2025-01-18 14:13:21 +08:00
add selectall command
This commit is contained in:
parent
3d02da20ff
commit
adb44f317c
@ -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')
|
||||
|
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()
|
||||
}
|
Loading…
Reference in New Issue
Block a user