substance
Version:
Substance is a JavaScript library for web-based content editing. It provides building blocks for realizing custom text editors and web-based publishing systems.
13 lines • 436 B
JavaScript
class ExecuteCommandHandler {
constructor(editorSession, commandName) {
this.editorSession = editorSession
this.commandName = commandName
}
execute(params) {
let commandState = params.editorSession.getCommandStates()[this.commandName]
if (!commandState || commandState.disabled) return false
this.editorSession.executeCommand(this.commandName, params)
return true
}
}
export default ExecuteCommandHandler