@ckeditor/ckeditor5-ui 35.2.0 → 35.3.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/package.json +31 -23
- package/src/bindings/addkeyboardhandlingforgrid.js +45 -57
- package/src/bindings/clickoutsidehandler.js +15 -21
- package/src/bindings/injectcsstransitiondisabler.js +16 -20
- package/src/bindings/preventdefault.js +6 -8
- package/src/bindings/submithandler.js +5 -7
- package/src/button/button.js +5 -0
- package/src/button/buttonview.js +220 -259
- package/src/button/switchbuttonview.js +56 -71
- package/src/colorgrid/colorgridview.js +135 -197
- package/src/colorgrid/colortileview.js +37 -47
- package/src/colorgrid/utils.js +57 -66
- package/src/componentfactory.js +79 -93
- package/src/dropdown/button/dropdownbutton.js +5 -0
- package/src/dropdown/button/dropdownbuttonview.js +44 -57
- package/src/dropdown/button/splitbuttonview.js +159 -207
- package/src/dropdown/dropdownpanelfocusable.js +5 -0
- package/src/dropdown/dropdownpanelview.js +101 -112
- package/src/dropdown/dropdownview.js +396 -438
- package/src/dropdown/utils.js +164 -213
- package/src/editableui/editableuiview.js +125 -141
- package/src/editableui/inline/inlineeditableuiview.js +44 -54
- package/src/editorui/bodycollection.js +61 -75
- package/src/editorui/boxed/boxededitoruiview.js +91 -104
- package/src/editorui/editoruiview.js +30 -39
- package/src/focuscycler.js +214 -245
- package/src/formheader/formheaderview.js +58 -70
- package/src/icon/iconview.js +145 -111
- package/src/iframe/iframeview.js +37 -49
- package/src/index.js +0 -17
- package/src/input/inputview.js +170 -198
- package/src/inputnumber/inputnumberview.js +48 -56
- package/src/inputtext/inputtextview.js +14 -18
- package/src/label/labelview.js +44 -53
- package/src/labeledfield/labeledfieldview.js +212 -235
- package/src/labeledfield/utils.js +39 -57
- package/src/labeledinput/labeledinputview.js +190 -221
- package/src/list/listitemview.js +40 -50
- package/src/list/listseparatorview.js +15 -19
- package/src/list/listview.js +94 -115
- package/src/model.js +19 -25
- package/src/notification/notification.js +151 -202
- package/src/panel/balloon/balloonpanelview.js +535 -628
- package/src/panel/balloon/contextualballoon.js +611 -732
- package/src/panel/sticky/stickypanelview.js +238 -270
- package/src/template.js +1049 -1479
- package/src/toolbar/balloon/balloontoolbar.js +337 -424
- package/src/toolbar/block/blockbuttonview.js +32 -42
- package/src/toolbar/block/blocktoolbar.js +375 -477
- package/src/toolbar/normalizetoolbarconfig.js +17 -21
- package/src/toolbar/toolbarlinebreakview.js +15 -19
- package/src/toolbar/toolbarseparatorview.js +15 -19
- package/src/toolbar/toolbarview.js +866 -1053
- package/src/tooltipmanager.js +324 -353
- package/src/view.js +389 -430
- package/src/viewcollection.js +147 -178
- package/src/button/button.jsdoc +0 -165
- package/src/dropdown/button/dropdownbutton.jsdoc +0 -22
- package/src/dropdown/dropdownpanelfocusable.jsdoc +0 -27
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-ui",
|
|
3
|
-
"version": "35.
|
|
3
|
+
"version": "35.3.0",
|
|
4
4
|
"description": "The UI framework and standard UI library of CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -11,29 +11,32 @@
|
|
|
11
11
|
],
|
|
12
12
|
"main": "src/index.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@ckeditor/ckeditor5-utils": "^35.
|
|
15
|
-
"@ckeditor/ckeditor5-core": "^35.
|
|
14
|
+
"@ckeditor/ckeditor5-utils": "^35.3.0",
|
|
15
|
+
"@ckeditor/ckeditor5-core": "^35.3.0",
|
|
16
16
|
"lodash-es": "^4.17.15"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@ckeditor/ckeditor5-basic-styles": "^35.
|
|
20
|
-
"@ckeditor/ckeditor5-block-quote": "^35.
|
|
21
|
-
"@ckeditor/ckeditor5-editor-balloon": "^35.
|
|
22
|
-
"@ckeditor/ckeditor5-editor-classic": "^35.
|
|
23
|
-
"@ckeditor/ckeditor5-engine": "^35.
|
|
24
|
-
"@ckeditor/ckeditor5-enter": "^35.
|
|
25
|
-
"@ckeditor/ckeditor5-essentials": "^35.
|
|
26
|
-
"@ckeditor/ckeditor5-font": "^35.
|
|
27
|
-
"@ckeditor/ckeditor5-find-and-replace": "^35.
|
|
28
|
-
"@ckeditor/ckeditor5-heading": "^35.
|
|
29
|
-
"@ckeditor/ckeditor5-image": "^35.
|
|
30
|
-
"@ckeditor/ckeditor5-link": "^35.
|
|
31
|
-
"@ckeditor/ckeditor5-list": "^35.
|
|
32
|
-
"@ckeditor/ckeditor5-mention": "^35.
|
|
33
|
-
"@ckeditor/ckeditor5-paragraph": "^35.
|
|
34
|
-
"@ckeditor/ckeditor5-horizontal-line": "^35.
|
|
35
|
-
"@ckeditor/ckeditor5-table": "^35.
|
|
36
|
-
"@ckeditor/ckeditor5-typing": "^35.
|
|
19
|
+
"@ckeditor/ckeditor5-basic-styles": "^35.3.0",
|
|
20
|
+
"@ckeditor/ckeditor5-block-quote": "^35.3.0",
|
|
21
|
+
"@ckeditor/ckeditor5-editor-balloon": "^35.3.0",
|
|
22
|
+
"@ckeditor/ckeditor5-editor-classic": "^35.3.0",
|
|
23
|
+
"@ckeditor/ckeditor5-engine": "^35.3.0",
|
|
24
|
+
"@ckeditor/ckeditor5-enter": "^35.3.0",
|
|
25
|
+
"@ckeditor/ckeditor5-essentials": "^35.3.0",
|
|
26
|
+
"@ckeditor/ckeditor5-font": "^35.3.0",
|
|
27
|
+
"@ckeditor/ckeditor5-find-and-replace": "^35.3.0",
|
|
28
|
+
"@ckeditor/ckeditor5-heading": "^35.3.0",
|
|
29
|
+
"@ckeditor/ckeditor5-image": "^35.3.0",
|
|
30
|
+
"@ckeditor/ckeditor5-link": "^35.3.0",
|
|
31
|
+
"@ckeditor/ckeditor5-list": "^35.3.0",
|
|
32
|
+
"@ckeditor/ckeditor5-mention": "^35.3.0",
|
|
33
|
+
"@ckeditor/ckeditor5-paragraph": "^35.3.0",
|
|
34
|
+
"@ckeditor/ckeditor5-horizontal-line": "^35.3.0",
|
|
35
|
+
"@ckeditor/ckeditor5-table": "^35.3.0",
|
|
36
|
+
"@ckeditor/ckeditor5-typing": "^35.3.0",
|
|
37
|
+
"typescript": "^4.8.4",
|
|
38
|
+
"webpack": "^5.58.1",
|
|
39
|
+
"webpack-cli": "^4.9.0"
|
|
37
40
|
},
|
|
38
41
|
"engines": {
|
|
39
42
|
"node": ">=14.0.0",
|
|
@@ -50,9 +53,14 @@
|
|
|
50
53
|
},
|
|
51
54
|
"files": [
|
|
52
55
|
"lang",
|
|
53
|
-
"src",
|
|
56
|
+
"src/**/*.js",
|
|
57
|
+
"src/**/*.d.ts",
|
|
54
58
|
"theme",
|
|
55
59
|
"ckeditor5-metadata.json",
|
|
56
60
|
"CHANGELOG.md"
|
|
57
|
-
]
|
|
61
|
+
],
|
|
62
|
+
"scripts": {
|
|
63
|
+
"build": "tsc -p ./tsconfig.release.json",
|
|
64
|
+
"postversion": "npm run build"
|
|
65
|
+
}
|
|
58
66
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module ui/bindings/addkeyboardhandlingforgrid
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* A helper that adds a keyboard navigation support (arrow up/down/left/right) for grids.
|
|
12
10
|
*
|
|
@@ -18,59 +16,49 @@
|
|
|
18
16
|
* @param {Number|Function} options.numberOfColumns Number of columns in the grid. Can be specified as a function that returns
|
|
19
17
|
* the number (e.g. for responsive grids).
|
|
20
18
|
*/
|
|
21
|
-
export default function addKeyboardHandlingForGrid(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
const focusedElement = gridItems.find( item => item.element === focusTracker.focusedElement );
|
|
67
|
-
const focusedElementIndex = gridItems.getIndex( focusedElement );
|
|
68
|
-
const nextIndexToFocus = getIndexToFocus( focusedElementIndex, gridItems );
|
|
69
|
-
|
|
70
|
-
gridItems.get( nextIndexToFocus ).focus();
|
|
71
|
-
|
|
72
|
-
evt.stopPropagation();
|
|
73
|
-
evt.preventDefault();
|
|
74
|
-
};
|
|
75
|
-
}
|
|
19
|
+
export default function addKeyboardHandlingForGrid({ keystrokeHandler, focusTracker, gridItems, numberOfColumns }) {
|
|
20
|
+
const getNumberOfColumns = typeof numberOfColumns === 'number' ? () => numberOfColumns : numberOfColumns;
|
|
21
|
+
keystrokeHandler.set('arrowright', getGridItemFocuser((focusedElementIndex, gridItems) => {
|
|
22
|
+
if (focusedElementIndex === gridItems.length - 1) {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
return focusedElementIndex + 1;
|
|
27
|
+
}
|
|
28
|
+
}));
|
|
29
|
+
keystrokeHandler.set('arrowleft', getGridItemFocuser((focusedElementIndex, gridItems) => {
|
|
30
|
+
if (focusedElementIndex === 0) {
|
|
31
|
+
return gridItems.length - 1;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
return focusedElementIndex - 1;
|
|
35
|
+
}
|
|
36
|
+
}));
|
|
37
|
+
keystrokeHandler.set('arrowup', getGridItemFocuser((focusedElementIndex, gridItems) => {
|
|
38
|
+
let nextIndex = focusedElementIndex - getNumberOfColumns();
|
|
39
|
+
if (nextIndex < 0) {
|
|
40
|
+
nextIndex = focusedElementIndex + getNumberOfColumns() * Math.floor(gridItems.length / getNumberOfColumns());
|
|
41
|
+
if (nextIndex > gridItems.length - 1) {
|
|
42
|
+
nextIndex -= getNumberOfColumns();
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return nextIndex;
|
|
46
|
+
}));
|
|
47
|
+
keystrokeHandler.set('arrowdown', getGridItemFocuser((focusedElementIndex, gridItems) => {
|
|
48
|
+
let nextIndex = focusedElementIndex + getNumberOfColumns();
|
|
49
|
+
if (nextIndex > gridItems.length - 1) {
|
|
50
|
+
nextIndex = focusedElementIndex % getNumberOfColumns();
|
|
51
|
+
}
|
|
52
|
+
return nextIndex;
|
|
53
|
+
}));
|
|
54
|
+
function getGridItemFocuser(getIndexToFocus) {
|
|
55
|
+
return (evt) => {
|
|
56
|
+
const focusedElement = gridItems.find(item => item.element === focusTracker.focusedElement);
|
|
57
|
+
const focusedElementIndex = gridItems.getIndex(focusedElement);
|
|
58
|
+
const nextIndexToFocus = getIndexToFocus(focusedElementIndex, gridItems);
|
|
59
|
+
gridItems.get(nextIndexToFocus).focus();
|
|
60
|
+
evt.stopPropagation();
|
|
61
|
+
evt.preventDefault();
|
|
62
|
+
};
|
|
63
|
+
}
|
|
76
64
|
}
|
|
@@ -2,13 +2,10 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module ui/bindings/clickoutsidehandler
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
/* global document */
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* Handles clicking **outside** of a specified set of elements, then fires an action.
|
|
14
11
|
*
|
|
@@ -24,22 +21,19 @@
|
|
|
24
21
|
* handler. Clicking any of them or their descendants will **not** fire the callback.
|
|
25
22
|
* @param {Function} options.callback An action executed by the handler.
|
|
26
23
|
*/
|
|
27
|
-
export default function clickOutsideHandler(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
callback();
|
|
44
|
-
} );
|
|
24
|
+
export default function clickOutsideHandler({ emitter, activator, callback, contextElements }) {
|
|
25
|
+
emitter.listenTo(document, 'mousedown', (evt, domEvt) => {
|
|
26
|
+
if (!activator()) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
// Check if `composedPath` is `undefined` in case the browser does not support native shadow DOM.
|
|
30
|
+
// Can be removed when all supported browsers support native shadow DOM.
|
|
31
|
+
const path = typeof domEvt.composedPath == 'function' ? domEvt.composedPath() : [];
|
|
32
|
+
for (const contextElement of contextElements) {
|
|
33
|
+
if (contextElement.contains(domEvt.target) || path.includes(contextElement)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
callback();
|
|
38
|
+
});
|
|
45
39
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module ui/bindings/injectcsstransitiondisabler
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* A decorator that brings the possibility to temporarily disable CSS transitions using
|
|
12
10
|
* {@link module:ui/view~View} methods. It is helpful when, for instance, the transitions should not happen
|
|
@@ -51,22 +49,20 @@
|
|
|
51
49
|
*
|
|
52
50
|
* @param {module:ui/view~View} view View instance that should get this functionality.
|
|
53
51
|
*/
|
|
54
|
-
export default function injectCssTransitionDisabler(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
} );
|
|
52
|
+
export default function injectCssTransitionDisabler(view) {
|
|
53
|
+
const decorated = view;
|
|
54
|
+
decorated.set('_isCssTransitionsDisabled', false);
|
|
55
|
+
decorated.disableCssTransitions = () => {
|
|
56
|
+
decorated._isCssTransitionsDisabled = true;
|
|
57
|
+
};
|
|
58
|
+
decorated.enableCssTransitions = () => {
|
|
59
|
+
decorated._isCssTransitionsDisabled = false;
|
|
60
|
+
};
|
|
61
|
+
decorated.extendTemplate({
|
|
62
|
+
attributes: {
|
|
63
|
+
class: [
|
|
64
|
+
decorated.bindTemplate.if('_isCssTransitionsDisabled', 'ck-transitions-disabled')
|
|
65
|
+
]
|
|
66
|
+
}
|
|
67
|
+
});
|
|
72
68
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module ui/bindings/preventdefault
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* A helper which executes a native `Event.preventDefault()` if the target of an event equals the
|
|
12
10
|
* {@link module:ui/view~View#element element of the view}. It shortens the definition of a
|
|
@@ -29,10 +27,10 @@
|
|
|
29
27
|
* @param {module:ui/view~View} view View instance that defines the template.
|
|
30
28
|
* @returns {module:ui/template~TemplateToBinding}
|
|
31
29
|
*/
|
|
32
|
-
export default function preventDefault(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
export default function preventDefault(view) {
|
|
31
|
+
return view.bindTemplate.to(evt => {
|
|
32
|
+
if (evt.target === view.element) {
|
|
33
|
+
evt.preventDefault();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
38
36
|
}
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
/**
|
|
7
6
|
* @module ui/bindings/submithandler
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* A handler useful for {@link module:ui/view~View views} working as HTML forms. It intercepts a native DOM
|
|
12
10
|
* `submit` event, prevents the default web browser behavior (navigation and page reload) and
|
|
@@ -42,9 +40,9 @@
|
|
|
42
40
|
* @param {Object} [options] Configuration options.
|
|
43
41
|
* @param {module:ui/view~View} options.view The view which DOM `submit` events should be handled.
|
|
44
42
|
*/
|
|
45
|
-
export default function submitHandler(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
43
|
+
export default function submitHandler({ view }) {
|
|
44
|
+
view.listenTo(view.element, 'submit', (evt, domEvt) => {
|
|
45
|
+
domEvt.preventDefault();
|
|
46
|
+
view.fire('submit');
|
|
47
|
+
}, { useCapture: true });
|
|
50
48
|
}
|