ckeditor5-elements-core 49.0.0-alpha.0 → 49.0.0-alpha.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/elementOrPositionButtonView.d.ts +10 -4
- package/dist/elementOrPositionButtonView.d.ts.map +1 -1
- package/dist/elementOrPositionButtonView.js +8 -2
- package/dist/elementOrPositionButtonView.js.map +1 -1
- package/dist/index.d.ts +6 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -10
- package/dist/index.js.map +1 -1
- package/dist/matching.d.ts +24 -0
- package/dist/matching.d.ts.map +1 -0
- package/dist/matching.js +27 -0
- package/dist/matching.js.map +1 -0
- package/dist/singleCopyGuard.js +2 -2
- package/dist/utils.d.ts +17 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -0
- package/dist/utils.js.map +1 -1
- package/package.json +2 -4
- package/src/elementOrPositionButtonView.ts +22 -6
- package/src/index.ts +8 -18
- package/src/matching.ts +45 -0
- package/src/singleCopyGuard.ts +2 -2
- package/src/utils.ts +49 -1
- package/dist/augmentation.d.ts +0 -7
- package/dist/augmentation.d.ts.map +0 -1
- package/dist/augmentation.js +0 -2
- package/dist/augmentation.js.map +0 -1
- package/dist/elementMenu.d.ts +0 -93
- package/dist/elementMenu.d.ts.map +0 -1
- package/dist/elementMenu.js +0 -160
- package/dist/elementMenu.js.map +0 -1
- package/dist/elementMenuItemButtonView.d.ts +0 -24
- package/dist/elementMenuItemButtonView.d.ts.map +0 -1
- package/dist/elementMenuItemButtonView.js +0 -29
- package/dist/elementMenuItemButtonView.js.map +0 -1
- package/dist/elementMenuView.d.ts +0 -35
- package/dist/elementMenuView.d.ts.map +0 -1
- package/dist/elementMenuView.js +0 -118
- package/dist/elementMenuView.js.map +0 -1
- package/dist/menuSeparatorView.d.ts +0 -8
- package/dist/menuSeparatorView.d.ts.map +0 -1
- package/dist/menuSeparatorView.js +0 -16
- package/dist/menuSeparatorView.js.map +0 -1
- package/dist/submenuView.d.ts +0 -68
- package/dist/submenuView.d.ts.map +0 -1
- package/dist/submenuView.js +0 -159
- package/dist/submenuView.js.map +0 -1
- package/src/augmentation.ts +0 -7
- package/src/elementMenu.ts +0 -272
- package/src/elementMenuView.ts +0 -164
- package/theme/elementMenu.css +0 -14
package/dist/elementMenu.d.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { ContextualBalloon, Notification, Plugin, type Editor, type FocusableView, type ModelElement, type RectSource } from 'ckeditor5';
|
|
2
|
-
import ElementOrPositionCommand from './elementOrPositionCommand.js';
|
|
3
|
-
/**
|
|
4
|
-
* A submenu of an element menu. Missing items are skipped, as in the menu.
|
|
5
|
-
*/
|
|
6
|
-
export interface ElementSubmenu {
|
|
7
|
-
title: string;
|
|
8
|
-
/**
|
|
9
|
-
* The icon (SVG string) shown next to the title.
|
|
10
|
-
*/
|
|
11
|
-
icon?: string;
|
|
12
|
-
items: (ElementMenuItem | null | undefined)[];
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* An item of an element menu:
|
|
16
|
-
*
|
|
17
|
-
* * a command, shown as a button with its `title` and `icon`, enabled and "on" according to its
|
|
18
|
-
* {@link ElementOrPositionCommand#getState state} for the element,
|
|
19
|
-
* * a submenu,
|
|
20
|
-
* * `'|'`, a separator. Separators at the start or the end of a menu, and repeated ones, are not shown, so a group of
|
|
21
|
-
* items can start with one.
|
|
22
|
-
*/
|
|
23
|
-
export type ElementMenuItem = ElementOrPositionCommand | ElementSubmenu | '|';
|
|
24
|
-
/**
|
|
25
|
-
* Returns the items of the menu of the given element, e.g. as the `elementContextMenu` or `breadcrumbs.menu` editor
|
|
26
|
-
* config option. Missing items (e.g. commands that are not registered) are skipped. No items means no menu.
|
|
27
|
-
*/
|
|
28
|
-
export type ElementMenuConfig = (element: ModelElement, editor: Editor) => (ElementMenuItem | null | undefined)[];
|
|
29
|
-
/**
|
|
30
|
-
* The options of {@link ElementMenu#open} and {@link ElementMenu#show}.
|
|
31
|
-
*/
|
|
32
|
-
export interface ElementMenuShowOptions {
|
|
33
|
-
/**
|
|
34
|
-
* The accessible name of the menu of an element (see {@link ElementMenu#open}). Defaults to "Element menu".
|
|
35
|
-
*/
|
|
36
|
-
label?: string;
|
|
37
|
-
/**
|
|
38
|
-
* Called when the document data changes while the menu is open. When it returns `true`, the menu closes, e.g.
|
|
39
|
-
* because the element it is for was removed.
|
|
40
|
-
*/
|
|
41
|
-
isObsolete?: () => boolean;
|
|
42
|
-
/**
|
|
43
|
-
* What gets the focus when the menu is closed with Esc, e.g. the button that opened the menu. Defaults to the editor.
|
|
44
|
-
*/
|
|
45
|
-
returnFocusTo?: {
|
|
46
|
-
focus(): void;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Called when the menu closes, for any reason: Esc, a click outside, an executed item, or another menu replacing it.
|
|
50
|
-
*/
|
|
51
|
-
onHide?: () => void;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Shows menus in a balloon: the menu of an element, built from commands, submenus and separators (see {@link open}),
|
|
55
|
-
* or any view, e.g. the quick insert search (see {@link show}).
|
|
56
|
-
*
|
|
57
|
-
* The element context menu, the breadcrumbs and quick insert show their menus with it. The menu of an element is
|
|
58
|
-
* CKEditor's dropdown menu (see {@link ElementMenuView}).
|
|
59
|
-
*
|
|
60
|
-
* Executing an item closes the menu. Esc and clicking outside close it too; Esc returns the focus to the editor, or to
|
|
61
|
-
* {@link ElementMenuShowOptions.returnFocusTo}.
|
|
62
|
-
*/
|
|
63
|
-
export default class ElementMenu extends Plugin {
|
|
64
|
-
/**
|
|
65
|
-
* The view in the open menu, if any.
|
|
66
|
-
*/
|
|
67
|
-
view: FocusableView | null;
|
|
68
|
-
private _keystrokes;
|
|
69
|
-
private _isObsolete;
|
|
70
|
-
private _onHide;
|
|
71
|
-
static get requires(): readonly [typeof ContextualBalloon, typeof Notification];
|
|
72
|
-
static get pluginName(): 'ElementMenu';
|
|
73
|
-
init(): void;
|
|
74
|
-
/**
|
|
75
|
-
* Opens the menu of the element next to the target (e.g. a button, or a `DOMRect` in viewport coordinates), with
|
|
76
|
-
* the items from the config callback. The menu closes when the element is removed.
|
|
77
|
-
*
|
|
78
|
-
* Returns `false` when there are no items.
|
|
79
|
-
*/
|
|
80
|
-
open(element: ModelElement, target: RectSource, config: ElementMenuConfig, { label, isObsolete, ...options }?: ElementMenuShowOptions): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Shows the view (e.g. a menu) next to the target (e.g. a button, or a `DOMRect` in viewport coordinates), and
|
|
83
|
-
* focuses it. The menu closes when the view, or an item of CKEditor's dropdown menu in it, fires `execute`.
|
|
84
|
-
*/
|
|
85
|
-
show(view: FocusableView, target: RectSource, { isObsolete, returnFocusTo, onHide }?: ElementMenuShowOptions): void;
|
|
86
|
-
/**
|
|
87
|
-
* Hides the open menu, if any.
|
|
88
|
-
*/
|
|
89
|
-
hide(): void;
|
|
90
|
-
destroy(): void;
|
|
91
|
-
private get _balloon();
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=elementMenu.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elementMenu.d.ts","sourceRoot":"","sources":["../src/elementMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EAGjB,YAAY,EACZ,MAAM,EAEN,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,UAAU,EACf,MAAM,WAAW,CAAC;AAEnB,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AAGrE;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,KAAK,EAAE,CAAC,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,CAAC;CAC9C;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,eAAe,GAA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,IAAI;IAK/B,OAAO,KAAK,QAAQ,GAEnB;CACD"}
|
package/dist/elementMenu.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { ContextualBalloon, DropdownMenuRootListView, KeystrokeHandler, Notification, Plugin, clickOutsideHandler } from 'ckeditor5';
|
|
2
|
-
import ElementMenuView from './elementMenuView.js';
|
|
3
|
-
import ElementOrPositionCommand from './elementOrPositionCommand.js';
|
|
4
|
-
import { isInDocument } from './utils.js';
|
|
5
|
-
/**
|
|
6
|
-
* Shows menus in a balloon: the menu of an element, built from commands, submenus and separators (see {@link open}),
|
|
7
|
-
* or any view, e.g. the quick insert search (see {@link show}).
|
|
8
|
-
*
|
|
9
|
-
* The element context menu, the breadcrumbs and quick insert show their menus with it. The menu of an element is
|
|
10
|
-
* CKEditor's dropdown menu (see {@link ElementMenuView}).
|
|
11
|
-
*
|
|
12
|
-
* Executing an item closes the menu. Esc and clicking outside close it too; Esc returns the focus to the editor, or to
|
|
13
|
-
* {@link ElementMenuShowOptions.returnFocusTo}.
|
|
14
|
-
*/
|
|
15
|
-
export default class ElementMenu extends Plugin {
|
|
16
|
-
/**
|
|
17
|
-
* The view in the open menu, if any.
|
|
18
|
-
*/
|
|
19
|
-
view = null;
|
|
20
|
-
_keystrokes = null;
|
|
21
|
-
_isObsolete = null;
|
|
22
|
-
_onHide = null;
|
|
23
|
-
static get requires() {
|
|
24
|
-
// The buttons of the menu report failed commands with notifications.
|
|
25
|
-
return [ContextualBalloon, Notification];
|
|
26
|
-
}
|
|
27
|
-
static get pluginName() {
|
|
28
|
-
return 'ElementMenu';
|
|
29
|
-
}
|
|
30
|
-
init() {
|
|
31
|
-
this.listenTo(this.editor.model.document, 'change:data', () => {
|
|
32
|
-
if (this._isObsolete?.()) {
|
|
33
|
-
this.hide();
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Opens the menu of the element next to the target (e.g. a button, or a `DOMRect` in viewport coordinates), with
|
|
39
|
-
* the items from the config callback. The menu closes when the element is removed.
|
|
40
|
-
*
|
|
41
|
-
* Returns `false` when there are no items.
|
|
42
|
-
*/
|
|
43
|
-
open(element, target, config, { label = this.editor.t('Element menu'), isObsolete, ...options } = {}) {
|
|
44
|
-
const items = cleanItems(config(element, this.editor));
|
|
45
|
-
if (!items.length) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
const view = new ElementMenuView(this.editor.locale, this.editor.ui.view.body, items, element);
|
|
49
|
-
view.ariaLabel = label;
|
|
50
|
-
this.show(view, target, {
|
|
51
|
-
...options,
|
|
52
|
-
isObsolete: () => !isInDocument(element) || !!isObsolete?.()
|
|
53
|
-
});
|
|
54
|
-
return true;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Shows the view (e.g. a menu) next to the target (e.g. a button, or a `DOMRect` in viewport coordinates), and
|
|
58
|
-
* focuses it. The menu closes when the view, or an item of CKEditor's dropdown menu in it, fires `execute`.
|
|
59
|
-
*/
|
|
60
|
-
show(view, target, { isObsolete, returnFocusTo, onHide } = {}) {
|
|
61
|
-
this.hide();
|
|
62
|
-
const close = () => {
|
|
63
|
-
// The item may have opened another menu already (e.g. "Insert before" opens quick insert).
|
|
64
|
-
if (this.view === view) {
|
|
65
|
-
this.hide();
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
this.listenTo(view, 'execute', close);
|
|
69
|
-
this.listenTo(view, 'menu:execute', close);
|
|
70
|
-
clickOutsideHandler({
|
|
71
|
-
emitter: view,
|
|
72
|
-
activator: () => this._balloon.visibleView === view,
|
|
73
|
-
// The open nested menus are in panels outside the balloon.
|
|
74
|
-
contextElements: () => [this._balloon.view.element, ...getOpenPanels(view)].filter(element => !!element),
|
|
75
|
-
callback: () => {
|
|
76
|
-
this.hide();
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
this._balloon.add({
|
|
80
|
-
view,
|
|
81
|
-
position: { target },
|
|
82
|
-
withArrow: false,
|
|
83
|
-
singleViewMode: true
|
|
84
|
-
});
|
|
85
|
-
const keystrokes = new KeystrokeHandler();
|
|
86
|
-
// Esc in a nested menu closes only that menu.
|
|
87
|
-
keystrokes.set('Esc', (data, cancel) => {
|
|
88
|
-
this.hide();
|
|
89
|
-
(returnFocusTo ?? this.editor.editing.view).focus();
|
|
90
|
-
cancel();
|
|
91
|
-
});
|
|
92
|
-
if (view.element) {
|
|
93
|
-
keystrokes.listenTo(view.element);
|
|
94
|
-
}
|
|
95
|
-
this.view = view;
|
|
96
|
-
this._keystrokes = keystrokes;
|
|
97
|
-
this._isObsolete = isObsolete ?? null;
|
|
98
|
-
this._onHide = onHide ?? null;
|
|
99
|
-
view.focus();
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* Hides the open menu, if any.
|
|
103
|
-
*/
|
|
104
|
-
hide() {
|
|
105
|
-
const view = this.view;
|
|
106
|
-
const onHide = this._onHide;
|
|
107
|
-
if (!view) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
this._keystrokes?.destroy();
|
|
111
|
-
this.view = null;
|
|
112
|
-
this._keystrokes = null;
|
|
113
|
-
this._isObsolete = null;
|
|
114
|
-
this._onHide = null;
|
|
115
|
-
this.stopListening(view);
|
|
116
|
-
if (this._balloon.hasView(view)) {
|
|
117
|
-
this._balloon.remove(view);
|
|
118
|
-
}
|
|
119
|
-
view.destroy();
|
|
120
|
-
onHide?.();
|
|
121
|
-
}
|
|
122
|
-
destroy() {
|
|
123
|
-
this.hide();
|
|
124
|
-
super.destroy();
|
|
125
|
-
}
|
|
126
|
-
get _balloon() {
|
|
127
|
-
return this.editor.plugins.get(ContextualBalloon);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Returns the items without missing ones, submenus without items, and separators at the start or the end, or
|
|
132
|
-
* repeated ones.
|
|
133
|
-
*/
|
|
134
|
-
function cleanItems(items) {
|
|
135
|
-
const result = [];
|
|
136
|
-
for (const item of items) {
|
|
137
|
-
const cleaned = item === '|' || item instanceof ElementOrPositionCommand || !item ? item : cleanSubmenu(item);
|
|
138
|
-
if (!cleaned || (cleaned === '|' && (!result.length || result.at(-1) === '|'))) {
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
result.push(cleaned);
|
|
142
|
-
}
|
|
143
|
-
if (result.at(-1) === '|') {
|
|
144
|
-
result.pop();
|
|
145
|
-
}
|
|
146
|
-
return result;
|
|
147
|
-
}
|
|
148
|
-
function cleanSubmenu(submenu) {
|
|
149
|
-
const items = cleanItems(submenu.items);
|
|
150
|
-
return items.length ? { ...submenu, items } : null;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Returns the panels of the open nested menus of CKEditor's dropdown menu.
|
|
154
|
-
*/
|
|
155
|
-
function getOpenPanels(view) {
|
|
156
|
-
return view instanceof DropdownMenuRootListView
|
|
157
|
-
? view.menus.filter(menu => menu.isOpen).map(menu => menu.panelView.element)
|
|
158
|
-
: [];
|
|
159
|
-
}
|
|
160
|
-
//# sourceMappingURL=elementMenu.js.map
|
package/dist/elementMenu.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elementMenu.js","sourceRoot":"","sources":["../src/elementMenu.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,mBAAmB,EAKnB,MAAM,WAAW,CAAC;AACnB,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,wBAAwB,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA2D1C;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,MAAM;IAC9C;;OAEG;IACI,IAAI,GAAyB,IAAI,CAAC;IAEjC,WAAW,GAA4B,IAAI,CAAC;IAC5C,WAAW,GAA2B,IAAI,CAAC;IAC3C,O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,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;QAC5E,CAAC,CAAC,EAAE,CAAC;AACP,CAAC"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { ListItemButtonView, type Locale } from 'ckeditor5';
|
|
2
|
-
import type ElementOrPositionCommand from './elementOrPositionCommand.js';
|
|
3
|
-
import { type ElementOrPosition } from './elementOrPositionCommand.js';
|
|
4
|
-
/**
|
|
5
|
-
* A menu item for an {@link ElementOrPositionCommand}: CKEditor's list item button, labelled with the command title and
|
|
6
|
-
* icon, that reflects and executes the command like {@link ElementOrPositionButtonView}.
|
|
7
|
-
*
|
|
8
|
-
* For a {@link ElementOrPositionCommand#isToggleable toggleable} command, it is a `menuitemcheckbox` with a check mark
|
|
9
|
-
* when the command is "on"; otherwise, a `menuitem`.
|
|
10
|
-
*/
|
|
11
|
-
export default class ElementMenuItemButtonView extends ListItemButtonView {
|
|
12
|
-
/**
|
|
13
|
-
* The command this item reflects.
|
|
14
|
-
*/
|
|
15
|
-
readonly command: ElementOrPositionCommand;
|
|
16
|
-
/**
|
|
17
|
-
* The position or element the item acts on, if any.
|
|
18
|
-
*/
|
|
19
|
-
readonly target: ElementOrPosition | undefined;
|
|
20
|
-
constructor(locale: Locale | undefined, command: ElementOrPositionCommand, { target }?: {
|
|
21
|
-
target?: ElementOrPosition;
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=elementMenuItemButtonView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elementMenuItemButtonView.d.ts","sourceRoot":"","sources":["../src/elementMenuItemButtonView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,KAAK,wBAAwB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,kBAAkB;IACxE;;OAEG;IACH,SAAgB,OAAO,EAAE,wBAAwB,CAAC;IAElD;;OAEG;IACH,SAAgB,MAAM,EAAE,iBAAiB,GAAG,SAAS,CAAC;gBAGrD,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,OAAO,EAAE,wBAAwB,EACjC,EAAE,MAAM,EAAE,GAAE;QAAE,MAAM,CAAC,EAAE,iBAAiB,CAAA;KAAO;CAYhD"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { ListItemButtonView } from 'ckeditor5';
|
|
2
|
-
import { bindButtonToCommand } from './elementOrPositionButtonView.js';
|
|
3
|
-
import {} from './elementOrPositionCommand.js';
|
|
4
|
-
/**
|
|
5
|
-
* A menu item for an {@link ElementOrPositionCommand}: CKEditor's list item button, labelled with the command title and
|
|
6
|
-
* icon, that reflects and executes the command like {@link ElementOrPositionButtonView}.
|
|
7
|
-
*
|
|
8
|
-
* For a {@link ElementOrPositionCommand#isToggleable toggleable} command, it is a `menuitemcheckbox` with a check mark
|
|
9
|
-
* when the command is "on"; otherwise, a `menuitem`.
|
|
10
|
-
*/
|
|
11
|
-
export default class ElementMenuItemButtonView extends ListItemButtonView {
|
|
12
|
-
/**
|
|
13
|
-
* The command this item reflects.
|
|
14
|
-
*/
|
|
15
|
-
command;
|
|
16
|
-
/**
|
|
17
|
-
* The position or element the item acts on, if any.
|
|
18
|
-
*/
|
|
19
|
-
target;
|
|
20
|
-
constructor(locale, command, { target } = {}) {
|
|
21
|
-
super(locale);
|
|
22
|
-
this.command = command;
|
|
23
|
-
this.target = target;
|
|
24
|
-
bindButtonToCommand(this, command, { withText: true, target });
|
|
25
|
-
// A toggleable button with a checkable role tells assistive technology whether it is "on" with `aria-checked`.
|
|
26
|
-
this.role = command.isToggleable ? 'menuitemcheckbox' : 'menuitem';
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=elementMenuItemButtonView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elementMenuItemButtonView.js","sourceRoot":"","sources":["../src/elementMenuItemButtonView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAe,MAAM,WAAW,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,OAAO,EAA0B,MAAM,+BAA+B,CAAC;AAEvE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,OAAO,yBAA0B,SAAQ,kBAAkB;IACxE;;OAEG;IACa,OAAO,CAA2B;IAElD;;OAEG;IACa,MAAM,CAAgC;IAEtD,YACC,MAA0B,EAC1B,OAAiC,EACjC,EAAE,MAAM,KAAqC,EAAE;QAE/C,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAErB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QAE/D,+GAA+G;QAC/G,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU,CAAC;IACpE,CAAC;CACD"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { DropdownMenuRootListView, type BodyCollection, type Locale } from 'ckeditor5';
|
|
2
|
-
import { type ElementMenuItem } from './elementMenu.js';
|
|
3
|
-
import { type ElementOrPosition } from './elementOrPositionCommand.js';
|
|
4
|
-
/**
|
|
5
|
-
* The menu of an element: CKEditor's dropdown menu (`DropdownMenuRootListView`), built from commands, submenus and
|
|
6
|
-
* separators.
|
|
7
|
-
*
|
|
8
|
-
* CKEditor builds the menu and handles it: the nested menus (opened on click, hover, or the right arrow; placed where
|
|
9
|
-
* they fit), the keyboard, and right-to-left languages. This view only connects the buttons to the commands: they
|
|
10
|
-
* reflect the command title, icon and {@link ElementOrPositionCommand#getState state} for the target, and execute the
|
|
11
|
-
* command for it. It also adds the separators, which CKEditor's menu definitions do not have.
|
|
12
|
-
*
|
|
13
|
-
* Submenus are enabled when one of their items is. Right-clicking the menu does not open the native context menu.
|
|
14
|
-
*/
|
|
15
|
-
export default class ElementMenuView extends DropdownMenuRootListView {
|
|
16
|
-
/**
|
|
17
|
-
* The element or position the commands are executed for.
|
|
18
|
-
*/
|
|
19
|
-
readonly target: ElementOrPosition;
|
|
20
|
-
private readonly _commands;
|
|
21
|
-
private readonly _submenus;
|
|
22
|
-
/**
|
|
23
|
-
* The positions of the separators in each list, by the id of the submenu (`''` for the menu itself).
|
|
24
|
-
*/
|
|
25
|
-
private readonly _separators;
|
|
26
|
-
constructor(locale: Locale, bodyCollection: BodyCollection, items: readonly (ElementMenuItem | null | undefined)[], target: ElementOrPosition);
|
|
27
|
-
/**
|
|
28
|
-
* Renders the menu: CKEditor builds it from the definitions; then the buttons are connected to the commands, and the
|
|
29
|
-
* separators are added.
|
|
30
|
-
*/
|
|
31
|
-
render(): void;
|
|
32
|
-
private _addSeparators;
|
|
33
|
-
private _isEnabled;
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=elementMenuView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elementMenuView.d.ts","sourceRoot":"","sources":["../src/elementMenuView.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,wBAAwB,EAExB,KAAK,cAAc,EAGnB,KAAK,MAAM,EACX,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,KAAK,eAAe,EAAuB,MAAM,kBAAkB,CAAC;AAE7E,OAAiC,EAAE,KAAK,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEjG;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,wBAAwB;IACpE;;OAEG;IACH,SAAgB,MAAM,EAAE,iBAAiB,CAAC;IAE1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAwC;IAClE,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA8B;IAExD;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAwB;gBAGnD,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,SAAS,CAAC,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,EACtD,MAAM,EAAE,iBAAiB;IAkB1B;;;OAGG;IACa,MAAM,IAAI,IAAI;IAqC9B,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,UAAU;CASlB"}
|
package/dist/elementMenuView.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { DropdownMenuRootListView, ListSeparatorView } from 'ckeditor5';
|
|
2
|
-
import {} from './elementMenu.js';
|
|
3
|
-
import { bindButtonToCommand } from './elementOrPositionButtonView.js';
|
|
4
|
-
import ElementOrPositionCommand, {} from './elementOrPositionCommand.js';
|
|
5
|
-
/**
|
|
6
|
-
* The menu of an element: CKEditor's dropdown menu (`DropdownMenuRootListView`), built from commands, submenus and
|
|
7
|
-
* separators.
|
|
8
|
-
*
|
|
9
|
-
* CKEditor builds the menu and handles it: the nested menus (opened on click, hover, or the right arrow; placed where
|
|
10
|
-
* they fit), the keyboard, and right-to-left languages. This view only connects the buttons to the commands: they
|
|
11
|
-
* reflect the command title, icon and {@link ElementOrPositionCommand#getState state} for the target, and execute the
|
|
12
|
-
* command for it. It also adds the separators, which CKEditor's menu definitions do not have.
|
|
13
|
-
*
|
|
14
|
-
* Submenus are enabled when one of their items is. Right-clicking the menu does not open the native context menu.
|
|
15
|
-
*/
|
|
16
|
-
export default class ElementMenuView extends DropdownMenuRootListView {
|
|
17
|
-
/**
|
|
18
|
-
* The element or position the commands are executed for.
|
|
19
|
-
*/
|
|
20
|
-
target;
|
|
21
|
-
_commands;
|
|
22
|
-
_submenus;
|
|
23
|
-
/**
|
|
24
|
-
* The positions of the separators in each list, by the id of the submenu (`''` for the menu itself).
|
|
25
|
-
*/
|
|
26
|
-
_separators;
|
|
27
|
-
constructor(locale, bodyCollection, items, target) {
|
|
28
|
-
const maps = { commands: new Map(), submenus: new Map(), separators: new Map() };
|
|
29
|
-
super(locale, bodyCollection, createDefinitions(items, '', maps));
|
|
30
|
-
this.target = target;
|
|
31
|
-
this._commands = maps.commands;
|
|
32
|
-
this._submenus = maps.submenus;
|
|
33
|
-
this._separators = maps.separators;
|
|
34
|
-
this.menuPanelClass = 'ck-elements-menu__panel';
|
|
35
|
-
this.extendTemplate({
|
|
36
|
-
attributes: { class: 'ck-elements-menu' },
|
|
37
|
-
on: { contextmenu: this.bindTemplate.to(preventDefault) }
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Renders the menu: CKEditor builds it from the definitions; then the buttons are connected to the commands, and the
|
|
42
|
-
* separators are added.
|
|
43
|
-
*/
|
|
44
|
-
render() {
|
|
45
|
-
super.render();
|
|
46
|
-
for (const button of this.buttons) {
|
|
47
|
-
const command = this._commands.get(button.id);
|
|
48
|
-
if (command) {
|
|
49
|
-
bindButtonToCommand(button, command, { withText: true, target: this.target });
|
|
50
|
-
// A toggleable button with a checkable role tells assistive technology whether it is "on" with `aria-checked`.
|
|
51
|
-
button.role = command.isToggleable ? 'menuitemcheckbox' : 'menuitem';
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
for (const menu of this.menus) {
|
|
55
|
-
const submenu = this._submenus.get(menu.id);
|
|
56
|
-
if (submenu) {
|
|
57
|
-
menu.buttonView.icon = submenu.icon;
|
|
58
|
-
menu.isEnabled = this._isEnabled(submenu);
|
|
59
|
-
}
|
|
60
|
-
// The panels of nested menus are not inside the menu.
|
|
61
|
-
if (menu.panelView.element) {
|
|
62
|
-
this.listenTo(menu.panelView.element, 'contextmenu', (evt, domEvent) => {
|
|
63
|
-
preventDefault(domEvent);
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
this._addSeparators('', this);
|
|
68
|
-
for (const menu of this.menus) {
|
|
69
|
-
this._addSeparators(menu.id, menu.listView);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
_addSeparators(id, list) {
|
|
73
|
-
for (const position of this._separators.get(id) ?? []) {
|
|
74
|
-
const separator = new ListSeparatorView(this.locale);
|
|
75
|
-
separator.extendTemplate({ attributes: { role: 'separator' } });
|
|
76
|
-
list.items.add(separator, position);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
_isEnabled(item) {
|
|
80
|
-
if (item === '|') {
|
|
81
|
-
return false;
|
|
82
|
-
}
|
|
83
|
-
return item instanceof ElementOrPositionCommand
|
|
84
|
-
? item.getState(this.target).isEnabled
|
|
85
|
-
: item.items.some(child => !!child && this._isEnabled(child));
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Creates CKEditor's menu definitions for the items. The ids are paths of positions (e.g. `'2.0'`). Collects the
|
|
90
|
-
* commands and submenus by id, and the positions of the separators by the id of their submenu.
|
|
91
|
-
*/
|
|
92
|
-
function createDefinitions(items, parentId, maps) {
|
|
93
|
-
const definitions = [];
|
|
94
|
-
let position = 0;
|
|
95
|
-
for (const item of items) {
|
|
96
|
-
const id = parentId ? `${parentId}.${String(position)}` : String(position);
|
|
97
|
-
if (!item) {
|
|
98
|
-
continue;
|
|
99
|
-
}
|
|
100
|
-
if (item === '|') {
|
|
101
|
-
maps.separators.set(parentId, [...(maps.separators.get(parentId) ?? []), position]);
|
|
102
|
-
}
|
|
103
|
-
else if (item instanceof ElementOrPositionCommand) {
|
|
104
|
-
maps.commands.set(id, item);
|
|
105
|
-
definitions.push({ id, label: item.title });
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
maps.submenus.set(id, item);
|
|
109
|
-
definitions.push({ id, menu: item.title, children: createDefinitions(item.items, id, maps) });
|
|
110
|
-
}
|
|
111
|
-
position++;
|
|
112
|
-
}
|
|
113
|
-
return definitions;
|
|
114
|
-
}
|
|
115
|
-
function preventDefault(domEvent) {
|
|
116
|
-
domEvent.preventDefault();
|
|
117
|
-
}
|
|
118
|
-
//# sourceMappingURL=elementMenuView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elementMenuView.js","sourceRoot":"","sources":["../src/elementMenuView.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,wBAAwB,EACxB,iBAAiB,EAKjB,MAAM,WAAW,CAAC;AACnB,OAAO,EAA6C,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,wBAAwB,EAAE,EAA0B,MAAM,+BAA+B,CAAC;AAEjG;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,wBAAwB;IACpE;;OAEG;IACa,MAAM,CAAoB;IAEzB,SAAS,CAAwC;IACjD,SAAS,CAA8B;IAExD;;OAEG;IACc,WAAW,CAAwB;IAEpD,YACC,MAAc,EACd,cAA8B,EAC9B,KAAsD,EACtD,MAAyB;QAEzB,MAAM,IAAI,GAAmB,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;QAEjG,KAAK,CAAC,MAAM,EAAE,cAAc,EAAE,iBAAiB,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QAElE,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC/B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAC;QACnC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@
|
|
|
1
|
-
import { ListSeparatorView, type Locale } from 'ckeditor5';
|
|
2
|
-
/**
|
|
3
|
-
* A line between groups of menu items: CKEditor's list separator, with the `separator` role.
|
|
4
|
-
*/
|
|
5
|
-
export default class MenuSeparatorView extends ListSeparatorView {
|
|
6
|
-
constructor(locale?: Locale);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=menuSeparatorView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menuSeparatorView.d.ts","sourceRoot":"","sources":["../src/menuSeparatorView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,iBAAiB;gBACnD,MAAM,CAAC,EAAE,MAAM;CAU3B"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ListSeparatorView } from 'ckeditor5';
|
|
2
|
-
/**
|
|
3
|
-
* A line between groups of menu items: CKEditor's list separator, with the `separator` role.
|
|
4
|
-
*/
|
|
5
|
-
export default class MenuSeparatorView extends ListSeparatorView {
|
|
6
|
-
constructor(locale) {
|
|
7
|
-
super(locale);
|
|
8
|
-
this.extendTemplate({
|
|
9
|
-
attributes: {
|
|
10
|
-
class: 'ck-elements-menu__separator',
|
|
11
|
-
role: 'separator'
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=menuSeparatorView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"menuSeparatorView.js","sourceRoot":"","sources":["../src/menuSeparatorView.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAe,MAAM,WAAW,CAAC;AAE3D;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,iBAAiB;IAC/D,YAAY,MAAe;QAC1B,KAAK,CAAC,MAAM,CAAC,CAAC;QAEd,IAAI,CAAC,cAAc,CAAC;YACnB,UAAU,EAAE;gBACX,KAAK,EAAE,6BAA6B;gBACpC,IAAI,EAAE,WAAW;aACjB;SACD,CAAC,CAAC;IACJ,CAAC;CACD"}
|
package/dist/submenuView.d.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { DropdownMenuButtonView, DropdownMenuNestedMenuPanelView, KeystrokeHandler, View, type BodyCollection, type Locale } from 'ckeditor5';
|
|
2
|
-
import ElementMenuView, { type ElementMenuViewItem } from './elementMenuView.js';
|
|
3
|
-
/**
|
|
4
|
-
* A menu item that opens a nested menu next to it, built of CKEditor's nested menu parts: a
|
|
5
|
-
* `DropdownMenuButtonView` (with an arrow, `aria-haspopup` and `aria-expanded`) and a `DropdownMenuNestedMenuPanelView`.
|
|
6
|
-
*
|
|
7
|
-
* The panel is added to the editor's body collection while the nested menu is open, so it is not clipped by the menu.
|
|
8
|
-
* It is placed next to the item, on the side where it fits (in right-to-left languages, preferably on the left).
|
|
9
|
-
*
|
|
10
|
-
* Clicking the item, hovering it, or pressing the right arrow (left in right-to-left languages) opens the nested menu;
|
|
11
|
-
* the opposite arrow or Esc closes it. When one of the nested items fires `execute`, the submenu fires `execute` too,
|
|
12
|
-
* so the whole menu can close.
|
|
13
|
-
*/
|
|
14
|
-
export default class SubmenuView extends View {
|
|
15
|
-
/**
|
|
16
|
-
* The item that opens the nested menu.
|
|
17
|
-
*/
|
|
18
|
-
readonly buttonView: DropdownMenuButtonView;
|
|
19
|
-
/**
|
|
20
|
-
* The panel of the nested menu.
|
|
21
|
-
*/
|
|
22
|
-
readonly panelView: DropdownMenuNestedMenuPanelView;
|
|
23
|
-
/**
|
|
24
|
-
* The nested menu, in the {@link panelView}.
|
|
25
|
-
*/
|
|
26
|
-
readonly listView: ElementMenuView;
|
|
27
|
-
/**
|
|
28
|
-
* Handles the keystrokes within the submenu and its panel.
|
|
29
|
-
*/
|
|
30
|
-
readonly keystrokes: KeystrokeHandler;
|
|
31
|
-
/**
|
|
32
|
-
* Whether the nested menu is open.
|
|
33
|
-
*
|
|
34
|
-
* @observable
|
|
35
|
-
*/
|
|
36
|
-
isOpen: boolean;
|
|
37
|
-
private readonly _bodyCollection;
|
|
38
|
-
constructor(locale: Locale, bodyCollection: BodyCollection, label: string, items: ElementMenuViewItem[], { icon }?: {
|
|
39
|
-
icon?: string;
|
|
40
|
-
});
|
|
41
|
-
/**
|
|
42
|
-
* Renders the submenu and its panel, and sets up the keystrokes that open and close the nested menu.
|
|
43
|
-
*/
|
|
44
|
-
render(): void;
|
|
45
|
-
/**
|
|
46
|
-
* Opens the nested menu and focuses its first item.
|
|
47
|
-
*/
|
|
48
|
-
open(): void;
|
|
49
|
-
/**
|
|
50
|
-
* Closes the nested menu and focuses the item that opens it.
|
|
51
|
-
*/
|
|
52
|
-
close(): void;
|
|
53
|
-
/**
|
|
54
|
-
* Focuses the item that opens the nested menu.
|
|
55
|
-
*/
|
|
56
|
-
focus(): void;
|
|
57
|
-
/**
|
|
58
|
-
* Destroys the submenu, its panel and keystroke handler.
|
|
59
|
-
*/
|
|
60
|
-
destroy(): void;
|
|
61
|
-
/**
|
|
62
|
-
* The positions of the panel, in the order they are tried: as in CKEditor's nested dropdown menus.
|
|
63
|
-
*/
|
|
64
|
-
private get _panelPositions();
|
|
65
|
-
private _addPanelToBody;
|
|
66
|
-
private _removePanelFromBody;
|
|
67
|
-
}
|
|
68
|
-
//# sourceMappingURL=submenuView.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"submenuView.d.ts","sourceRoot":"","sources":["../src/submenuView.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,sBAAsB,EACtB,+BAA+B,EAE/B,gBAAgB,EAChB,IAAI,EACJ,KAAK,cAAc,EACnB,KAAK,MAAM,EAEX,MAAM,WAAW,CAAC;AACnB,OAAO,eAAe,EAAE,EAAE,KAAK,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEjF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,IAAI;IAC5C;;OAEG;IACH,SAAgB,UAAU,EAAE,sBAAsB,CAAC;IAEnD;;OAEG;IACH,SAAgB,SAAS,EAAE,+BAA+B,CAAC;IAE3D;;OAEG;IACH,SAAgB,QAAQ,EAAE,eAAe,CAAC;IAE1C;;OAEG;IACH,SAAgB,UAAU,mBAA0B;IAEpD;;;;OAIG;IACY,MAAM,EAAE,OAAO,CAAC;IAE/B,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;gBAGhD,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,EAC9B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,mBAAmB,EAAE,EAC5B,EAAE,IAAI,EAAE,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO;IAkDjC;;OAEG;IACa,MAAM,IAAI,IAAI;IA4B9B;;OAEG;IACI,IAAI,IAAI,IAAI;IAKnB;;OAEG;IACI,KAAK,IAAI,IAAI;IAKpB;;OAEG;IACI,KAAK,IAAI,IAAI;IAIpB;;OAEG;IACa,OAAO,IAAI,IAAI;IAO/B;;OAEG;IACH,OAAO,KAAK,eAAe,GAM1B;IAED,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,oBAAoB;CAS5B"}
|