ui/menubar/utils
@ckeditor/ckeditor5-ui/src/menubar/utils
Filtering
Constants
-
DefaultMenuBarItems : MenuBarConfigObject[ 'items' ]
module:ui/menubar/utils#DefaultMenuBarItems
The default items configuration of the
MenuBarView
component. It contains names of all menu bar components registered in the component factory (available in the project).Note: Menu bar component names provided by core editor features are prefixed with
menuBar:
in order to distinguish them from components referenced by the toolbar configuration, for instance,'menuBar:bold'
is a menu bar button but'bold'
is a toolbar button.Below is the preset menu bar structure (the default value of
config.menuBar.items
property):[ { menuId: 'file', label: 'File', groups: [ { groupId: 'export', items: [ 'menuBar:exportPdf', 'menuBar:exportWord' ] }, { groupId: 'import', items: [ 'menuBar:importWord' ] }, { groupId: 'revisionHistory', items: [ 'menuBar:revisionHistory' ] } ] }, { menuId: 'edit', label: 'Edit', groups: [ { groupId: 'undo', items: [ 'menuBar:undo', 'menuBar:redo' ] }, { groupId: 'selectAll', items: [ 'menuBar:selectAll' ] }, { groupId: 'findAndReplace', items: [ 'menuBar:findAndReplace' ] } ] }, { menuId: 'view', label: 'View', groups: [ { groupId: 'sourceEditing', items: [ 'menuBar:sourceEditing' ] }, { groupId: 'showBlocks', items: [ 'menuBar:showBlocks' ] }, { groupId: 'previewMergeFields', items: [ 'menuBar:previewMergeFields' ] }, { groupId: 'restrictedEditingException', items: [ 'menuBar:restrictedEditingException' ] } ] }, { menuId: 'insert', label: 'Insert', groups: [ { groupId: 'insertMainWidgets', items: [ 'menuBar:insertImage', 'menuBar:ckbox', 'menuBar:ckfinder', 'menuBar:insertTable' ] }, { groupId: 'insertInline', items: [ 'menuBar:link', 'menuBar:comment', 'menuBar:insertMergeField' ] }, { groupId: 'insertMinorWidgets', items: [ 'menuBar:mediaEmbed', 'menuBar:insertTemplate', 'menuBar:blockQuote', 'menuBar:codeBlock', 'menuBar:htmlEmbed' ] }, { groupId: 'insertStructureWidgets', items: [ 'menuBar:horizontalLine', 'menuBar:pageBreak', 'menuBar:tableOfContents' ] }, { groupId: 'restrictedEditing', items: [ 'menuBar:restrictedEditing' ] } ] }, { menuId: 'format', label: 'Format', groups: [ { groupId: 'textAndFont', items: [ { menuId: 'text', label: 'Text', groups: [ { groupId: 'basicStyles', items: [ 'menuBar:bold', 'menuBar:italic', 'menuBar:underline', 'menuBar:strikethrough', 'menuBar:superscript', 'menuBar:subscript', 'menuBar:code' ] }, { groupId: 'textPartLanguage', items: [ 'menuBar:textPartLanguage' ] } ] }, { menuId: 'font', label: 'Font', groups: [ { groupId: 'fontProperties', items: [ 'menuBar:fontSize', 'menuBar:fontFamily' ] }, { groupId: 'fontColors', items: [ 'menuBar:fontColor', 'menuBar:fontBackgroundColor' ] }, { groupId: 'highlight', items: [ 'menuBar:highlight' ] } ] }, 'menuBar:heading' ] }, { groupId: 'list', items: [ 'menuBar:bulletedList', 'menuBar:numberedList', 'menuBar:multiLevelList', 'menuBar:todoList' ] }, { groupId: 'indent', items: [ 'menuBar:alignment', 'menuBar:indent', 'menuBar:outdent' ] }, { groupId: 'caseChange', items: [ 'menuBar:caseChange' ] }, { groupId: 'removeFormat', items: [ 'menuBar:removeFormat' ] } ] }, { menuId: 'tools', label: 'Tools', groups: [ { groupId: 'aiTools', items: [ 'menuBar:aiAssistant', 'menuBar:aiCommands' ] }, { groupId: 'tools', items: [ 'menuBar:trackChanges', 'menuBar:commentsArchive' ] } ] }, { menuId: 'help', label: 'Help', groups: [ { groupId: 'help', items: [ 'menuBar:accessibilityHelp' ] } ] } ];
The menu bar can be customized using the
config.menuBar.removeItems
andconfig.menuBar.addItems
properties. -
MenuBarBehaviors : object
module:ui/menubar/utils#MenuBarBehaviors
Behaviors of the
MenuBarView
component. -
MenuBarMenuBehaviors : object
module:ui/menubar/utils#MenuBarMenuBehaviors
Behaviors of the
MenuBarMenuView
component. -
MenuBarMenuViewPanelPositioningFunctions : Record<string, PositioningFunction>
module:ui/menubar/utils#MenuBarMenuViewPanelPositioningFunctions
Contains every positioning function used by
MenuBarMenuView
that decides where thepanelView
should be placed.Top-level menu positioning functions:
┌──────┐ │ │ ├──────┴────────┐ │ │ │ │ │ │ │ SE │ └───────────────┘ ┌──────┐ │ │ ┌────────┴──────┤ │ │ │ │ │ │ │ SW │ └───────────────┘ ┌───────────────┐ │ NW │ │ │ │ │ │ │ └────────┬──────┤ │ │ └──────┘ ┌───────────────┐ │ NE │ │ │ │ │ │ │ ├──────┬────────┘ │ │ └──────┘
Sub-menu positioning functions:
┌──────┬───────────────┐ │ │ │ └──────┤ │ │ │ │ ES │ └───────────────┘ ┌───────────────┬──────┐ │ │ │ │ ├──────┘ │ │ │ WS │ └───────────────┘ ┌───────────────┐ │ EN │ │ │ ┌──────┤ │ │ │ │ └──────┴───────────────┘ ┌───────────────┐ │ WN │ │ │ │ ├──────┐ │ │ │ └───────────────┴──────┘
Functions
-
normalizeMenuBarConfig( config ) → NormalizedMenuBarConfigObject
module:ui/menubar/utils~normalizeMenuBarConfig
Performs a cleanup and normalization of the menu bar configuration.
Parameters
config : Readonly<MenuBarConfigObject>
Returns
-
processMenuBarConfig( __namedParameters = { __namedParameters.componentFactory, __namedParameters.extraItems, __namedParameters.locale, __namedParameters.normalizedConfig } ) → NormalizedMenuBarConfigObject
module:ui/menubar/utils~processMenuBarConfig
Processes a normalized menu bar config and returns a config clone with the following modifications:
- Removed components that are not available in the component factory,
- Removed obsolete separators,
- Purged empty menus,
- Localized top-level menu labels.
Parameters
__namedParameters : object
-
Properties
__namedParameters.componentFactory : ComponentFactory
__namedParameters.extraItems : Array<MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu>
__namedParameters.locale : Locale
__namedParameters.normalizedConfig : NormalizedMenuBarConfigObject
Returns
Every day, we work hard to keep our documentation complete. Have you spotted outdated information? Is something missing? Please report it via our issue tracker.
With the release of version 42.0.0, we have rewritten much of our documentation to reflect the new import paths and features. We appreciate your feedback to help us ensure its accuracy and completeness.