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 system. It is developed to power our online editing platform [Substance](http://substance.io).
18 lines (15 loc) • 462 B
JavaScript
import { Command } from '../editor'
export default class RemoveInlineNodeCommand extends Command {
getCommandState (params) {
const selectionState = params.selectionState
if (selectionState.node) {
return { disabled: false, node: selectionState.node }
}
return { disabled: true }
}
execute (params, context) {
const commandState = params.commandState
const node = commandState.node
context.api.deleteNode(node.id)
}
}