@ckeditor/ckeditor5-ui 46.1.1-alpha.3 → 47.0.0-alpha.0
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/dist/index-editor.css +2 -0
- package/dist/index.css +2 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +37 -5
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
- package/src/autocomplete/autocompleteview.js +1 -2
- package/src/dialog/dialog.d.ts +8 -2
- package/src/dialog/dialogview.d.ts +8 -2
- package/src/dialog/dialogview.js +9 -2
- package/src/dropdown/dropdownview.js +1 -2
- package/src/dropdown/menu/dropdownmenunestedmenuview.js +1 -2
- package/src/dropdown/utils.d.ts +5 -0
- package/src/dropdown/utils.js +1 -1
- package/src/icon/iconview.js +1 -2
- package/src/menubar/menubarmenuview.js +1 -2
- package/src/panel/balloon/balloonpanelview.js +1 -2
- package/src/template.d.ts +5 -2
- package/src/template.js +39 -4
- package/src/tooltipmanager.js +1 -2
- package/theme/components/formheader/formheader.css +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-ui",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "47.0.0-alpha.0",
|
|
4
4
|
"description": "The UI framework and standard UI library of CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"type": "module",
|
|
18
18
|
"main": "src/index.js",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ckeditor/ckeditor5-core": "
|
|
21
|
-
"@ckeditor/ckeditor5-editor-multi-root": "
|
|
22
|
-
"@ckeditor/ckeditor5-engine": "
|
|
23
|
-
"@ckeditor/ckeditor5-icons": "
|
|
24
|
-
"@ckeditor/ckeditor5-utils": "
|
|
20
|
+
"@ckeditor/ckeditor5-core": "47.0.0-alpha.0",
|
|
21
|
+
"@ckeditor/ckeditor5-editor-multi-root": "47.0.0-alpha.0",
|
|
22
|
+
"@ckeditor/ckeditor5-engine": "47.0.0-alpha.0",
|
|
23
|
+
"@ckeditor/ckeditor5-icons": "47.0.0-alpha.0",
|
|
24
|
+
"@ckeditor/ckeditor5-utils": "47.0.0-alpha.0",
|
|
25
25
|
"@types/color-convert": "2.0.4",
|
|
26
26
|
"color-convert": "3.1.0",
|
|
27
27
|
"color-parse": "2.0.2",
|
|
@@ -13,7 +13,7 @@ import '../../theme/components/autocomplete/autocomplete.css';
|
|
|
13
13
|
* with a floating {@link #resultsView} that shows up when the user starts typing and hides when they blur
|
|
14
14
|
* the component.
|
|
15
15
|
*/
|
|
16
|
-
class AutocompleteView extends SearchTextView {
|
|
16
|
+
export class AutocompleteView extends SearchTextView {
|
|
17
17
|
/**
|
|
18
18
|
* The configuration of the autocomplete view.
|
|
19
19
|
*/
|
|
@@ -155,4 +155,3 @@ class AutocompleteView extends SearchTextView {
|
|
|
155
155
|
*/
|
|
156
156
|
static _getOptimalPosition = getOptimalPosition;
|
|
157
157
|
}
|
|
158
|
-
export { AutocompleteView };
|
package/src/dialog/dialog.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { type View } from '../view.js';
|
|
|
9
9
|
import { type Editor, Plugin } from '@ckeditor/ckeditor5-core';
|
|
10
10
|
import { DialogView, DialogViewPosition } from './dialogview.js';
|
|
11
11
|
import type { DialogActionButtonDefinition } from './dialogactionsview.js';
|
|
12
|
-
import type { KeystrokeHandlerOptions } from '@ckeditor/ckeditor5-utils';
|
|
12
|
+
import type { KeystrokeHandlerOptions, Rect } from '@ckeditor/ckeditor5-utils';
|
|
13
13
|
/**
|
|
14
14
|
* The dialog controller class. It is used to show and hide the {@link module:ui/dialog/dialogview~DialogView}.
|
|
15
15
|
*/
|
|
@@ -237,9 +237,15 @@ export interface DialogDefinition {
|
|
|
237
237
|
* Available dialog positions. By default `DialogViewPosition.EDITOR_CENTER` is used for {@link #isModal non-modals}
|
|
238
238
|
* and `DialogViewPosition.SCREEN_CENTER` for modals.
|
|
239
239
|
*
|
|
240
|
+
* If set to a function, it will be called with the DOM root Rect and the dialog Rect as arguments.
|
|
241
|
+
* It should return the coordinates of the dialog's position.
|
|
242
|
+
*
|
|
240
243
|
* {@link module:ui/dialog/dialogview#DialogViewPosition Learn more} about available positions.
|
|
241
244
|
*/
|
|
242
|
-
position?: typeof DialogViewPosition[keyof typeof DialogViewPosition]
|
|
245
|
+
position?: typeof DialogViewPosition[keyof typeof DialogViewPosition] | null | ((dialogRect: Rect, domRootRect?: Rect | null) => {
|
|
246
|
+
left: number;
|
|
247
|
+
top: number;
|
|
248
|
+
});
|
|
243
249
|
/**
|
|
244
250
|
* A callback called when the dialog shows up with a `low` priority. It allows for setting up the dialog's {@link #content}.
|
|
245
251
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @module ui/dialog/dialogview
|
|
7
7
|
*/
|
|
8
|
-
import { KeystrokeHandler, FocusTracker, type Locale, type DecoratedMethodEvent, type KeystrokeHandlerOptions } from '@ckeditor/ckeditor5-utils';
|
|
8
|
+
import { KeystrokeHandler, FocusTracker, Rect, type Locale, type DecoratedMethodEvent, type KeystrokeHandlerOptions } from '@ckeditor/ckeditor5-utils';
|
|
9
9
|
import { ViewCollection } from '../viewcollection.js';
|
|
10
10
|
import { View } from '../view.js';
|
|
11
11
|
import { FormHeaderView } from '../formheader/formheaderview.js';
|
|
@@ -103,9 +103,15 @@ export declare class DialogView extends /* #__PURE__ */ DialogView_base implemen
|
|
|
103
103
|
/**
|
|
104
104
|
* The position of the dialog view.
|
|
105
105
|
*
|
|
106
|
+
* If set to a function, it will be called with the DOM root Rect and the dialog Rect as arguments.
|
|
107
|
+
* It should return the coordinates of the dialog's position.
|
|
108
|
+
*
|
|
106
109
|
* @observable
|
|
107
110
|
*/
|
|
108
|
-
position: typeof DialogViewPosition[keyof typeof DialogViewPosition] | null
|
|
111
|
+
position: typeof DialogViewPosition[keyof typeof DialogViewPosition] | null | ((dialogRect: Rect, domRootRect?: Rect | null) => {
|
|
112
|
+
left: number;
|
|
113
|
+
top: number;
|
|
114
|
+
});
|
|
109
115
|
/**
|
|
110
116
|
* A flag indicating that the dialog should be shown. Once set to `true`, the dialog will be shown
|
|
111
117
|
* after its position is calculated. Until then, the dialog is transparent and not visible.
|
package/src/dialog/dialogview.js
CHANGED
|
@@ -45,7 +45,7 @@ const toPx = /* #__PURE__ */ toUnit('px');
|
|
|
45
45
|
/**
|
|
46
46
|
* A dialog view class.
|
|
47
47
|
*/
|
|
48
|
-
class DialogView extends /* #__PURE__ */ DraggableViewMixin(View) {
|
|
48
|
+
export class DialogView extends /* #__PURE__ */ DraggableViewMixin(View) {
|
|
49
49
|
/**
|
|
50
50
|
* A collection of the child views inside of the dialog.
|
|
51
51
|
* A dialog can have 3 optional parts: header, content, and actions.
|
|
@@ -337,6 +337,14 @@ class DialogView extends /* #__PURE__ */ DraggableViewMixin(View) {
|
|
|
337
337
|
}
|
|
338
338
|
const defaultOffset = DialogView.defaultOffset;
|
|
339
339
|
const dialogRect = this._getDialogRect();
|
|
340
|
+
if (this.position == null) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
else if (typeof this.position == 'function') {
|
|
344
|
+
const coords = this.position(dialogRect, domRootRect);
|
|
345
|
+
this._moveTo(coords.left, coords.top);
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
340
348
|
// @if CK_DEBUG_DIALOG // RectDrawer.clear();
|
|
341
349
|
// @if CK_DEBUG_DIALOG // RectDrawer.draw( viewportRect, { outlineColor: 'blue' }, 'Viewport' );
|
|
342
350
|
switch (configuredPosition) {
|
|
@@ -509,4 +517,3 @@ class DialogView extends /* #__PURE__ */ DraggableViewMixin(View) {
|
|
|
509
517
|
return buttonView;
|
|
510
518
|
}
|
|
511
519
|
}
|
|
512
|
-
export { DialogView };
|
|
@@ -60,7 +60,7 @@ import '../../theme/components/dropdown/dropdown.css';
|
|
|
60
60
|
* (which should close it) and support for arrow keys inside the panel. Therefore, unless you really know what
|
|
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
|
-
class DropdownView extends View {
|
|
63
|
+
export class DropdownView extends View {
|
|
64
64
|
/**
|
|
65
65
|
* Button of the dropdown view. Clicking the button opens the {@link #panelView}.
|
|
66
66
|
*/
|
|
@@ -436,4 +436,3 @@ class DropdownView extends View {
|
|
|
436
436
|
*/
|
|
437
437
|
static _getOptimalPosition = getOptimalPosition;
|
|
438
438
|
}
|
|
439
|
-
export { DropdownView };
|
|
@@ -16,7 +16,7 @@ import '../../../theme/components/dropdown/menu/dropdownmenu.css';
|
|
|
16
16
|
/**
|
|
17
17
|
* Represents a nested menu view.
|
|
18
18
|
*/
|
|
19
|
-
class DropdownMenuNestedMenuView extends View {
|
|
19
|
+
export class DropdownMenuNestedMenuView extends View {
|
|
20
20
|
/**
|
|
21
21
|
* An array of delegated events for the dropdown menu definition controller.
|
|
22
22
|
* These events are delegated to the dropdown menu element.
|
|
@@ -212,4 +212,3 @@ class DropdownMenuNestedMenuView extends View {
|
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
|
-
export { DropdownMenuNestedMenuView };
|
package/src/dropdown/utils.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ import { type Collection, type Locale } from '@ckeditor/ckeditor5-utils';
|
|
|
14
14
|
import '../../theme/components/dropdown/toolbardropdown.css';
|
|
15
15
|
import '../../theme/components/dropdown/listdropdown.css';
|
|
16
16
|
import type { DropdownMenuDefinition } from './menu/utils.js';
|
|
17
|
+
import type { ButtonLabelView } from '../button/buttonlabelview.js';
|
|
17
18
|
/**
|
|
18
19
|
* A helper for creating dropdowns. It creates an instance of a {@link module:ui/dropdown/dropdownview~DropdownView dropdown},
|
|
19
20
|
* with a {@link module:ui/dropdown/button/dropdownbutton~DropdownButton button},
|
|
@@ -274,6 +275,10 @@ export type ListDropdownButtonDefinition = {
|
|
|
274
275
|
* Model of the item. Its properties fuel the newly created list item (or its children, depending on the `type`).
|
|
275
276
|
*/
|
|
276
277
|
model: UIModel;
|
|
278
|
+
/**
|
|
279
|
+
* A view that will be used as a button body in the list item.
|
|
280
|
+
*/
|
|
281
|
+
labelView?: ButtonLabelView;
|
|
277
282
|
};
|
|
278
283
|
/**
|
|
279
284
|
* A definition of the group inside the list. A group can contain one or more list items (buttons).
|
package/src/dropdown/utils.js
CHANGED
|
@@ -540,7 +540,7 @@ function bindViewCollectionItemsToDefinitions(dropdownView, listItems, definitio
|
|
|
540
540
|
const listItemView = new ListItemView(locale);
|
|
541
541
|
let buttonView;
|
|
542
542
|
if (def.type === 'button') {
|
|
543
|
-
buttonView = new ListItemButtonView(locale);
|
|
543
|
+
buttonView = new ListItemButtonView(locale, def.labelView);
|
|
544
544
|
buttonView.set({
|
|
545
545
|
isToggleable
|
|
546
546
|
});
|
package/src/icon/iconview.js
CHANGED
|
@@ -11,7 +11,7 @@ import '../../theme/components/icon/icon.css';
|
|
|
11
11
|
/**
|
|
12
12
|
* The icon view class.
|
|
13
13
|
*/
|
|
14
|
-
class IconView extends View {
|
|
14
|
+
export class IconView extends View {
|
|
15
15
|
/**
|
|
16
16
|
* A list of presentational attributes that can be set on the `<svg>` element and should be preserved
|
|
17
17
|
* when the icon {@link module:ui/icon/iconview~IconView#content content} is loaded.
|
|
@@ -121,4 +121,3 @@ class IconView extends View {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
export { IconView };
|
|
@@ -15,7 +15,7 @@ import '../../theme/components/menubar/menubarmenu.css';
|
|
|
15
15
|
* A menu view for the {@link module:ui/menubar/menubarview~MenuBarView}. Menus are building blocks of the menu bar,
|
|
16
16
|
* they host other sub-menus and menu items (buttons) that users can interact with.
|
|
17
17
|
*/
|
|
18
|
-
class MenuBarMenuView extends View {
|
|
18
|
+
export class MenuBarMenuView extends View {
|
|
19
19
|
/**
|
|
20
20
|
* Button of the menu view.
|
|
21
21
|
*/
|
|
@@ -196,4 +196,3 @@ class MenuBarMenuView extends View {
|
|
|
196
196
|
*/
|
|
197
197
|
static _getOptimalPosition = getOptimalPosition;
|
|
198
198
|
}
|
|
199
|
-
export { MenuBarMenuView };
|
|
@@ -65,7 +65,7 @@ const POSITION_OFF_SCREEN = {
|
|
|
65
65
|
* } );
|
|
66
66
|
* ```
|
|
67
67
|
*/
|
|
68
|
-
class BalloonPanelView extends View {
|
|
68
|
+
export class BalloonPanelView extends View {
|
|
69
69
|
/**
|
|
70
70
|
* A collection of the child views that creates the balloon panel contents.
|
|
71
71
|
*/
|
|
@@ -1059,7 +1059,6 @@ class BalloonPanelView extends View {
|
|
|
1059
1059
|
*/
|
|
1060
1060
|
static defaultPositions = /* #__PURE__ */ BalloonPanelView.generatePositions();
|
|
1061
1061
|
}
|
|
1062
|
-
export { BalloonPanelView };
|
|
1063
1062
|
/**
|
|
1064
1063
|
* Returns the DOM element for given object or null, if there is none,
|
|
1065
1064
|
* e.g. when the passed object is a Rect instance or so.
|
package/src/template.d.ts
CHANGED
|
@@ -320,7 +320,8 @@ export declare class Template extends /* #__PURE__ */ Template_base {
|
|
|
320
320
|
* ```ts
|
|
321
321
|
* attributes: {
|
|
322
322
|
* style: {
|
|
323
|
-
* color: 'red'
|
|
323
|
+
* color: 'red',
|
|
324
|
+
* '--color': 'red'
|
|
324
325
|
* }
|
|
325
326
|
* }
|
|
326
327
|
* ```
|
|
@@ -330,7 +331,8 @@ export declare class Template extends /* #__PURE__ */ Template_base {
|
|
|
330
331
|
* ```ts
|
|
331
332
|
* attributes: {
|
|
332
333
|
* style: {
|
|
333
|
-
* color: bind.to( ... )
|
|
334
|
+
* color: bind.to( ... ),
|
|
335
|
+
* '--color': bind.to( ... )
|
|
334
336
|
* }
|
|
335
337
|
* }
|
|
336
338
|
* ```
|
|
@@ -654,6 +656,7 @@ export type TemplateSimpleValueSchema = TemplateSimpleValue | AttributeBinding;
|
|
|
654
656
|
* // An object schema, specific for styles.
|
|
655
657
|
* style: {
|
|
656
658
|
* color: 'red',
|
|
659
|
+
* '--color': 'red',
|
|
657
660
|
* backgroundColor: bind.to( 'qux', () => { ... } )
|
|
658
661
|
* }
|
|
659
662
|
* }
|
package/src/template.js
CHANGED
|
@@ -568,7 +568,8 @@ export class Template extends /* #__PURE__ */ EmitterMixin() {
|
|
|
568
568
|
* ```ts
|
|
569
569
|
* attributes: {
|
|
570
570
|
* style: {
|
|
571
|
-
* color: 'red'
|
|
571
|
+
* color: 'red',
|
|
572
|
+
* '--color': 'red'
|
|
572
573
|
* }
|
|
573
574
|
* }
|
|
574
575
|
* ```
|
|
@@ -578,7 +579,8 @@ export class Template extends /* #__PURE__ */ EmitterMixin() {
|
|
|
578
579
|
* ```ts
|
|
579
580
|
* attributes: {
|
|
580
581
|
* style: {
|
|
581
|
-
* color: bind.to( ... )
|
|
582
|
+
* color: bind.to( ... ),
|
|
583
|
+
* '--color': bind.to( ... )
|
|
582
584
|
* }
|
|
583
585
|
* }
|
|
584
586
|
* ```
|
|
@@ -609,6 +611,15 @@ export class Template extends /* #__PURE__ */ EmitterMixin() {
|
|
|
609
611
|
// Cases:
|
|
610
612
|
//
|
|
611
613
|
// style: {
|
|
614
|
+
// --color: 'red'
|
|
615
|
+
// }
|
|
616
|
+
//
|
|
617
|
+
else if (isCssVariable(styleName)) {
|
|
618
|
+
node.style.setProperty(styleName, styleValue);
|
|
619
|
+
}
|
|
620
|
+
// Cases:
|
|
621
|
+
//
|
|
622
|
+
// style: {
|
|
612
623
|
// color: 'red'
|
|
613
624
|
// }
|
|
614
625
|
//
|
|
@@ -925,6 +936,20 @@ function hasTemplateBinding(schema) {
|
|
|
925
936
|
}
|
|
926
937
|
return false;
|
|
927
938
|
}
|
|
939
|
+
/**
|
|
940
|
+
* Checks whether the given name is a valid CSS variable name.
|
|
941
|
+
*
|
|
942
|
+
* A valid CSS variable name starts with two dashes (`--`), followed by a letter, underscore (`_`),
|
|
943
|
+
* or dash (`-`), and can be followed by any combination of letters, digits, underscores, dashes,
|
|
944
|
+
* or additional dashes.
|
|
945
|
+
*
|
|
946
|
+
* @param name The name to validate as a CSS variable.
|
|
947
|
+
* @returns True if the name is a valid CSS variable, false otherwise.
|
|
948
|
+
*/
|
|
949
|
+
function isCssVariable(name) {
|
|
950
|
+
const regex = /^--[a-zA-Z_-][\w-]*$/;
|
|
951
|
+
return regex.test(name);
|
|
952
|
+
}
|
|
928
953
|
/**
|
|
929
954
|
* Assembles the value using {@link module:ui/template~TemplateValueSchema} and stores it in a form of
|
|
930
955
|
* an Array. Each entry of the Array corresponds to one of {@link module:ui/template~TemplateValueSchema}
|
|
@@ -1016,10 +1041,20 @@ function getAttributeUpdater(el, attrName, ns) {
|
|
|
1016
1041
|
function getStyleUpdater(el, styleName) {
|
|
1017
1042
|
return {
|
|
1018
1043
|
set(value) {
|
|
1019
|
-
|
|
1044
|
+
if (isCssVariable(styleName)) {
|
|
1045
|
+
el.style.setProperty(styleName, value);
|
|
1046
|
+
}
|
|
1047
|
+
else {
|
|
1048
|
+
el.style[styleName] = value;
|
|
1049
|
+
}
|
|
1020
1050
|
},
|
|
1021
1051
|
remove() {
|
|
1022
|
-
|
|
1052
|
+
if (isCssVariable(styleName)) {
|
|
1053
|
+
el.style.removeProperty(styleName);
|
|
1054
|
+
}
|
|
1055
|
+
else {
|
|
1056
|
+
el.style[styleName] = null;
|
|
1057
|
+
}
|
|
1023
1058
|
}
|
|
1024
1059
|
};
|
|
1025
1060
|
}
|
package/src/tooltipmanager.js
CHANGED
|
@@ -73,7 +73,7 @@ const BALLOON_CLASS = 'ck-tooltip';
|
|
|
73
73
|
* **Note**: This class is a singleton. All editor instances re-use the same instance loaded by
|
|
74
74
|
* {@link module:ui/editorui/editorui~EditorUI} of the first editor.
|
|
75
75
|
*/
|
|
76
|
-
class TooltipManager extends /* #__PURE__ */ DomEmitterMixin() {
|
|
76
|
+
export class TooltipManager extends /* #__PURE__ */ DomEmitterMixin() {
|
|
77
77
|
/**
|
|
78
78
|
* The view rendering text of the tooltip.
|
|
79
79
|
*/
|
|
@@ -421,7 +421,6 @@ class TooltipManager extends /* #__PURE__ */ DomEmitterMixin() {
|
|
|
421
421
|
});
|
|
422
422
|
}
|
|
423
423
|
}
|
|
424
|
-
export { TooltipManager };
|
|
425
424
|
function getDescendantWithTooltip(element) {
|
|
426
425
|
if (!isElement(element)) {
|
|
427
426
|
return null;
|