@ckeditor/ckeditor5-ui 44.3.0 → 45.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/LICENSE.md +1 -1
- package/ckeditor5-metadata.json +1 -1
- package/dist/index-editor.css +28 -0
- package/dist/index.css +33 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +196 -74
- package/dist/index.js.map +1 -1
- package/dist/translations/be.d.ts +8 -0
- package/dist/translations/be.js +5 -0
- package/dist/translations/be.umd.js +11 -0
- package/lang/translations/be.po +208 -0
- package/package.json +12 -6
- package/src/arialiveannouncer.js +24 -0
- package/src/autocomplete/autocompleteview.js +29 -25
- package/src/badge/badge.js +23 -15
- package/src/bindings/draggableviewmixin.js +12 -12
- package/src/button/buttonview.js +35 -5
- package/src/button/filedialogbuttonview.js +11 -1
- package/src/button/listitembuttonview.js +14 -10
- package/src/button/switchbuttonview.js +4 -0
- package/src/collapsible/collapsibleview.d.ts +1 -4
- package/src/collapsible/collapsibleview.js +13 -2
- package/src/colorgrid/colorgridview.js +18 -2
- package/src/colorgrid/colortileview.d.ts +1 -4
- package/src/colorgrid/colortileview.js +3 -3
- package/src/colorpicker/colorpickerview.js +28 -1
- package/src/colorselector/colorgridsfragmentview.js +80 -4
- package/src/colorselector/colorpickerfragmentview.js +44 -3
- package/src/colorselector/colorselectorview.js +36 -0
- package/src/componentfactory.js +8 -4
- package/src/dialog/dialog.js +18 -0
- package/src/dialog/dialogactionsview.js +20 -0
- package/src/dialog/dialogcontentview.js +4 -0
- package/src/dialog/dialogview.d.ts +1 -1
- package/src/dialog/dialogview.js +56 -11
- package/src/dropdown/button/dropdownbuttonview.d.ts +0 -3
- package/src/dropdown/button/dropdownbuttonview.js +6 -2
- package/src/dropdown/button/splitbuttonview.d.ts +1 -4
- package/src/dropdown/button/splitbuttonview.js +27 -3
- package/src/dropdown/dropdownpanelview.js +8 -0
- package/src/dropdown/dropdownview.js +235 -184
- package/src/dropdown/menu/dropdownmenubuttonview.d.ts +0 -3
- package/src/dropdown/menu/dropdownmenubuttonview.js +6 -2
- package/src/dropdown/menu/dropdownmenulistitembuttonview.js +1 -0
- package/src/dropdown/menu/dropdownmenulistitemview.js +4 -0
- package/src/dropdown/menu/dropdownmenunestedmenuview.js +31 -8
- package/src/dropdown/menu/dropdownmenurootlistview.js +16 -8
- package/src/editableui/editableuiview.js +22 -4
- package/src/editableui/inline/inlineeditableuiview.js +4 -0
- package/src/editorui/accessibilityhelp/accessibilityhelp.js +8 -11
- package/src/editorui/bodycollection.js +13 -0
- package/src/editorui/boxed/boxededitoruiview.js +14 -0
- package/src/editorui/editorui.d.ts +1 -1
- package/src/editorui/editorui.js +56 -25
- package/src/editorui/editoruiview.d.ts +15 -1
- package/src/editorui/editoruiview.js +22 -0
- package/src/editorui/evaluationbadge.js +5 -5
- package/src/editorui/poweredby.d.ts +1 -4
- package/src/editorui/poweredby.js +5 -2
- package/src/focuscycler.js +31 -0
- package/src/formheader/formheaderview.js +8 -0
- package/src/formrow/formrowview.d.ts +57 -0
- package/src/formrow/formrowview.js +56 -0
- package/src/highlightedtext/highlightedtextview.js +1 -1
- package/src/highlightedtext/labelwithhighlightview.js +4 -0
- package/src/icon/iconview.js +25 -16
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/input/inputbase.js +5 -0
- package/src/label/labelview.js +5 -0
- package/src/labeledfield/labeledfieldview.js +20 -0
- package/src/labeledinput/labeledinputview.js +13 -0
- package/src/list/listitemgroupview.js +15 -0
- package/src/list/listitemview.js +4 -0
- package/src/list/listview.js +27 -5
- package/src/menubar/menubarmenubuttonview.d.ts +0 -3
- package/src/menubar/menubarmenubuttonview.js +6 -2
- package/src/menubar/menubarmenupanelview.js +4 -0
- package/src/menubar/menubarmenuview.js +23 -6
- package/src/menubar/menubarview.d.ts +8 -0
- package/src/menubar/menubarview.js +27 -7
- package/src/menubar/utils.d.ts +6 -0
- package/src/menubar/utils.js +16 -3
- package/src/model.js +1 -1
- package/src/panel/balloon/balloonpanelview.js +464 -449
- package/src/panel/balloon/contextualballoon.js +60 -24
- package/src/panel/sticky/stickypanelview.js +14 -0
- package/src/search/searchresultsview.js +18 -0
- package/src/search/text/searchtextqueryview.d.ts +0 -3
- package/src/search/text/searchtextqueryview.js +15 -3
- package/src/search/text/searchtextview.js +43 -3
- package/src/template.js +69 -1
- package/src/textarea/textareaview.js +12 -5
- package/src/toolbar/balloon/balloontoolbar.d.ts +1 -1
- package/src/toolbar/balloon/balloontoolbar.js +38 -11
- package/src/toolbar/block/blocktoolbar.js +24 -8
- package/src/toolbar/toolbarview.d.ts +15 -2
- package/src/toolbar/toolbarview.js +206 -58
- package/src/tooltipmanager.js +50 -32
- package/src/view.js +76 -0
- package/src/viewcollection.js +4 -0
- package/theme/components/form/form.css +87 -0
- package/theme/components/formrow/formrow.css +32 -0
- package/theme/icons/accessibility.svg +0 -1
- package/theme/icons/color-tile-check.svg +0 -1
- package/theme/icons/dropdown-arrow.svg +0 -1
- package/theme/icons/project-logo.svg +0 -1
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module ui/dropdown/button/splitbuttonview
|
|
7
7
|
*/
|
|
8
|
+
import { IconDropdownArrow } from '@ckeditor/ckeditor5-icons';
|
|
9
|
+
import { KeystrokeHandler, FocusTracker } from '@ckeditor/ckeditor5-utils';
|
|
8
10
|
import View from '../../view.js';
|
|
9
11
|
import ButtonView from '../../button/buttonview.js';
|
|
10
|
-
import { KeystrokeHandler, FocusTracker } from '@ckeditor/ckeditor5-utils';
|
|
11
|
-
import dropdownArrowIcon from '../../../theme/icons/dropdown-arrow.svg';
|
|
12
12
|
import '../../../theme/components/dropdown/splitbutton.css';
|
|
13
13
|
/**
|
|
14
14
|
* The split button view class.
|
|
@@ -30,6 +30,30 @@ import '../../../theme/components/dropdown/splitbutton.css';
|
|
|
30
30
|
* Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.
|
|
31
31
|
*/
|
|
32
32
|
export default class SplitButtonView extends View {
|
|
33
|
+
/**
|
|
34
|
+
* Collection of the child views inside of the split button {@link #element}.
|
|
35
|
+
*/
|
|
36
|
+
children;
|
|
37
|
+
/**
|
|
38
|
+
* A main button of split button.
|
|
39
|
+
*/
|
|
40
|
+
actionView;
|
|
41
|
+
/**
|
|
42
|
+
* A secondary button of split button that opens dropdown.
|
|
43
|
+
*/
|
|
44
|
+
arrowView;
|
|
45
|
+
/**
|
|
46
|
+
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
|
|
47
|
+
* keystrokes of the split button:
|
|
48
|
+
*
|
|
49
|
+
* * <kbd>▶</kbd> moves focus to arrow view when action view is focused,
|
|
50
|
+
* * <kbd>◀</kbd> moves focus to action view when arrow view is focused.
|
|
51
|
+
*/
|
|
52
|
+
keystrokes;
|
|
53
|
+
/**
|
|
54
|
+
* Tracks information about DOM focus in the dropdown.
|
|
55
|
+
*/
|
|
56
|
+
focusTracker;
|
|
33
57
|
/**
|
|
34
58
|
* @inheritDoc
|
|
35
59
|
*/
|
|
@@ -134,7 +158,7 @@ export default class SplitButtonView extends View {
|
|
|
134
158
|
_createArrowView() {
|
|
135
159
|
const arrowView = new ButtonView();
|
|
136
160
|
const bind = arrowView.bindTemplate;
|
|
137
|
-
arrowView.icon =
|
|
161
|
+
arrowView.icon = IconDropdownArrow;
|
|
138
162
|
arrowView.extendTemplate({
|
|
139
163
|
attributes: {
|
|
140
164
|
class: [
|
|
@@ -13,6 +13,14 @@ import { logWarning } from '@ckeditor/ckeditor5-utils';
|
|
|
13
13
|
* See {@link module:ui/dropdown/dropdownview~DropdownView} to learn about the common usage.
|
|
14
14
|
*/
|
|
15
15
|
export default class DropdownPanelView extends View {
|
|
16
|
+
/**
|
|
17
|
+
* Collection of the child views in this panel.
|
|
18
|
+
*
|
|
19
|
+
* A common child type is the {@link module:ui/list/listview~ListView} and {@link module:ui/toolbar/toolbarview~ToolbarView}.
|
|
20
|
+
* See {@link module:ui/dropdown/utils~addListToDropdown} and
|
|
21
|
+
* {@link module:ui/dropdown/utils~addToolbarToDropdown} to learn more about child views of dropdowns.
|
|
22
|
+
*/
|
|
23
|
+
children;
|
|
16
24
|
/**
|
|
17
25
|
* @inheritDoc
|
|
18
26
|
*/
|
|
@@ -61,6 +61,57 @@ import '../../theme/components/dropdown/dropdown.css';
|
|
|
61
61
|
* you do and you really need to do it, it is recommended to use the {@link module:ui/dropdown/utils~createDropdown} helper.
|
|
62
62
|
*/
|
|
63
63
|
class DropdownView extends View {
|
|
64
|
+
/**
|
|
65
|
+
* Button of the dropdown view. Clicking the button opens the {@link #panelView}.
|
|
66
|
+
*/
|
|
67
|
+
buttonView;
|
|
68
|
+
/**
|
|
69
|
+
* Panel of the dropdown. It opens when the {@link #buttonView} is
|
|
70
|
+
* {@link module:ui/button/button~Button#event:execute executed} (i.e. clicked).
|
|
71
|
+
*
|
|
72
|
+
* Child views can be added to the panel's `children` collection:
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* dropdown.panelView.children.add( childView );
|
|
76
|
+
* ```
|
|
77
|
+
*
|
|
78
|
+
* See {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView#children} and
|
|
79
|
+
* {@link module:ui/viewcollection~ViewCollection#add}.
|
|
80
|
+
*/
|
|
81
|
+
panelView;
|
|
82
|
+
/**
|
|
83
|
+
* Tracks information about the DOM focus in the dropdown.
|
|
84
|
+
*/
|
|
85
|
+
focusTracker;
|
|
86
|
+
/**
|
|
87
|
+
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
|
|
88
|
+
* keystrokes of the dropdown:
|
|
89
|
+
*
|
|
90
|
+
* * <kbd>▼</kbd> opens the dropdown,
|
|
91
|
+
* * <kbd>◀</kbd> and <kbd>Esc</kbd> closes the dropdown.
|
|
92
|
+
*/
|
|
93
|
+
keystrokes;
|
|
94
|
+
/**
|
|
95
|
+
* A child {@link module:ui/list/listview~ListView list view} of the dropdown located
|
|
96
|
+
* in its {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.
|
|
97
|
+
*
|
|
98
|
+
* **Note**: Only supported when dropdown has list view added using {@link module:ui/dropdown/utils~addListToDropdown}.
|
|
99
|
+
*/
|
|
100
|
+
listView;
|
|
101
|
+
/**
|
|
102
|
+
* A child toolbar of the dropdown located in the
|
|
103
|
+
* {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.
|
|
104
|
+
*
|
|
105
|
+
* **Note**: Only supported when dropdown has a toolbar added using {@link module:ui/dropdown/utils~addToolbarToDropdown}.
|
|
106
|
+
*/
|
|
107
|
+
toolbarView;
|
|
108
|
+
/**
|
|
109
|
+
* A child menu component of the dropdown located
|
|
110
|
+
* in its {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.
|
|
111
|
+
*
|
|
112
|
+
* **Note**: Only supported when dropdown has a menu added using {@link module:ui/dropdown/utils~addMenuToDropdown}.
|
|
113
|
+
*/
|
|
114
|
+
menuView;
|
|
64
115
|
/**
|
|
65
116
|
* Creates an instance of the dropdown.
|
|
66
117
|
*
|
|
@@ -200,189 +251,189 @@ class DropdownView extends View {
|
|
|
200
251
|
get _defaultPanelPositionName() {
|
|
201
252
|
return this.locale.uiLanguageDirection === 'rtl' ? 'sw' : 'se';
|
|
202
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* A set of positioning functions used by the dropdown view to determine
|
|
256
|
+
* the optimal position (i.e. fitting into the browser viewport) of its
|
|
257
|
+
* {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel} when
|
|
258
|
+
* {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition} is set to 'auto'`.
|
|
259
|
+
*
|
|
260
|
+
* The available positioning functions are as follow:
|
|
261
|
+
*
|
|
262
|
+
* **South**
|
|
263
|
+
*
|
|
264
|
+
* * `south`
|
|
265
|
+
*
|
|
266
|
+
* ```
|
|
267
|
+
* [ Button ]
|
|
268
|
+
* +-----------------+
|
|
269
|
+
* | Panel |
|
|
270
|
+
* +-----------------+
|
|
271
|
+
* ```
|
|
272
|
+
*
|
|
273
|
+
* * `southEast`
|
|
274
|
+
*
|
|
275
|
+
* ```
|
|
276
|
+
* [ Button ]
|
|
277
|
+
* +-----------------+
|
|
278
|
+
* | Panel |
|
|
279
|
+
* +-----------------+
|
|
280
|
+
* ```
|
|
281
|
+
*
|
|
282
|
+
* * `southWest`
|
|
283
|
+
*
|
|
284
|
+
* ```
|
|
285
|
+
* [ Button ]
|
|
286
|
+
* +-----------------+
|
|
287
|
+
* | Panel |
|
|
288
|
+
* +-----------------+
|
|
289
|
+
* ```
|
|
290
|
+
*
|
|
291
|
+
* * `southMiddleEast`
|
|
292
|
+
*
|
|
293
|
+
* ```
|
|
294
|
+
* [ Button ]
|
|
295
|
+
* +-----------------+
|
|
296
|
+
* | Panel |
|
|
297
|
+
* +-----------------+
|
|
298
|
+
* ```
|
|
299
|
+
*
|
|
300
|
+
* * `southMiddleWest`
|
|
301
|
+
*
|
|
302
|
+
* ```
|
|
303
|
+
* [ Button ]
|
|
304
|
+
* +-----------------+
|
|
305
|
+
* | Panel |
|
|
306
|
+
* +-----------------+
|
|
307
|
+
* ```
|
|
308
|
+
*
|
|
309
|
+
* **North**
|
|
310
|
+
*
|
|
311
|
+
* * `north`
|
|
312
|
+
*
|
|
313
|
+
* ```
|
|
314
|
+
* +-----------------+
|
|
315
|
+
* | Panel |
|
|
316
|
+
* +-----------------+
|
|
317
|
+
* [ Button ]
|
|
318
|
+
* ```
|
|
319
|
+
*
|
|
320
|
+
* * `northEast`
|
|
321
|
+
*
|
|
322
|
+
* ```
|
|
323
|
+
* +-----------------+
|
|
324
|
+
* | Panel |
|
|
325
|
+
* +-----------------+
|
|
326
|
+
* [ Button ]
|
|
327
|
+
* ```
|
|
328
|
+
*
|
|
329
|
+
* * `northWest`
|
|
330
|
+
*
|
|
331
|
+
* ```
|
|
332
|
+
* +-----------------+
|
|
333
|
+
* | Panel |
|
|
334
|
+
* +-----------------+
|
|
335
|
+
* [ Button ]
|
|
336
|
+
* ```
|
|
337
|
+
*
|
|
338
|
+
* * `northMiddleEast`
|
|
339
|
+
*
|
|
340
|
+
* ```
|
|
341
|
+
* +-----------------+
|
|
342
|
+
* | Panel |
|
|
343
|
+
* +-----------------+
|
|
344
|
+
* [ Button ]
|
|
345
|
+
* ```
|
|
346
|
+
*
|
|
347
|
+
* * `northMiddleWest`
|
|
348
|
+
*
|
|
349
|
+
* ```
|
|
350
|
+
* +-----------------+
|
|
351
|
+
* | Panel |
|
|
352
|
+
* +-----------------+
|
|
353
|
+
* [ Button ]
|
|
354
|
+
* ```
|
|
355
|
+
*
|
|
356
|
+
* Positioning functions are compatible with {@link module:utils/dom/position~DomPoint}.
|
|
357
|
+
*
|
|
358
|
+
* The name that position function returns will be reflected in dropdown panel's class that
|
|
359
|
+
* controls its placement. See {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition}
|
|
360
|
+
* to learn more.
|
|
361
|
+
*/
|
|
362
|
+
static defaultPanelPositions = {
|
|
363
|
+
south: (buttonRect, panelRect) => {
|
|
364
|
+
return {
|
|
365
|
+
top: buttonRect.bottom,
|
|
366
|
+
left: buttonRect.left - (panelRect.width - buttonRect.width) / 2,
|
|
367
|
+
name: 's'
|
|
368
|
+
};
|
|
369
|
+
},
|
|
370
|
+
southEast: buttonRect => {
|
|
371
|
+
return {
|
|
372
|
+
top: buttonRect.bottom,
|
|
373
|
+
left: buttonRect.left,
|
|
374
|
+
name: 'se'
|
|
375
|
+
};
|
|
376
|
+
},
|
|
377
|
+
southWest: (buttonRect, panelRect) => {
|
|
378
|
+
return {
|
|
379
|
+
top: buttonRect.bottom,
|
|
380
|
+
left: buttonRect.left - panelRect.width + buttonRect.width,
|
|
381
|
+
name: 'sw'
|
|
382
|
+
};
|
|
383
|
+
},
|
|
384
|
+
southMiddleEast: (buttonRect, panelRect) => {
|
|
385
|
+
return {
|
|
386
|
+
top: buttonRect.bottom,
|
|
387
|
+
left: buttonRect.left - (panelRect.width - buttonRect.width) / 4,
|
|
388
|
+
name: 'sme'
|
|
389
|
+
};
|
|
390
|
+
},
|
|
391
|
+
southMiddleWest: (buttonRect, panelRect) => {
|
|
392
|
+
return {
|
|
393
|
+
top: buttonRect.bottom,
|
|
394
|
+
left: buttonRect.left - (panelRect.width - buttonRect.width) * 3 / 4,
|
|
395
|
+
name: 'smw'
|
|
396
|
+
};
|
|
397
|
+
},
|
|
398
|
+
north: (buttonRect, panelRect) => {
|
|
399
|
+
return {
|
|
400
|
+
top: buttonRect.top - panelRect.height,
|
|
401
|
+
left: buttonRect.left - (panelRect.width - buttonRect.width) / 2,
|
|
402
|
+
name: 'n'
|
|
403
|
+
};
|
|
404
|
+
},
|
|
405
|
+
northEast: (buttonRect, panelRect) => {
|
|
406
|
+
return {
|
|
407
|
+
top: buttonRect.top - panelRect.height,
|
|
408
|
+
left: buttonRect.left,
|
|
409
|
+
name: 'ne'
|
|
410
|
+
};
|
|
411
|
+
},
|
|
412
|
+
northWest: (buttonRect, panelRect) => {
|
|
413
|
+
return {
|
|
414
|
+
top: buttonRect.top - panelRect.height,
|
|
415
|
+
left: buttonRect.left - panelRect.width + buttonRect.width,
|
|
416
|
+
name: 'nw'
|
|
417
|
+
};
|
|
418
|
+
},
|
|
419
|
+
northMiddleEast: (buttonRect, panelRect) => {
|
|
420
|
+
return {
|
|
421
|
+
top: buttonRect.top - panelRect.height,
|
|
422
|
+
left: buttonRect.left - (panelRect.width - buttonRect.width) / 4,
|
|
423
|
+
name: 'nme'
|
|
424
|
+
};
|
|
425
|
+
},
|
|
426
|
+
northMiddleWest: (buttonRect, panelRect) => {
|
|
427
|
+
return {
|
|
428
|
+
top: buttonRect.top - panelRect.height,
|
|
429
|
+
left: buttonRect.left - (panelRect.width - buttonRect.width) * 3 / 4,
|
|
430
|
+
name: 'nmw'
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
/**
|
|
435
|
+
* A function used to calculate the optimal position for the dropdown panel.
|
|
436
|
+
*/
|
|
437
|
+
static _getOptimalPosition = getOptimalPosition;
|
|
203
438
|
}
|
|
204
|
-
/**
|
|
205
|
-
* A set of positioning functions used by the dropdown view to determine
|
|
206
|
-
* the optimal position (i.e. fitting into the browser viewport) of its
|
|
207
|
-
* {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel} when
|
|
208
|
-
* {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition} is set to 'auto'`.
|
|
209
|
-
*
|
|
210
|
-
* The available positioning functions are as follow:
|
|
211
|
-
*
|
|
212
|
-
* **South**
|
|
213
|
-
*
|
|
214
|
-
* * `south`
|
|
215
|
-
*
|
|
216
|
-
* ```
|
|
217
|
-
* [ Button ]
|
|
218
|
-
* +-----------------+
|
|
219
|
-
* | Panel |
|
|
220
|
-
* +-----------------+
|
|
221
|
-
* ```
|
|
222
|
-
*
|
|
223
|
-
* * `southEast`
|
|
224
|
-
*
|
|
225
|
-
* ```
|
|
226
|
-
* [ Button ]
|
|
227
|
-
* +-----------------+
|
|
228
|
-
* | Panel |
|
|
229
|
-
* +-----------------+
|
|
230
|
-
* ```
|
|
231
|
-
*
|
|
232
|
-
* * `southWest`
|
|
233
|
-
*
|
|
234
|
-
* ```
|
|
235
|
-
* [ Button ]
|
|
236
|
-
* +-----------------+
|
|
237
|
-
* | Panel |
|
|
238
|
-
* +-----------------+
|
|
239
|
-
* ```
|
|
240
|
-
*
|
|
241
|
-
* * `southMiddleEast`
|
|
242
|
-
*
|
|
243
|
-
* ```
|
|
244
|
-
* [ Button ]
|
|
245
|
-
* +-----------------+
|
|
246
|
-
* | Panel |
|
|
247
|
-
* +-----------------+
|
|
248
|
-
* ```
|
|
249
|
-
*
|
|
250
|
-
* * `southMiddleWest`
|
|
251
|
-
*
|
|
252
|
-
* ```
|
|
253
|
-
* [ Button ]
|
|
254
|
-
* +-----------------+
|
|
255
|
-
* | Panel |
|
|
256
|
-
* +-----------------+
|
|
257
|
-
* ```
|
|
258
|
-
*
|
|
259
|
-
* **North**
|
|
260
|
-
*
|
|
261
|
-
* * `north`
|
|
262
|
-
*
|
|
263
|
-
* ```
|
|
264
|
-
* +-----------------+
|
|
265
|
-
* | Panel |
|
|
266
|
-
* +-----------------+
|
|
267
|
-
* [ Button ]
|
|
268
|
-
* ```
|
|
269
|
-
*
|
|
270
|
-
* * `northEast`
|
|
271
|
-
*
|
|
272
|
-
* ```
|
|
273
|
-
* +-----------------+
|
|
274
|
-
* | Panel |
|
|
275
|
-
* +-----------------+
|
|
276
|
-
* [ Button ]
|
|
277
|
-
* ```
|
|
278
|
-
*
|
|
279
|
-
* * `northWest`
|
|
280
|
-
*
|
|
281
|
-
* ```
|
|
282
|
-
* +-----------------+
|
|
283
|
-
* | Panel |
|
|
284
|
-
* +-----------------+
|
|
285
|
-
* [ Button ]
|
|
286
|
-
* ```
|
|
287
|
-
*
|
|
288
|
-
* * `northMiddleEast`
|
|
289
|
-
*
|
|
290
|
-
* ```
|
|
291
|
-
* +-----------------+
|
|
292
|
-
* | Panel |
|
|
293
|
-
* +-----------------+
|
|
294
|
-
* [ Button ]
|
|
295
|
-
* ```
|
|
296
|
-
*
|
|
297
|
-
* * `northMiddleWest`
|
|
298
|
-
*
|
|
299
|
-
* ```
|
|
300
|
-
* +-----------------+
|
|
301
|
-
* | Panel |
|
|
302
|
-
* +-----------------+
|
|
303
|
-
* [ Button ]
|
|
304
|
-
* ```
|
|
305
|
-
*
|
|
306
|
-
* Positioning functions are compatible with {@link module:utils/dom/position~DomPoint}.
|
|
307
|
-
*
|
|
308
|
-
* The name that position function returns will be reflected in dropdown panel's class that
|
|
309
|
-
* controls its placement. See {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition}
|
|
310
|
-
* to learn more.
|
|
311
|
-
*/
|
|
312
|
-
DropdownView.defaultPanelPositions = {
|
|
313
|
-
south: (buttonRect, panelRect) => {
|
|
314
|
-
return {
|
|
315
|
-
top: buttonRect.bottom,
|
|
316
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) / 2,
|
|
317
|
-
name: 's'
|
|
318
|
-
};
|
|
319
|
-
},
|
|
320
|
-
southEast: buttonRect => {
|
|
321
|
-
return {
|
|
322
|
-
top: buttonRect.bottom,
|
|
323
|
-
left: buttonRect.left,
|
|
324
|
-
name: 'se'
|
|
325
|
-
};
|
|
326
|
-
},
|
|
327
|
-
southWest: (buttonRect, panelRect) => {
|
|
328
|
-
return {
|
|
329
|
-
top: buttonRect.bottom,
|
|
330
|
-
left: buttonRect.left - panelRect.width + buttonRect.width,
|
|
331
|
-
name: 'sw'
|
|
332
|
-
};
|
|
333
|
-
},
|
|
334
|
-
southMiddleEast: (buttonRect, panelRect) => {
|
|
335
|
-
return {
|
|
336
|
-
top: buttonRect.bottom,
|
|
337
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) / 4,
|
|
338
|
-
name: 'sme'
|
|
339
|
-
};
|
|
340
|
-
},
|
|
341
|
-
southMiddleWest: (buttonRect, panelRect) => {
|
|
342
|
-
return {
|
|
343
|
-
top: buttonRect.bottom,
|
|
344
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) * 3 / 4,
|
|
345
|
-
name: 'smw'
|
|
346
|
-
};
|
|
347
|
-
},
|
|
348
|
-
north: (buttonRect, panelRect) => {
|
|
349
|
-
return {
|
|
350
|
-
top: buttonRect.top - panelRect.height,
|
|
351
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) / 2,
|
|
352
|
-
name: 'n'
|
|
353
|
-
};
|
|
354
|
-
},
|
|
355
|
-
northEast: (buttonRect, panelRect) => {
|
|
356
|
-
return {
|
|
357
|
-
top: buttonRect.top - panelRect.height,
|
|
358
|
-
left: buttonRect.left,
|
|
359
|
-
name: 'ne'
|
|
360
|
-
};
|
|
361
|
-
},
|
|
362
|
-
northWest: (buttonRect, panelRect) => {
|
|
363
|
-
return {
|
|
364
|
-
top: buttonRect.top - panelRect.height,
|
|
365
|
-
left: buttonRect.left - panelRect.width + buttonRect.width,
|
|
366
|
-
name: 'nw'
|
|
367
|
-
};
|
|
368
|
-
},
|
|
369
|
-
northMiddleEast: (buttonRect, panelRect) => {
|
|
370
|
-
return {
|
|
371
|
-
top: buttonRect.top - panelRect.height,
|
|
372
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) / 4,
|
|
373
|
-
name: 'nme'
|
|
374
|
-
};
|
|
375
|
-
},
|
|
376
|
-
northMiddleWest: (buttonRect, panelRect) => {
|
|
377
|
-
return {
|
|
378
|
-
top: buttonRect.top - panelRect.height,
|
|
379
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) * 3 / 4,
|
|
380
|
-
name: 'nmw'
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
/**
|
|
385
|
-
* A function used to calculate the optimal position for the dropdown panel.
|
|
386
|
-
*/
|
|
387
|
-
DropdownView._getOptimalPosition = getOptimalPosition;
|
|
388
439
|
export default DropdownView;
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module ui/dropdown/menu/dropdownmenubuttonview
|
|
7
|
-
*/
|
|
8
5
|
import IconView from '../../icon/iconview.js';
|
|
9
6
|
import ListItemButtonView from '../../button/listitembuttonview.js';
|
|
10
7
|
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
@@ -5,14 +5,18 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module ui/dropdown/menu/dropdownmenubuttonview
|
|
7
7
|
*/
|
|
8
|
+
import { IconDropdownArrow } from '@ckeditor/ckeditor5-icons';
|
|
8
9
|
import IconView from '../../icon/iconview.js';
|
|
9
10
|
import ListItemButtonView from '../../button/listitembuttonview.js';
|
|
10
|
-
import dropdownArrowIcon from '../../../theme/icons/dropdown-arrow.svg';
|
|
11
11
|
import '../../../theme/components/dropdown/menu/dropdownmenubutton.css';
|
|
12
12
|
/**
|
|
13
13
|
* Represents a view for a dropdown menu button.
|
|
14
14
|
*/
|
|
15
15
|
export default class DropdownMenuButtonView extends ListItemButtonView {
|
|
16
|
+
/**
|
|
17
|
+
* An icon that displays an arrow to indicate a direction of the menu.
|
|
18
|
+
*/
|
|
19
|
+
arrowView;
|
|
16
20
|
/**
|
|
17
21
|
* Creates an instance of the dropdown menu button view.
|
|
18
22
|
*
|
|
@@ -54,7 +58,7 @@ export default class DropdownMenuButtonView extends ListItemButtonView {
|
|
|
54
58
|
*/
|
|
55
59
|
_createArrowView() {
|
|
56
60
|
const arrowView = new IconView();
|
|
57
|
-
arrowView.content =
|
|
61
|
+
arrowView.content = IconDropdownArrow;
|
|
58
62
|
arrowView.extendTemplate({
|
|
59
63
|
attributes: {
|
|
60
64
|
class: 'ck-dropdown-menu-list__nested-menu__button__arrow'
|
|
@@ -8,6 +8,7 @@ import '../../../theme/components/dropdown/menu/dropdownmenulistitembutton.css';
|
|
|
8
8
|
* Represents a view for a button in a dropdown menu list item.
|
|
9
9
|
*/
|
|
10
10
|
export default class DropdownMenuListItemButtonView extends ButtonView {
|
|
11
|
+
id;
|
|
11
12
|
constructor(locale, id, label) {
|
|
12
13
|
super(locale);
|
|
13
14
|
this.id = id;
|
|
@@ -9,6 +9,10 @@ import '../../../theme/components/dropdown/menu/dropdownmenulistitem.css';
|
|
|
9
9
|
* Represents a view for a single item in a dropdown menu list.
|
|
10
10
|
*/
|
|
11
11
|
export default class DropdownMenuListItemView extends ListItemView {
|
|
12
|
+
/**
|
|
13
|
+
* The view representing either a flat item or a nested menu in a dropdown menu list item.
|
|
14
|
+
*/
|
|
15
|
+
childView;
|
|
12
16
|
constructor(locale, parentMenuView, childView) {
|
|
13
17
|
super(locale);
|
|
14
18
|
const bind = this.bindTemplate;
|
|
@@ -17,6 +17,37 @@ import '../../../theme/components/dropdown/menu/dropdownmenu.css';
|
|
|
17
17
|
* Represents a nested menu view.
|
|
18
18
|
*/
|
|
19
19
|
class DropdownMenuNestedMenuView extends View {
|
|
20
|
+
/**
|
|
21
|
+
* An array of delegated events for the dropdown menu definition controller.
|
|
22
|
+
* These events are delegated to the dropdown menu element.
|
|
23
|
+
*/
|
|
24
|
+
// Due to some spaghetti code we need to delegate `change:isOpen`.
|
|
25
|
+
static DELEGATED_EVENTS = [
|
|
26
|
+
'mouseenter', 'execute', 'change:isOpen'
|
|
27
|
+
];
|
|
28
|
+
id;
|
|
29
|
+
/**
|
|
30
|
+
* Button of the menu view.
|
|
31
|
+
*/
|
|
32
|
+
buttonView;
|
|
33
|
+
/**
|
|
34
|
+
* Panel of the menu. It hosts children of the menu.
|
|
35
|
+
*/
|
|
36
|
+
panelView;
|
|
37
|
+
/**
|
|
38
|
+
* List of nested menu entries.
|
|
39
|
+
*/
|
|
40
|
+
listView;
|
|
41
|
+
/**
|
|
42
|
+
* Tracks information about the DOM focus in the menu.
|
|
43
|
+
*/
|
|
44
|
+
focusTracker;
|
|
45
|
+
/**
|
|
46
|
+
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
|
|
47
|
+
* keystrokes of the menu.
|
|
48
|
+
*/
|
|
49
|
+
keystrokes;
|
|
50
|
+
_bodyCollection;
|
|
20
51
|
/**
|
|
21
52
|
* Creates a new instance of the DropdownMenuView class.
|
|
22
53
|
*
|
|
@@ -181,12 +212,4 @@ class DropdownMenuNestedMenuView extends View {
|
|
|
181
212
|
}
|
|
182
213
|
}
|
|
183
214
|
}
|
|
184
|
-
/**
|
|
185
|
-
* An array of delegated events for the dropdown menu definition controller.
|
|
186
|
-
* These events are delegated to the dropdown menu element.
|
|
187
|
-
*/
|
|
188
|
-
// Due to some spaghetti code we need to delegate `change:isOpen`.
|
|
189
|
-
DropdownMenuNestedMenuView.DELEGATED_EVENTS = [
|
|
190
|
-
'mouseenter', 'execute', 'change:isOpen'
|
|
191
|
-
];
|
|
192
215
|
export default DropdownMenuNestedMenuView;
|
|
@@ -70,6 +70,22 @@ import { DropdownRootMenuBehaviors } from './dropdownmenubehaviors.js';
|
|
|
70
70
|
* It is recommended to use this class together with {@link module:ui/dropdown/utils~addMenuToDropdown `addMenuToDropdown()` helper}.
|
|
71
71
|
*/
|
|
72
72
|
export default class DropdownMenuRootListView extends DropdownMenuListView {
|
|
73
|
+
/**
|
|
74
|
+
* The definitions object used to create the whole menu structure.
|
|
75
|
+
*/
|
|
76
|
+
_definition;
|
|
77
|
+
/**
|
|
78
|
+
* Cached array of all menus in the dropdown menu (including nested menus).
|
|
79
|
+
*/
|
|
80
|
+
_cachedMenus = [];
|
|
81
|
+
/**
|
|
82
|
+
* Cached array of all buttons in the dropdown menu (including buttons in nested menus).
|
|
83
|
+
*/
|
|
84
|
+
_cachedButtons = [];
|
|
85
|
+
/**
|
|
86
|
+
* Editor body collection into which nested menus panels will be appended.
|
|
87
|
+
*/
|
|
88
|
+
_bodyCollection;
|
|
73
89
|
/**
|
|
74
90
|
* Creates an instance of the DropdownMenuRootListView class.
|
|
75
91
|
*
|
|
@@ -79,14 +95,6 @@ export default class DropdownMenuRootListView extends DropdownMenuListView {
|
|
|
79
95
|
*/
|
|
80
96
|
constructor(locale, bodyCollection, definition) {
|
|
81
97
|
super(locale);
|
|
82
|
-
/**
|
|
83
|
-
* Cached array of all menus in the dropdown menu (including nested menus).
|
|
84
|
-
*/
|
|
85
|
-
this._cachedMenus = [];
|
|
86
|
-
/**
|
|
87
|
-
* Cached array of all buttons in the dropdown menu (including buttons in nested menus).
|
|
88
|
-
*/
|
|
89
|
-
this._cachedButtons = [];
|
|
90
98
|
this._bodyCollection = bodyCollection;
|
|
91
99
|
this._definition = definition;
|
|
92
100
|
this.set('menuPanelClass', undefined);
|
|
@@ -10,6 +10,28 @@ import View from '../view.js';
|
|
|
10
10
|
* The editable UI view class.
|
|
11
11
|
*/
|
|
12
12
|
export default class EditableUIView extends View {
|
|
13
|
+
/**
|
|
14
|
+
* The name of the editable UI view.
|
|
15
|
+
*/
|
|
16
|
+
name = null;
|
|
17
|
+
/**
|
|
18
|
+
* The editing view instance the editable is related to. Editable uses the editing
|
|
19
|
+
* view to dynamically modify its certain DOM attributes after {@link #render rendering}.
|
|
20
|
+
*
|
|
21
|
+
* **Note**: The DOM attributes are performed by the editing view and not UI
|
|
22
|
+
* {@link module:ui/view~View#bindTemplate template bindings} because once rendered,
|
|
23
|
+
* the editable DOM element must remain under the full control of the engine to work properly.
|
|
24
|
+
*/
|
|
25
|
+
_editingView;
|
|
26
|
+
/**
|
|
27
|
+
* The element which is the main editable element (usually the one with `contentEditable="true"`).
|
|
28
|
+
*/
|
|
29
|
+
_editableElement;
|
|
30
|
+
/**
|
|
31
|
+
* Whether an external {@link #_editableElement} was passed into the constructor, which also means
|
|
32
|
+
* the view will not render its {@link #template}.
|
|
33
|
+
*/
|
|
34
|
+
_hasExternalElement;
|
|
13
35
|
/**
|
|
14
36
|
* Creates an instance of EditableUIView class.
|
|
15
37
|
*
|
|
@@ -20,10 +42,6 @@ export default class EditableUIView extends View {
|
|
|
20
42
|
*/
|
|
21
43
|
constructor(locale, editingView, editableElement) {
|
|
22
44
|
super(locale);
|
|
23
|
-
/**
|
|
24
|
-
* The name of the editable UI view.
|
|
25
|
-
*/
|
|
26
|
-
this.name = null;
|
|
27
45
|
this.setTemplate({
|
|
28
46
|
tag: 'div',
|
|
29
47
|
attributes: {
|
|
@@ -10,6 +10,10 @@ import EditableUIView from '../editableuiview.js';
|
|
|
10
10
|
* The inline editable UI class implementing an inline {@link module:ui/editableui/editableuiview~EditableUIView}.
|
|
11
11
|
*/
|
|
12
12
|
export default class InlineEditableUIView extends EditableUIView {
|
|
13
|
+
/**
|
|
14
|
+
* The cached options object passed to the constructor.
|
|
15
|
+
*/
|
|
16
|
+
_options;
|
|
13
17
|
/**
|
|
14
18
|
* Creates an instance of the InlineEditableUIView class.
|
|
15
19
|
*
|