add more commands

This commit is contained in:
Philipp Kühn
2020-09-20 23:44:38 +02:00
parent fbdc156981
commit f6270c0e0c
6 changed files with 27 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
import { Editor } from '../Editor'
import { Command } from '../Editor'
type ClearContentCommand = (emitUpdate?: Boolean) => Editor
type ClearContentCommand = (emitUpdate?: Boolean) => Command
declare module '../Editor' {
interface Editor {
@@ -8,7 +8,9 @@ declare module '../Editor' {
}
}
export default (next: Function, editor: Editor) => (emitUpdate = false) => {
export const clearContent: ClearContentCommand = (emitUpdate = false) => ({ editor }) => {
// TODO: doesnt work, we have to re-use `tr`
editor.setContent('', emitUpdate)
next()
return true
}