BuiltInAction>= v1.9.0
BuiltInAction:
{}Built-in actions have pre-defined IDs from BuiltInActionId and automatically use default handlers if not provided. This allows you
to customize things without having to reimplement internal functionality.
If an override omits capabilities, it keeps the built-in action’s capabilities.
For example, document.export-pdf keeps document.read, and formatting.bold
keeps document.change. Set capabilities only when your override changes what
the action does.
Example
Section titled “Example”
// Remove all built-in actions except bold built-in (handler auto-populated)editor.setActions([{ id: 'formatting.bold', label: 'Bold', shortcuts: ['Mod+B'] }]);
// Override the default handler for boldeditor.setActions([ { id: 'formatting.bold', label: 'Bold', shortcuts: ['Mod+B'], handler: () => { console.log('Custom bold implementation'); }, },]);
// Customize shortcuts and labels while keeping default behavioreditor.setActions([ { id: 'document.export-pdf', label: 'Download PDF', shortcuts: ['Mod+P'] },]);BuiltInActionIdfor available built-in action IDs.CustomActionfor defining custom actions.
Properties
Section titled “Properties”id:
BuiltInActionId
The built-in action to configure. ActionCalls describes what each one does and the arguments it takes.
label:
string
Text shown for the action in the command palette and on
ToolbarActionItem buttons.
If the label is the same as the action’s default label in defaultActions, it
keeps its built-in translation for UIOptions.locale. Any
other label is an override that the editor shows untranslated in every locale.
description?
Section titled “description?”
optionaldescription:string
capabilities?
Section titled “capabilities?”
optionalcapabilities: readonlyActionCapability[]
What kind of change the action makes, which decides the editor modes it can run
in. If omitted, the built-in action’s capabilities are kept; if set, they replace
them. setActions() throws on values that are not an ActionCapability.
shortcuts?
Section titled “shortcuts?”
optionalshortcuts:string[]
Keyboard shortcuts for the action. Use “Mod” as the primary modifier key - it will be automatically resolved to:
- “Ctrl” on Windows/Linux
- ”⌘” (Command) on Mac
Examples:
- “Mod+B” becomes “Ctrl+B” on Windows, “⌘B” on Mac
- “Mod+Shift+P” becomes “Ctrl+Shift+P” on Windows, ”⌘⇧P” on Mac
optionalicon:string
Icon as data URI (e.g., data:image/svg+xml;base64,… or data:image/png;base64,…). Only data:image/ URIs are allowed for security.
isEnabled()?
Section titled “isEnabled()?”
optionalisEnabled: () =>boolean
Replaces the built-in availability check rather than adding to it. Receives no
action arguments. If omitted, the built-in check is kept.
For revision.accept and revision.reject, replacing this check can enable a
control for an operation that canPerformTrackedChange denies. Core still
blocks that operation when the built-in handler runs. Mode checks still apply.
Returns
Section titled “Returns”handler()?
Section titled “handler()?”Replaces the built-in handler. If omitted, the SDK uses its built-in handler and
validates its arguments. A replacement handler is responsible for validating
its own arguments. Mode and isEnabled checks still apply.
Parameters
Section titled “Parameters”…any[]