@ckeditor/ckeditor5-ui 36.0.1 → 37.0.0-alpha.1
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/package.json +24 -23
- package/src/augmentation.d.ts +86 -0
- package/src/augmentation.js +5 -0
- package/src/bindings/addkeyboardhandlingforgrid.d.ts +27 -0
- package/src/bindings/addkeyboardhandlingforgrid.js +42 -34
- package/src/bindings/clickoutsidehandler.d.ts +28 -0
- package/src/bindings/clickoutsidehandler.js +5 -6
- package/src/bindings/csstransitiondisablermixin.d.ts +40 -0
- package/src/bindings/csstransitiondisablermixin.js +55 -0
- package/src/bindings/injectcsstransitiondisabler.d.ts +59 -0
- package/src/bindings/injectcsstransitiondisabler.js +23 -20
- package/src/bindings/preventdefault.d.ts +33 -0
- package/src/bindings/preventdefault.js +13 -15
- package/src/bindings/submithandler.d.ts +57 -0
- package/src/bindings/submithandler.js +23 -24
- package/src/button/button.d.ts +154 -0
- package/src/button/buttonview.d.ts +155 -0
- package/src/button/buttonview.js +16 -60
- package/src/button/switchbuttonview.d.ts +45 -0
- package/src/button/switchbuttonview.js +9 -18
- package/src/colorgrid/colorgridview.d.ts +132 -0
- package/src/colorgrid/colorgridview.js +13 -44
- package/src/colorgrid/colortileview.d.ts +28 -0
- package/src/colorgrid/colortileview.js +2 -15
- package/src/colorgrid/utils.d.ts +47 -0
- package/src/colorgrid/utils.js +7 -13
- package/src/componentfactory.d.ts +81 -0
- package/src/componentfactory.js +22 -36
- package/src/dropdown/button/dropdownbutton.d.ts +25 -0
- package/src/dropdown/button/dropdownbuttonview.d.ts +48 -0
- package/src/dropdown/button/dropdownbuttonview.js +11 -21
- package/src/dropdown/button/splitbuttonview.d.ts +145 -0
- package/src/dropdown/button/splitbuttonview.js +11 -52
- package/src/dropdown/dropdownpanelfocusable.d.ts +21 -0
- package/src/dropdown/dropdownpanelview.d.ts +62 -0
- package/src/dropdown/dropdownpanelview.js +2 -30
- package/src/dropdown/dropdownview.d.ts +315 -0
- package/src/dropdown/dropdownview.js +121 -222
- package/src/dropdown/utils.d.ts +219 -0
- package/src/dropdown/utils.js +112 -106
- package/src/editableui/editableuiview.d.ts +72 -0
- package/src/editableui/editableuiview.js +16 -44
- package/src/editableui/inline/inlineeditableuiview.d.ts +40 -0
- package/src/editableui/inline/inlineeditableuiview.js +5 -15
- package/src/editorui/bodycollection.d.ts +51 -0
- package/src/editorui/bodycollection.js +2 -16
- package/src/editorui/boxed/boxededitoruiview.d.ts +40 -0
- package/src/editorui/boxed/boxededitoruiview.js +1 -27
- package/src/editorui/editorui.d.ts +263 -0
- package/src/editorui/editorui.js +27 -134
- package/src/editorui/editoruiview.d.ts +39 -0
- package/src/editorui/editoruiview.js +1 -10
- package/src/focuscycler.d.ts +183 -0
- package/src/focuscycler.js +34 -90
- package/src/formheader/formheaderview.d.ts +53 -0
- package/src/formheader/formheaderview.js +3 -24
- package/src/icon/iconview.d.ts +78 -0
- package/src/icon/iconview.js +0 -50
- package/src/iframe/iframeview.d.ts +50 -0
- package/src/iframe/iframeview.js +2 -2
- package/src/index.d.ts +55 -0
- package/src/index.js +2 -0
- package/src/input/inputview.d.ts +121 -0
- package/src/input/inputview.js +0 -82
- package/src/inputnumber/inputnumberview.d.ts +49 -0
- package/src/inputnumber/inputnumberview.js +5 -28
- package/src/inputtext/inputtextview.d.ts +18 -0
- package/src/inputtext/inputtextview.js +0 -2
- package/src/label/labelview.d.ts +36 -0
- package/src/label/labelview.js +0 -20
- package/src/labeledfield/labeledfieldview.d.ts +182 -0
- package/src/labeledfield/labeledfieldview.js +20 -126
- package/src/labeledfield/utils.d.ts +93 -0
- package/src/labeledfield/utils.js +24 -18
- package/src/labeledinput/labeledinputview.d.ts +125 -0
- package/src/labeledinput/labeledinputview.js +7 -90
- package/src/list/listitemview.d.ts +35 -0
- package/src/list/listitemview.js +0 -16
- package/src/list/listseparatorview.d.ts +18 -0
- package/src/list/listseparatorview.js +0 -2
- package/src/list/listview.d.ts +59 -0
- package/src/list/listview.js +0 -33
- package/src/model.d.ts +22 -0
- package/src/model.js +2 -4
- package/src/notification/notification.d.ts +211 -0
- package/src/notification/notification.js +64 -51
- package/src/panel/balloon/balloonpanelview.d.ts +685 -0
- package/src/panel/balloon/balloonpanelview.js +146 -168
- package/src/panel/balloon/contextualballoon.d.ts +299 -0
- package/src/panel/balloon/contextualballoon.js +42 -172
- package/src/panel/sticky/stickypanelview.d.ts +132 -0
- package/src/panel/sticky/stickypanelview.js +0 -115
- package/src/template.d.ts +942 -0
- package/src/template.js +397 -461
- package/src/toolbar/balloon/balloontoolbar.d.ts +118 -0
- package/src/toolbar/balloon/balloontoolbar.js +14 -81
- package/src/toolbar/block/blockbuttonview.d.ts +35 -0
- package/src/toolbar/block/blockbuttonview.js +1 -13
- package/src/toolbar/block/blocktoolbar.d.ts +153 -0
- package/src/toolbar/block/blocktoolbar.js +31 -69
- package/src/toolbar/normalizetoolbarconfig.d.ts +39 -0
- package/src/toolbar/normalizetoolbarconfig.js +12 -8
- package/src/toolbar/toolbarlinebreakview.d.ts +18 -0
- package/src/toolbar/toolbarlinebreakview.js +0 -2
- package/src/toolbar/toolbarseparatorview.d.ts +18 -0
- package/src/toolbar/toolbarseparatorview.js +0 -2
- package/src/toolbar/toolbarview.d.ts +265 -0
- package/src/toolbar/toolbarview.js +54 -305
- package/src/tooltipmanager.d.ts +180 -0
- package/src/tooltipmanager.js +48 -95
- package/src/view.d.ts +422 -0
- package/src/view.js +182 -251
- package/src/viewcollection.d.ts +139 -0
- package/src/viewcollection.js +62 -56
|
@@ -28,33 +28,39 @@ const { pilcrow } = icons;
|
|
|
28
28
|
* By default, the button is attached so its right boundary is touching the
|
|
29
29
|
* {@link module:engine/view/editableelement~EditableElement}:
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
31
|
+
* ```
|
|
32
|
+
* __ |
|
|
33
|
+
* | || This is a block of content that the
|
|
34
|
+
* ¯¯ | button is attached to. This is a
|
|
35
|
+
* | block of content that the button is
|
|
36
|
+
* | attached to.
|
|
37
|
+
* ```
|
|
36
38
|
*
|
|
37
39
|
* The position of the button can be adjusted using the CSS `transform` property:
|
|
38
40
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
41
|
+
* ```css
|
|
42
|
+
* .ck-block-toolbar-button {
|
|
43
|
+
* transform: translateX( -10px );
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
42
46
|
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
47
|
+
* ```
|
|
48
|
+
* __ |
|
|
49
|
+
* | | | This is a block of content that the
|
|
50
|
+
* ¯¯ | button is attached to. This is a
|
|
51
|
+
* | block of content that the button is
|
|
52
|
+
* | attached to.
|
|
53
|
+
* ```
|
|
48
54
|
*
|
|
49
55
|
* **Note**: If you plan to run the editor in a right–to–left (RTL) language, keep in mind the button
|
|
50
56
|
* will be attached to the **right** boundary of the editable area. In that case, make sure the
|
|
51
57
|
* CSS position adjustment works properly by adding the following styles:
|
|
52
58
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
59
|
+
* ```css
|
|
60
|
+
* .ck[dir="rtl"] .ck-block-toolbar-button {
|
|
61
|
+
* transform: translateX( 10px );
|
|
62
|
+
* }
|
|
63
|
+
* ```
|
|
58
64
|
*/
|
|
59
65
|
export default class BlockToolbar extends Plugin {
|
|
60
66
|
/**
|
|
@@ -68,31 +74,6 @@ export default class BlockToolbar extends Plugin {
|
|
|
68
74
|
*/
|
|
69
75
|
constructor(editor) {
|
|
70
76
|
super(editor);
|
|
71
|
-
/**
|
|
72
|
-
* A cached and normalized `config.blockToolbar` object.
|
|
73
|
-
*
|
|
74
|
-
* @type {module:core/editor/editorconfig~EditorConfig#blockToolbar}
|
|
75
|
-
* @private
|
|
76
|
-
*/
|
|
77
|
-
this._blockToolbarConfig = normalizeToolbarConfig(this.editor.config.get('blockToolbar'));
|
|
78
|
-
/**
|
|
79
|
-
* The toolbar view.
|
|
80
|
-
*
|
|
81
|
-
* @type {module:ui/toolbar/toolbarview~ToolbarView}
|
|
82
|
-
*/
|
|
83
|
-
this.toolbarView = this._createToolbarView();
|
|
84
|
-
/**
|
|
85
|
-
* The balloon panel view, containing the {@link #toolbarView}.
|
|
86
|
-
*
|
|
87
|
-
* @type {module:ui/panel/balloon/balloonpanelview~BalloonPanelView}
|
|
88
|
-
*/
|
|
89
|
-
this.panelView = this._createPanelView();
|
|
90
|
-
/**
|
|
91
|
-
* The button view that opens the {@link #toolbarView}.
|
|
92
|
-
*
|
|
93
|
-
* @type {module:ui/toolbar/block/blockbuttonview~BlockButtonView}
|
|
94
|
-
*/
|
|
95
|
-
this.buttonView = this._createButtonView();
|
|
96
77
|
/**
|
|
97
78
|
* An instance of the resize observer that allows to respond to changes in editable's geometry
|
|
98
79
|
* so the toolbar can stay within its boundaries (and group toolbar items that do not fit).
|
|
@@ -101,11 +82,12 @@ export default class BlockToolbar extends Plugin {
|
|
|
101
82
|
* {@link module:core/editor/editorconfig~EditorConfig#blockToolbar configuration}.
|
|
102
83
|
*
|
|
103
84
|
* **Note:** Created in {@link #afterInit}.
|
|
104
|
-
*
|
|
105
|
-
* @protected
|
|
106
|
-
* @member {module:utils/dom/resizeobserver~ResizeObserver}
|
|
107
85
|
*/
|
|
108
86
|
this._resizeObserver = null;
|
|
87
|
+
this._blockToolbarConfig = normalizeToolbarConfig(this.editor.config.get('blockToolbar'));
|
|
88
|
+
this.toolbarView = this._createToolbarView();
|
|
89
|
+
this.panelView = this._createPanelView();
|
|
90
|
+
this.buttonView = this._createButtonView();
|
|
109
91
|
// Close the #panelView upon clicking outside of the plugin UI.
|
|
110
92
|
clickOutsideHandler({
|
|
111
93
|
emitter: this.panelView,
|
|
@@ -152,8 +134,6 @@ export default class BlockToolbar extends Plugin {
|
|
|
152
134
|
* Fills the toolbar with its items based on the configuration.
|
|
153
135
|
*
|
|
154
136
|
* **Note:** This needs to be done after all plugins are ready.
|
|
155
|
-
*
|
|
156
|
-
* @inheritDoc
|
|
157
137
|
*/
|
|
158
138
|
afterInit() {
|
|
159
139
|
const factory = this.editor.ui.componentFactory;
|
|
@@ -188,9 +168,6 @@ export default class BlockToolbar extends Plugin {
|
|
|
188
168
|
}
|
|
189
169
|
/**
|
|
190
170
|
* Creates the {@link #toolbarView}.
|
|
191
|
-
*
|
|
192
|
-
* @private
|
|
193
|
-
* @returns {module:ui/toolbar/toolbarview~ToolbarView}
|
|
194
171
|
*/
|
|
195
172
|
_createToolbarView() {
|
|
196
173
|
const t = this.editor.locale.t;
|
|
@@ -210,9 +187,6 @@ export default class BlockToolbar extends Plugin {
|
|
|
210
187
|
}
|
|
211
188
|
/**
|
|
212
189
|
* Creates the {@link #panelView}.
|
|
213
|
-
*
|
|
214
|
-
* @private
|
|
215
|
-
* @returns {module:ui/panel/balloon/balloonpanelview~BalloonPanelView}
|
|
216
190
|
*/
|
|
217
191
|
_createPanelView() {
|
|
218
192
|
const editor = this.editor;
|
|
@@ -230,9 +204,6 @@ export default class BlockToolbar extends Plugin {
|
|
|
230
204
|
}
|
|
231
205
|
/**
|
|
232
206
|
* Creates the {@link #buttonView}.
|
|
233
|
-
*
|
|
234
|
-
* @private
|
|
235
|
-
* @returns {module:ui/toolbar/block/blockbuttonview~BlockButtonView}
|
|
236
207
|
*/
|
|
237
208
|
_createButtonView() {
|
|
238
209
|
const editor = this.editor;
|
|
@@ -278,8 +249,6 @@ export default class BlockToolbar extends Plugin {
|
|
|
278
249
|
/**
|
|
279
250
|
* Shows or hides the button.
|
|
280
251
|
* When all the conditions for displaying the button are matched, it shows the button. Hides otherwise.
|
|
281
|
-
*
|
|
282
|
-
* @private
|
|
283
252
|
*/
|
|
284
253
|
_updateButton() {
|
|
285
254
|
const editor = this.editor;
|
|
@@ -315,8 +284,6 @@ export default class BlockToolbar extends Plugin {
|
|
|
315
284
|
}
|
|
316
285
|
/**
|
|
317
286
|
* Hides the button.
|
|
318
|
-
*
|
|
319
|
-
* @private
|
|
320
287
|
*/
|
|
321
288
|
_hideButton() {
|
|
322
289
|
this.buttonView.isVisible = false;
|
|
@@ -324,8 +291,6 @@ export default class BlockToolbar extends Plugin {
|
|
|
324
291
|
/**
|
|
325
292
|
* Shows the {@link #toolbarView} attached to the {@link #buttonView}.
|
|
326
293
|
* If the toolbar is already visible, then it simply repositions it.
|
|
327
|
-
*
|
|
328
|
-
* @private
|
|
329
294
|
*/
|
|
330
295
|
_showPanel() {
|
|
331
296
|
// Usually, the only way to show the toolbar is by pressing the block button. It makes it impossible for
|
|
@@ -372,8 +337,7 @@ export default class BlockToolbar extends Plugin {
|
|
|
372
337
|
/**
|
|
373
338
|
* Hides the {@link #toolbarView}.
|
|
374
339
|
*
|
|
375
|
-
* @
|
|
376
|
-
* @param {Boolean} [focusEditable=false] When `true`, the editable will be focused after hiding the panel.
|
|
340
|
+
* @param focusEditable When `true`, the editable will be focused after hiding the panel.
|
|
377
341
|
*/
|
|
378
342
|
_hidePanel(focusEditable) {
|
|
379
343
|
this.panelView.isVisible = false;
|
|
@@ -384,8 +348,7 @@ export default class BlockToolbar extends Plugin {
|
|
|
384
348
|
/**
|
|
385
349
|
* Attaches the {@link #buttonView} to the target block of content.
|
|
386
350
|
*
|
|
387
|
-
* @
|
|
388
|
-
* @param {HTMLElement} targetElement Target element.
|
|
351
|
+
* @param targetElement Target element.
|
|
389
352
|
*/
|
|
390
353
|
_attachButtonToElement(targetElement) {
|
|
391
354
|
const contentStyles = window.getComputedStyle(targetElement);
|
|
@@ -420,8 +383,7 @@ export default class BlockToolbar extends Plugin {
|
|
|
420
383
|
* Gets the {@link #toolbarView} max-width, based on
|
|
421
384
|
* editable width plus distance between farthest edge of the {@link #buttonView} and the editable.
|
|
422
385
|
*
|
|
423
|
-
* @
|
|
424
|
-
* @returns {String} maxWidth A maximum width that toolbar can have, in pixels.
|
|
386
|
+
* @returns A maximum width that toolbar can have, in pixels.
|
|
425
387
|
*/
|
|
426
388
|
_getToolbarMaxWidth() {
|
|
427
389
|
const editableElement = this.editor.ui.view.editable.element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import type { ToolbarConfig, ToolbarConfigItem } from '@ckeditor/ckeditor5-core';
|
|
6
|
+
/**
|
|
7
|
+
* @module ui/toolbar/normalizetoolbarconfig
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Normalizes the toolbar configuration (`config.toolbar`), which:
|
|
11
|
+
*
|
|
12
|
+
* * may be defined as an `Array`:
|
|
13
|
+
*
|
|
14
|
+
* ```
|
|
15
|
+
* toolbar: [ 'heading', 'bold', 'italic', 'link', ... ]
|
|
16
|
+
* ```
|
|
17
|
+
*
|
|
18
|
+
* * or an `Object`:
|
|
19
|
+
*
|
|
20
|
+
* ```
|
|
21
|
+
* toolbar: {
|
|
22
|
+
* items: [ 'heading', 'bold', 'italic', 'link', ... ],
|
|
23
|
+
* removeItems: [ 'bold' ],
|
|
24
|
+
* ...
|
|
25
|
+
* }
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* * or may not be defined at all (`undefined`)
|
|
29
|
+
*
|
|
30
|
+
* and returns it in the object form.
|
|
31
|
+
*
|
|
32
|
+
* @param config The value of `config.toolbar`.
|
|
33
|
+
* @returns A normalized toolbar config object.
|
|
34
|
+
*/
|
|
35
|
+
export default function normalizeToolbarConfig(config: ToolbarConfig | undefined): {
|
|
36
|
+
items: Array<ToolbarConfigItem>;
|
|
37
|
+
removeItems: Array<string>;
|
|
38
|
+
shouldNotGroupWhenFull?: boolean;
|
|
39
|
+
};
|
|
@@ -10,22 +10,26 @@
|
|
|
10
10
|
*
|
|
11
11
|
* * may be defined as an `Array`:
|
|
12
12
|
*
|
|
13
|
-
*
|
|
13
|
+
* ```
|
|
14
|
+
* toolbar: [ 'heading', 'bold', 'italic', 'link', ... ]
|
|
15
|
+
* ```
|
|
14
16
|
*
|
|
15
17
|
* * or an `Object`:
|
|
16
18
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
19
|
+
* ```
|
|
20
|
+
* toolbar: {
|
|
21
|
+
* items: [ 'heading', 'bold', 'italic', 'link', ... ],
|
|
22
|
+
* removeItems: [ 'bold' ],
|
|
23
|
+
* ...
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
22
26
|
*
|
|
23
27
|
* * or may not be defined at all (`undefined`)
|
|
24
28
|
*
|
|
25
29
|
* and returns it in the object form.
|
|
26
30
|
*
|
|
27
|
-
* @param
|
|
28
|
-
* @returns
|
|
31
|
+
* @param config The value of `config.toolbar`.
|
|
32
|
+
* @returns A normalized toolbar config object.
|
|
29
33
|
*/
|
|
30
34
|
export default function normalizeToolbarConfig(config) {
|
|
31
35
|
if (Array.isArray(config)) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/toolbar/toolbarlinebreakview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view';
|
|
9
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
/**
|
|
11
|
+
* The toolbar line break view class.
|
|
12
|
+
*/
|
|
13
|
+
export default class ToolbarLineBreakView extends View {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
constructor(locale?: Locale);
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/toolbar/toolbarseparatorview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view';
|
|
9
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
|
+
/**
|
|
11
|
+
* The toolbar separator view class.
|
|
12
|
+
*/
|
|
13
|
+
export default class ToolbarSeparatorView extends View {
|
|
14
|
+
/**
|
|
15
|
+
* @inheritDoc
|
|
16
|
+
*/
|
|
17
|
+
constructor(locale?: Locale);
|
|
18
|
+
}
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/toolbar/toolbarview
|
|
7
|
+
*/
|
|
8
|
+
import View from '../view';
|
|
9
|
+
import type ComponentFactory from '../componentfactory';
|
|
10
|
+
import type ViewCollection from '../viewcollection';
|
|
11
|
+
import type DropdownPanelFocusable from '../dropdown/dropdownpanelfocusable';
|
|
12
|
+
import { FocusTracker, KeystrokeHandler, type Locale } from '@ckeditor/ckeditor5-utils';
|
|
13
|
+
import { type ToolbarConfig } from '@ckeditor/ckeditor5-core';
|
|
14
|
+
import '../../theme/components/toolbar/toolbar.css';
|
|
15
|
+
/**
|
|
16
|
+
* The toolbar view class.
|
|
17
|
+
*/
|
|
18
|
+
export default class ToolbarView extends View implements DropdownPanelFocusable {
|
|
19
|
+
/**
|
|
20
|
+
* A reference to the options object passed to the constructor.
|
|
21
|
+
*/
|
|
22
|
+
readonly options: ToolbarOptions;
|
|
23
|
+
/**
|
|
24
|
+
* A collection of toolbar items (buttons, dropdowns, etc.).
|
|
25
|
+
*/
|
|
26
|
+
readonly items: ViewCollection;
|
|
27
|
+
/**
|
|
28
|
+
* Tracks information about the DOM focus in the toolbar.
|
|
29
|
+
*/
|
|
30
|
+
readonly focusTracker: FocusTracker;
|
|
31
|
+
/**
|
|
32
|
+
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}
|
|
33
|
+
* to handle keyboard navigation in the toolbar.
|
|
34
|
+
*/
|
|
35
|
+
readonly keystrokes: KeystrokeHandler;
|
|
36
|
+
/**
|
|
37
|
+
* A (child) view containing {@link #items toolbar items}.
|
|
38
|
+
*/
|
|
39
|
+
readonly itemsView: ItemsView;
|
|
40
|
+
/**
|
|
41
|
+
* A top–level collection aggregating building blocks of the toolbar.
|
|
42
|
+
*
|
|
43
|
+
* ┌───────────────── ToolbarView ─────────────────┐
|
|
44
|
+
* | ┌──────────────── #children ────────────────┐ |
|
|
45
|
+
* | | ┌──────────── #itemsView ───────────┐ | |
|
|
46
|
+
* | | | [ item1 ] [ item2 ] ... [ itemN ] | | |
|
|
47
|
+
* | | └──────────────────────────────────-┘ | |
|
|
48
|
+
* | └───────────────────────────────────────────┘ |
|
|
49
|
+
* └───────────────────────────────────────────────┘
|
|
50
|
+
*
|
|
51
|
+
* By default, it contains the {@link #itemsView} but it can be extended with additional
|
|
52
|
+
* UI elements when necessary.
|
|
53
|
+
*/
|
|
54
|
+
readonly children: ViewCollection;
|
|
55
|
+
/**
|
|
56
|
+
* A collection of {@link #items} that take part in the focus cycling
|
|
57
|
+
* (i.e. navigation using the keyboard). Usually, it contains a subset of {@link #items} with
|
|
58
|
+
* some optional UI elements that also belong to the toolbar and should be focusable
|
|
59
|
+
* by the user.
|
|
60
|
+
*/
|
|
61
|
+
readonly focusables: ViewCollection;
|
|
62
|
+
locale: Locale;
|
|
63
|
+
/**
|
|
64
|
+
* Label used by assistive technologies to describe this toolbar element.
|
|
65
|
+
*
|
|
66
|
+
* @observable
|
|
67
|
+
* @default 'Editor toolbar'
|
|
68
|
+
*/
|
|
69
|
+
ariaLabel: string;
|
|
70
|
+
/**
|
|
71
|
+
* The maximum width of the toolbar element.
|
|
72
|
+
*
|
|
73
|
+
* **Note**: When set to a specific value (e.g. `'200px'`), the value will affect the behavior of the
|
|
74
|
+
* {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull}
|
|
75
|
+
* option by changing the number of {@link #items} that will be displayed in the toolbar at a time.
|
|
76
|
+
*
|
|
77
|
+
* @observable
|
|
78
|
+
* @default 'auto'
|
|
79
|
+
*/
|
|
80
|
+
maxWidth: string;
|
|
81
|
+
/**
|
|
82
|
+
* An additional CSS class added to the {@link #element}.
|
|
83
|
+
*
|
|
84
|
+
* @observable
|
|
85
|
+
* @member {String} #class
|
|
86
|
+
*/
|
|
87
|
+
class: string | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* When set true, makes the toolbar look compact with {@link #element}.
|
|
90
|
+
*
|
|
91
|
+
* @observable
|
|
92
|
+
* @default false
|
|
93
|
+
*/
|
|
94
|
+
isCompact: boolean;
|
|
95
|
+
/**
|
|
96
|
+
* Controls the orientation of toolbar items. Only available when
|
|
97
|
+
* {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull dynamic items grouping}
|
|
98
|
+
* is **disabled**.
|
|
99
|
+
*
|
|
100
|
+
* @observable
|
|
101
|
+
*/
|
|
102
|
+
isVertical: boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Helps cycling over {@link #focusables focusable items} in the toolbar.
|
|
105
|
+
*/
|
|
106
|
+
private readonly _focusCycler;
|
|
107
|
+
/**
|
|
108
|
+
* An instance of the active toolbar behavior that shapes its look and functionality.
|
|
109
|
+
*
|
|
110
|
+
* See {@link module:ui/toolbar/toolbarview~ToolbarBehavior} to learn more.
|
|
111
|
+
*/
|
|
112
|
+
private readonly _behavior;
|
|
113
|
+
/**
|
|
114
|
+
* Creates an instance of the {@link module:ui/toolbar/toolbarview~ToolbarView} class.
|
|
115
|
+
*
|
|
116
|
+
* Also see {@link #render}.
|
|
117
|
+
*
|
|
118
|
+
* @param locale The localization services instance.
|
|
119
|
+
* @param options Configuration options of the toolbar.
|
|
120
|
+
*/
|
|
121
|
+
constructor(locale: Locale, options?: ToolbarOptions);
|
|
122
|
+
/**
|
|
123
|
+
* @inheritDoc
|
|
124
|
+
*/
|
|
125
|
+
render(): void;
|
|
126
|
+
/**
|
|
127
|
+
* @inheritDoc
|
|
128
|
+
*/
|
|
129
|
+
destroy(): void;
|
|
130
|
+
/**
|
|
131
|
+
* Focuses the first focusable in {@link #focusables}.
|
|
132
|
+
*/
|
|
133
|
+
focus(): void;
|
|
134
|
+
/**
|
|
135
|
+
* Focuses the last focusable in {@link #focusables}.
|
|
136
|
+
*/
|
|
137
|
+
focusLast(): void;
|
|
138
|
+
/**
|
|
139
|
+
* A utility that expands the plain toolbar configuration into
|
|
140
|
+
* {@link module:ui/toolbar/toolbarview~ToolbarView#items} using a given component factory.
|
|
141
|
+
*
|
|
142
|
+
* @param itemsOrConfig The toolbar items or the entire toolbar configuration object.
|
|
143
|
+
* @param factory A factory producing toolbar items.
|
|
144
|
+
* @param removeItems An array of items names to be removed from the configuration. When present, applies
|
|
145
|
+
* to this toolbar and all nested ones as well.
|
|
146
|
+
*/
|
|
147
|
+
fillFromConfig(itemsOrConfig: ToolbarConfig | undefined, factory: ComponentFactory, removeItems?: Array<string>): void;
|
|
148
|
+
/**
|
|
149
|
+
* A utility that expands the plain toolbar configuration into a list of view items using a given component factory.
|
|
150
|
+
*
|
|
151
|
+
* @param itemsOrConfig The toolbar items or the entire toolbar configuration object.
|
|
152
|
+
* @param factory A factory producing toolbar items.
|
|
153
|
+
* @param removeItems An array of items names to be removed from the configuration. When present, applies
|
|
154
|
+
* to this toolbar and all nested ones as well.
|
|
155
|
+
*/
|
|
156
|
+
private _buildItemsFromConfig;
|
|
157
|
+
/**
|
|
158
|
+
* Cleans up the {@link module:ui/toolbar/toolbarview~ToolbarView#items} of the toolbar by removing unwanted items and
|
|
159
|
+
* duplicated (obsolete) separators or line breaks.
|
|
160
|
+
*
|
|
161
|
+
* @param items The toolbar items configuration.
|
|
162
|
+
* @param factory A factory producing toolbar items.
|
|
163
|
+
* @param removeItems An array of items names to be removed from the configuration.
|
|
164
|
+
* @returns Items after the clean-up.
|
|
165
|
+
*/
|
|
166
|
+
private _cleanItemsConfiguration;
|
|
167
|
+
/**
|
|
168
|
+
* Remove leading, trailing, and duplicated separators (`-` and `|`).
|
|
169
|
+
*
|
|
170
|
+
* @returns Toolbar items after the separator and line break clean-up.
|
|
171
|
+
*/
|
|
172
|
+
private _cleanSeparatorsAndLineBreaks;
|
|
173
|
+
/**
|
|
174
|
+
* Creates a user-defined dropdown containing a toolbar with items.
|
|
175
|
+
*
|
|
176
|
+
* @param definition A definition of the nested toolbar dropdown.
|
|
177
|
+
* @param definition.label A label of the dropdown.
|
|
178
|
+
* @param definition.icon An icon of the drop-down. One of 'bold', 'plus', 'text', 'importExport', 'alignLeft',
|
|
179
|
+
* 'paragraph' or an SVG string. When `false` is passed, no icon will be used.
|
|
180
|
+
* @param definition.withText When set `true`, the label of the dropdown will be visible. See
|
|
181
|
+
* {@link module:ui/button/buttonview~ButtonView#withText} to learn more.
|
|
182
|
+
* @param definition.tooltip A tooltip of the dropdown button. See
|
|
183
|
+
* {@link module:ui/button/buttonview~ButtonView#tooltip} to learn more. Defaults to `true`.
|
|
184
|
+
* @param componentFactory Component factory used to create items
|
|
185
|
+
* of the nested toolbar.
|
|
186
|
+
*/
|
|
187
|
+
private _createNestedToolbarDropdown;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Fired when some toolbar {@link ~ToolbarView#items} were grouped or ungrouped as a result of some change
|
|
191
|
+
* in the toolbar geometry.
|
|
192
|
+
*
|
|
193
|
+
* **Note**: This event is always fired **once** regardless of the number of items that were be
|
|
194
|
+
* grouped or ungrouped at a time.
|
|
195
|
+
*
|
|
196
|
+
* **Note**: This event is fired only if the items grouping functionality was enabled in
|
|
197
|
+
* the first place (see {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull}).
|
|
198
|
+
*
|
|
199
|
+
* @eventName ~ToolbarView#groupedItemsUpdate
|
|
200
|
+
*/
|
|
201
|
+
export type ToolbarViewGroupedItemsUpdateEvent = {
|
|
202
|
+
name: 'groupedItemsUpdate';
|
|
203
|
+
args: [];
|
|
204
|
+
};
|
|
205
|
+
/**
|
|
206
|
+
* An inner block of the {@link module:ui/toolbar/toolbarview~ToolbarView} hosting its
|
|
207
|
+
* {@link module:ui/toolbar/toolbarview~ToolbarView#items}.
|
|
208
|
+
*/
|
|
209
|
+
declare class ItemsView extends View {
|
|
210
|
+
/**
|
|
211
|
+
* A collection of items (buttons, dropdowns, etc.).
|
|
212
|
+
*/
|
|
213
|
+
readonly children: ViewCollection;
|
|
214
|
+
/**
|
|
215
|
+
* @inheritDoc
|
|
216
|
+
*/
|
|
217
|
+
constructor(locale?: Locale);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Options passed to the {@link module:ui/toolbar/toolbarview~ToolbarView#constructor} of the toolbar.
|
|
221
|
+
*/
|
|
222
|
+
export interface ToolbarOptions {
|
|
223
|
+
/**
|
|
224
|
+
* When set to `true`, the toolbar will automatically group {@link module:ui/toolbar/toolbarview~ToolbarView#items} that
|
|
225
|
+
* would normally wrap to the next line when there is not enough space to display them in a single row, for
|
|
226
|
+
* instance, if the parent container of the toolbar is narrow. For toolbars in absolutely positioned containers
|
|
227
|
+
* without width restrictions also the {@link module:ui/toolbar/toolbarview~ToolbarOptions#isFloating} option is required to be `true`.
|
|
228
|
+
*
|
|
229
|
+
* See also: {@link module:ui/toolbar/toolbarview~ToolbarView#maxWidth}.
|
|
230
|
+
*/
|
|
231
|
+
shouldGroupWhenFull?: boolean;
|
|
232
|
+
/**
|
|
233
|
+
* This option should be enabled for toolbars in absolutely positioned containers without width restrictions
|
|
234
|
+
* to enable automatic {@link module:ui/toolbar/toolbarview~ToolbarView#items} grouping.
|
|
235
|
+
* When this option is set to `true`, the items will stop wrapping to the next line
|
|
236
|
+
* and together with {@link module:ui/toolbar/toolbarview~ToolbarOptions#shouldGroupWhenFull},
|
|
237
|
+
* this will allow grouping them when there is not enough space in a single row.
|
|
238
|
+
*/
|
|
239
|
+
isFloating?: boolean;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* A class interface defining the behavior of the {@link module:ui/toolbar/toolbarview~ToolbarView}.
|
|
243
|
+
*
|
|
244
|
+
* Toolbar behaviors extend its look and functionality and have an impact on the
|
|
245
|
+
* {@link module:ui/toolbar/toolbarview~ToolbarView#element} template or
|
|
246
|
+
* {@link module:ui/toolbar/toolbarview~ToolbarView#render rendering}. They can be enabled
|
|
247
|
+
* conditionally, e.g. depending on the configuration of the toolbar.
|
|
248
|
+
*/
|
|
249
|
+
export interface ToolbarBehavior {
|
|
250
|
+
/**
|
|
251
|
+
* A method called after the toolbar has been {@link module:ui/toolbar/toolbarview~ToolbarView#render rendered}.
|
|
252
|
+
* It can be used to, for example, customize the behavior of the toolbar when its
|
|
253
|
+
* {@link module:ui/toolbar/toolbarview~ToolbarView#element} is available.
|
|
254
|
+
*
|
|
255
|
+
* @param view An instance of the toolbar being rendered.
|
|
256
|
+
*/
|
|
257
|
+
render(view: ToolbarView): void;
|
|
258
|
+
/**
|
|
259
|
+
* A method called after the toolbar has been {@link module:ui/toolbar/toolbarview~ToolbarView#destroy destroyed}.
|
|
260
|
+
* It allows cleaning up after the toolbar behavior, for instance, this is the right place to detach
|
|
261
|
+
* event listeners, free up references, etc.
|
|
262
|
+
*/
|
|
263
|
+
destroy(): void;
|
|
264
|
+
}
|
|
265
|
+
export {};
|