Reusable command implementation for inserting inline nodes.


Define a custom command.

class AddXRefCommand extends InsertInlineNodeCommand {
  createNodeData() {
    return {
      attributes: {'ref-type': 'bibr'},
      targets: [],
      label: '???',
      type: 'xref'

Register it in your app using the configurator.

config.addCommand('add-xref', AddXRefCommand, {nodeType: 'xref'})

Determine command state for inline node insertion. Command is enabled if selection is a property selection.

Insert new inline node at the current selection