Skip to content
Document Authoring DA  API Docs v1.9.1
npmGitHub

defaultActionsNEW

const defaultActions: 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.

Custom actions (those with any other string ID) must provide a handler function.

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: ['Ctrl+B'] },
]);
// Override a built-in action's behavior
editor.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.my-action', label: 'My Action', handler: () => console.log('clicked') },
]);