Socket
Socket
Sign inDemoInstall

@ckeditor/ckeditor5-ui

Package Overview
Dependencies
Maintainers
1
Versions
584
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ckeditor/ckeditor5-ui - npm Package Compare versions

Comparing version 0.0.0-nightly-20240710.0 to 0.0.0-nightly-20240711.0

46

dist/types/editorui/editorui.d.ts

@@ -20,3 +20,3 @@ /**

import type { Editor } from '@ckeditor/ckeditor5-core';
import type MenuBarView from '../menubar/menubarview.js';
import type { default as MenuBarView, MenuBarConfigAddedGroup, MenuBarConfigAddedItem, MenuBarConfigAddedMenu } from '../menubar/menubarview.js';
declare const EditorUI_base: {

@@ -110,2 +110,6 @@ new (): import("@ckeditor/ckeditor5-utils").Observable;

/**
* All additional menu bar items, groups or menus that have their default location defined.
*/
private _extraMenuBarElements;
/**
* Creates an instance of the editor UI class.

@@ -176,2 +180,42 @@ *

/**
* Registers an extra menu bar element, which could be a single item, a group of items, or a menu containing groups.
*
* ```ts
* // Register a new menu bar item.
* editor.ui.extendMenuBar( {
* item: 'menuBar:customFunctionButton',
* position: 'after:menuBar:bold'
* } );
*
* // Register a new menu bar group.
* editor.ui.extendMenuBar( {
* group: {
* groupId: 'customGroup',
* items: [
* 'menuBar:customFunctionButton'
* ]
* },
* position: 'start:help'
* } );
*
* // Register a new menu bar menu.
* editor.ui.extendMenuBar( {
* menu: {
* menuId: 'customMenu',
* label: 'customMenu',
* groups: [
* {
* groupId: 'customGroup',
* items: [
* 'menuBar:customFunctionButton'
* ]
* }
* ]
* },
* position: 'after:help'
* } );
* ```
*/
extendMenuBar(config: MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu): void;
/**
* Stores all editable elements used by the editor instance.

@@ -178,0 +222,0 @@ *

2

dist/types/menubar/menubarview.d.ts

@@ -63,3 +63,3 @@ /**

*/
fillFromConfig(config: NormalizedMenuBarConfigObject, componentFactory: ComponentFactory): void;
fillFromConfig(config: NormalizedMenuBarConfigObject, componentFactory: ComponentFactory, extraItems?: Array<MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu>): void;
/**

@@ -66,0 +66,0 @@ * @inheritDoc

@@ -10,3 +10,3 @@ /**

import type MenuBarMenuView from './menubarmenuview.js';
import type { default as MenuBarView, MenuBarConfig, MenuBarConfigObject, NormalizedMenuBarConfigObject } from './menubarview.js';
import type { default as MenuBarView, MenuBarConfig, MenuBarConfigObject, MenuBarConfigAddedGroup, MenuBarConfigAddedMenu, NormalizedMenuBarConfigObject, MenuBarConfigAddedItem } from './menubarview.js';
import type ComponentFactory from '../componentfactory.js';

@@ -439,7 +439,8 @@ import { type Locale, type PositioningFunction } from '@ckeditor/ckeditor5-utils';

*/
export declare function processMenuBarConfig({ normalizedConfig, locale, componentFactory }: {
export declare function processMenuBarConfig({ normalizedConfig, locale, componentFactory, extraItems }: {
normalizedConfig: NormalizedMenuBarConfigObject;
locale: Locale;
componentFactory: ComponentFactory;
extraItems: Array<MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu>;
}): NormalizedMenuBarConfigObject;
export {};
{
"name": "@ckeditor/ckeditor5-ui",
"version": "0.0.0-nightly-20240710.0",
"version": "0.0.0-nightly-20240711.0",
"description": "The UI framework and standard UI library of CKEditor 5.",

@@ -15,4 +15,4 @@ "keywords": [

"dependencies": {
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20240710.0",
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20240710.0",
"@ckeditor/ckeditor5-core": "0.0.0-nightly-20240711.0",
"@ckeditor/ckeditor5-utils": "0.0.0-nightly-20240711.0",
"color-convert": "2.0.1",

@@ -19,0 +19,0 @@ "color-parse": "1.4.2",

@@ -16,3 +16,3 @@ /**

import type { Editor } from '@ckeditor/ckeditor5-core';
import type MenuBarView from '../menubar/menubarview.js';
import type { default as MenuBarView, MenuBarConfigAddedGroup, MenuBarConfigAddedItem, MenuBarConfigAddedMenu } from '../menubar/menubarview.js';
declare const EditorUI_base: {

@@ -106,2 +106,6 @@ new (): import("@ckeditor/ckeditor5-utils").Observable;

/**
* All additional menu bar items, groups or menus that have their default location defined.
*/
private _extraMenuBarElements;
/**
* Creates an instance of the editor UI class.

@@ -172,2 +176,42 @@ *

/**
* Registers an extra menu bar element, which could be a single item, a group of items, or a menu containing groups.
*
* ```ts
* // Register a new menu bar item.
* editor.ui.extendMenuBar( {
* item: 'menuBar:customFunctionButton',
* position: 'after:menuBar:bold'
* } );
*
* // Register a new menu bar group.
* editor.ui.extendMenuBar( {
* group: {
* groupId: 'customGroup',
* items: [
* 'menuBar:customFunctionButton'
* ]
* },
* position: 'start:help'
* } );
*
* // Register a new menu bar menu.
* editor.ui.extendMenuBar( {
* menu: {
* menuId: 'customMenu',
* label: 'customMenu',
* groups: [
* {
* groupId: 'customGroup',
* items: [
* 'menuBar:customFunctionButton'
* ]
* }
* ]
* },
* position: 'after:help'
* } );
* ```
*/
extendMenuBar(config: MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu): void;
/**
* Stores all editable elements used by the editor instance.

@@ -174,0 +218,0 @@ *

@@ -41,2 +41,6 @@ /**

this._focusableToolbarDefinitions = [];
/**
* All additional menu bar items, groups or menus that have their default location defined.
*/
this._extraMenuBarElements = [];
const editingView = editor.editing.view;

@@ -186,2 +190,44 @@ this.editor = editor;

/**
* Registers an extra menu bar element, which could be a single item, a group of items, or a menu containing groups.
*
* ```ts
* // Register a new menu bar item.
* editor.ui.extendMenuBar( {
* item: 'menuBar:customFunctionButton',
* position: 'after:menuBar:bold'
* } );
*
* // Register a new menu bar group.
* editor.ui.extendMenuBar( {
* group: {
* groupId: 'customGroup',
* items: [
* 'menuBar:customFunctionButton'
* ]
* },
* position: 'start:help'
* } );
*
* // Register a new menu bar menu.
* editor.ui.extendMenuBar( {
* menu: {
* menuId: 'customMenu',
* label: 'customMenu',
* groups: [
* {
* groupId: 'customGroup',
* items: [
* 'menuBar:customFunctionButton'
* ]
* }
* ]
* },
* position: 'after:help'
* } );
* ```
*/
extendMenuBar(config) {
this._extraMenuBarElements.push(config);
}
/**
* Stores all editable elements used by the editor instance.

@@ -213,3 +259,3 @@ *

const normalizedMenuBarConfig = normalizeMenuBarConfig(this.editor.config.get('menuBar') || {});
menuBarView.fillFromConfig(normalizedMenuBarConfig, this.componentFactory);
menuBarView.fillFromConfig(normalizedMenuBarConfig, this.componentFactory, this._extraMenuBarElements);
this.editor.keystrokes.set('Esc', (data, cancel) => {

@@ -216,0 +262,0 @@ if (menuBarViewElement.contains(this.editor.ui.focusTracker.focusedElement)) {

@@ -59,3 +59,3 @@ /**

*/
fillFromConfig(config: NormalizedMenuBarConfigObject, componentFactory: ComponentFactory): void;
fillFromConfig(config: NormalizedMenuBarConfigObject, componentFactory: ComponentFactory, extraItems?: Array<MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu>): void;
/**

@@ -62,0 +62,0 @@ * @inheritDoc

@@ -72,3 +72,3 @@ /**

*/
fillFromConfig(config, componentFactory) {
fillFromConfig(config, componentFactory, extraItems = []) {
const locale = this.locale;

@@ -78,3 +78,4 @@ const processedConfig = processMenuBarConfig({

locale,
componentFactory
componentFactory,
extraItems
});

@@ -81,0 +82,0 @@ const topLevelCategoryMenuViews = processedConfig.items.map(menuDefinition => this._createMenu({

@@ -6,3 +6,3 @@ /**

import type MenuBarMenuView from './menubarmenuview.js';
import type { default as MenuBarView, MenuBarConfig, MenuBarConfigObject, NormalizedMenuBarConfigObject } from './menubarview.js';
import type { default as MenuBarView, MenuBarConfig, MenuBarConfigObject, MenuBarConfigAddedGroup, MenuBarConfigAddedMenu, NormalizedMenuBarConfigObject, MenuBarConfigAddedItem } from './menubarview.js';
import type ComponentFactory from '../componentfactory.js';

@@ -435,7 +435,8 @@ import { type Locale, type PositioningFunction } from '@ckeditor/ckeditor5-utils';

*/
export declare function processMenuBarConfig({ normalizedConfig, locale, componentFactory }: {
export declare function processMenuBarConfig({ normalizedConfig, locale, componentFactory, extraItems }: {
normalizedConfig: NormalizedMenuBarConfigObject;
locale: Locale;
componentFactory: ComponentFactory;
extraItems: Array<MenuBarConfigAddedItem | MenuBarConfigAddedGroup | MenuBarConfigAddedMenu>;
}): NormalizedMenuBarConfigObject;
export {};

@@ -926,6 +926,7 @@ /**

*/
export function processMenuBarConfig({ normalizedConfig, locale, componentFactory }) {
export function processMenuBarConfig({ normalizedConfig, locale, componentFactory, extraItems }) {
const configClone = cloneDeep(normalizedConfig);
handleAdditions(normalizedConfig, configClone, extraItems);
handleRemovals(normalizedConfig, configClone);
handleAdditions(normalizedConfig, configClone);
handleAdditions(normalizedConfig, configClone, configClone.addItems);
purgeUnavailableComponents(normalizedConfig, configClone, componentFactory);

@@ -995,9 +996,11 @@ purgeEmptyMenus(normalizedConfig, configClone);

/**
* Handles the `config.menuBar.addItems` configuration. It allows for adding menus, groups, and items at arbitrary
* Adds provided items to config. It allows for adding menus, groups, and items at arbitrary
* positions in the menu bar. If the position does not exist, a warning is logged.
*/
function handleAdditions(originalConfig, config) {
const itemsToBeAdded = config.addItems;
function handleAdditions(originalConfig, config, items) {
const successFullyAddedItems = [];
for (const itemToAdd of itemsToBeAdded) {
if (items.length == 0) {
return;
}
for (const itemToAdd of items) {
const relation = getRelationFromPosition(itemToAdd.position);

@@ -1081,3 +1084,3 @@ const relativeId = getRelativeIdFromPosition(itemToAdd.position);

}
for (const addedItemConfig of itemsToBeAdded) {
for (const addedItemConfig of items) {
if (!successFullyAddedItems.includes(addedItemConfig)) {

@@ -1084,0 +1087,0 @@ /**

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc