ContextMenuActionItem>= v1.23.0
ContextMenuActionItem:
Context menu item that runs a registered action.
The item shows the action’s label and icon. It is hidden when the action isn’t registered, and disabled when the action can’t run, for
example when its isEnabled() returns false or the editor is in view mode and the action’s capabilities aren’t allowed there. The
action must be registered via DocAuthEditor.setActions or UIOptions.actions.
Example
Section titled “Example”editor.setActions([ { id: 'custom.uppercase', label: 'Uppercase', isEnabled: () => !!editor.getSelectionContent({ format: 'text' }), handler: () => { const text = editor.getSelectionContent({ format: 'text' }); if (text) editor.insertContentAtCursor({ content: text.toUpperCase() }); }, },]);
editor.setContextMenuConfig({ text: { items: [{ type: 'action', id: 'uppercase', actionId: 'custom.uppercase' }] },});ContextMenuConfig for the full context menu configuration.
Properties
Section titled “Properties”type:
"action"
id:
string
Unique ID for this context menu item
actionId
Section titled “actionId”actionId:
string
ID of the action to run when this item is chosen