add clearContent command

This commit is contained in:
Philipp Kühn
2020-03-29 23:24:37 +02:00
parent add9090d39
commit b30f5c3320
3 changed files with 19 additions and 5 deletions

View File

@@ -54,7 +54,8 @@ export class Editor extends EventEmitter {
this.registerCommand('insertText', require('./commands/insertText').default)
this.registerCommand('insertHTML', require('./commands/insertHTML').default)
this.registerCommand('setContent', require('./commands/setContent').default)
this.registerCommand('clearContent', require('./commands/clearContent').default)
if (this.options.injectCSS) {
injectCSS(require('./style.css'))
}
@@ -84,7 +85,7 @@ export class Editor extends EventEmitter {
}
this.commands[name] = this.chainCommand((...args: any) => {
return new Promise(resolve => callback(resolve, this, ...args))
return new Promise(resolve => callback(resolve, this.proxy, ...args))
})
return this.proxy