defaultActions>= v1.9.0
constdefaultActions:BuiltInAction[]
Get the default set of actions available in the editor. Can be combined with custom actions.
Note: Built-in actions (those with IDs from BuiltInActionId) can omit handlers - they will be automatically populated with default
implementations when passed to editor.setActions(). This allows you to customize labels, shortcuts, and order without needing to
implement the behavior yourself. Built-in handlers can also be overridden by providing your own handler function.
Built-in action overrides also inherit the built-in action’s capabilities unless
they provide explicit ActionCapability values; for example,
document.export-pdf keeps document.read and formatting.bold keeps
document.change. Custom actions (those with any other string ID) must provide a
handler function. Custom actions that omit capabilities default to document.change,
so view mode blocks them unless they explicitly declare only view-mode-safe
capabilities.
Example
Section titled “Example”import { defaultActions } from '@nutrient-sdk/document-authoring';
// Customize a built-in action's metadata (handlers auto-populate for built-in actions)editor.setActions([ ...defaultActions.filter(({ id }) => id !== 'formatting.bold'), { id: 'formatting.bold', label: 'Make Bold', shortcuts: ['Mod+B'] },]);
// Override a built-in action's behavioreditor.setActions([ ...defaultActions.filter(({ id }) => id !== 'formatting.bold'), { id: 'formatting.bold', label: 'Bold', handler: () => console.log('custom bold!') },]);
// Add custom actions (must provide handler)editor.setActions([ ...defaultActions.filter((a) => a.id !== 'document.export-pdf'), { id: 'custom.open-help', label: 'Open Help', capabilities: ['external.open'], handler: () => window.open('/help', '_blank'), },]);