UIOptions>= v1.5.0
UIOptions:
{}Configuration options for the user interface.
CreateEditorOptions for all available options when creating an editor.
Properties
Section titled “Properties”locale?
Section titled “locale?”
optionallocale:Locale|"auto"
The locale to use for displaying text, formatting numbers etc.
auto will automatically detect the user’s locale based on their browser settings. If this doesn’t match a supported locale, it will
fall back to en.
Default Value
Section titled “Default Value”auto
optionalunit:Unit
The unit system for measurements shown in the UI.
Default Value
Section titled “Default Value”pt
ruler?
Section titled “ruler?”
optionalruler:object
Configuration for the ruler feature.
enabled
Section titled “enabled”enabled:
boolean
Controls whether the ruler is shown by default when the editor loads.
Default Value
Section titled “Default Value”true
optionaltoolbar:ToolbarConfig
Initial toolbar configuration.
The toolbar can also be customized at runtime using editor.setToolbarConfig().
Examples
Section titled “Examples”
// Add a separator and custom action to the default toolbarconst editor = await system.createEditor(target, { ui: { actions: [...defaultActions, { id: 'custom.hello', label: 'Say Hello', handler: () => alert('Hello!') }], toolbar: { items: [ { type: 'separator', id: 'sep-custom' }, { type: 'action', id: 'custom-action', actionId: 'custom.hello' }, ], }, },});// Create a minimal toolbar with just undo/redo and bold/italicconst editor = await system.createEditor(target, { ui: { toolbar: { items: [ { type: 'built-in', id: 'undo', builtInType: 'undo' }, { type: 'built-in', id: 'redo', builtInType: 'redo' }, { type: 'separator', id: 'sep-1' }, { type: 'built-in', id: 'bold', builtInType: 'bold' }, { type: 'built-in', id: 'italic', builtInType: 'italic' }, ], }, },});// Mix built-in items with custom actionsconst editor = await system.createEditor(target, { ui: { toolbar: { items: [ { type: 'built-in', id: 'undo', builtInType: 'undo' }, { type: 'action', id: 'custom-btn', actionId: 'custom.my-action' }, ], }, actions: [ { id: 'custom.my-action', label: 'My Action', handler: () => console.log('clicked!'), }, ], },});ToolbarConfigfor the toolbar configuration type.defaultToolbarConfigfor the default toolbar configuration.
optionalactions:Action[]
Initial actions configuration.
Actions can also be customized at runtime using editor.setActions().
Example
Section titled “Example”
const editor = await system.createEditor(target, { ui: { actions: [ { id: 'custom.hello', label: 'Say Hello', handler: () => alert('Hello!'), }, ], },});