@ckeditor/ckeditor5-ui 35.2.1 → 35.3.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 +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/src/icon/iconview.js
CHANGED
|
@@ -2,127 +2,161 @@
|
|
|
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
|
/* global DOMParser */
|
|
7
|
-
|
|
8
6
|
/**
|
|
9
7
|
* @module ui/icon/iconview
|
|
10
8
|
*/
|
|
11
|
-
|
|
12
9
|
import View from '../view';
|
|
13
|
-
|
|
14
10
|
import '../../theme/components/icon/icon.css';
|
|
15
|
-
|
|
16
11
|
/**
|
|
17
12
|
* The icon view class.
|
|
18
13
|
*
|
|
19
14
|
* @extends module:ui/view~View
|
|
20
15
|
*/
|
|
21
16
|
export default class IconView extends View {
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
17
|
+
/**
|
|
18
|
+
* @inheritDoc
|
|
19
|
+
*/
|
|
20
|
+
constructor() {
|
|
21
|
+
super();
|
|
22
|
+
const bind = this.bindTemplate;
|
|
23
|
+
/**
|
|
24
|
+
* The SVG source of the icon.
|
|
25
|
+
*
|
|
26
|
+
* @observable
|
|
27
|
+
* @member {String} #content
|
|
28
|
+
*/
|
|
29
|
+
this.set('content', '');
|
|
30
|
+
/**
|
|
31
|
+
* This attribute specifies the boundaries to which the
|
|
32
|
+
* icon content should stretch.
|
|
33
|
+
*
|
|
34
|
+
* @observable
|
|
35
|
+
* @default '0 0 20 20'
|
|
36
|
+
* @member {String} #viewBox
|
|
37
|
+
*/
|
|
38
|
+
this.set('viewBox', '0 0 20 20');
|
|
39
|
+
/**
|
|
40
|
+
* The fill color of the child `path.ck-icon__fill`.
|
|
41
|
+
*
|
|
42
|
+
* @observable
|
|
43
|
+
* @default ''
|
|
44
|
+
* @member {String} #fillColor
|
|
45
|
+
*/
|
|
46
|
+
this.set('fillColor', '');
|
|
47
|
+
/**
|
|
48
|
+
* When set true (default), all parts of the icon inherit the fill color from the CSS `color` property of the
|
|
49
|
+
* icon's DOM parent.
|
|
50
|
+
*
|
|
51
|
+
* This effectively makes the icon monochromatic and allows it to change its fill color dynamically, for instance,
|
|
52
|
+
* when a {@link module:ui/button/buttonview~ButtonView} displays an icon and it switches between different states
|
|
53
|
+
* (pushed, hovered, etc.) the icon will follow along.
|
|
54
|
+
*
|
|
55
|
+
* **Note**: For the monochromatic icon to render properly, it must be made up of shapes that can be filled
|
|
56
|
+
* with color instead of, for instance, paths with strokes. Be sure to use the *outline stroke* tool
|
|
57
|
+
* (the name could be different in your vector graphics editor) before exporting your icon. Also, remove any
|
|
58
|
+
* excess `fill="..."` attributes that could break the color inheritance.
|
|
59
|
+
*
|
|
60
|
+
* **Note**: If you want to preserve the original look of your icon and disable dynamic color inheritance,
|
|
61
|
+
* set this flag to `false`.
|
|
62
|
+
*
|
|
63
|
+
* @observable
|
|
64
|
+
* @default true
|
|
65
|
+
* @member {Boolean} #isColorInherited
|
|
66
|
+
*/
|
|
67
|
+
this.set('isColorInherited', true);
|
|
68
|
+
this.setTemplate({
|
|
69
|
+
tag: 'svg',
|
|
70
|
+
ns: 'http://www.w3.org/2000/svg',
|
|
71
|
+
attributes: {
|
|
72
|
+
class: [
|
|
73
|
+
'ck',
|
|
74
|
+
'ck-icon',
|
|
75
|
+
// Exclude icon internals from the CSS reset to allow rich (non-monochromatic) icons
|
|
76
|
+
// (https://github.com/ckeditor/ckeditor5/issues/12599).
|
|
77
|
+
'ck-reset_all-excluded',
|
|
78
|
+
// The class to remove the dynamic color inheritance is toggleable
|
|
79
|
+
// (https://github.com/ckeditor/ckeditor5/issues/12599).
|
|
80
|
+
bind.if('isColorInherited', 'ck-icon_inherit-color')
|
|
81
|
+
],
|
|
82
|
+
viewBox: bind.to('viewBox')
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @inheritDoc
|
|
88
|
+
*/
|
|
89
|
+
render() {
|
|
90
|
+
super.render();
|
|
91
|
+
this._updateXMLContent();
|
|
92
|
+
this._colorFillPaths();
|
|
93
|
+
// This is a hack for lack of innerHTML binding.
|
|
94
|
+
// See: https://github.com/ckeditor/ckeditor5-ui/issues/99.
|
|
95
|
+
this.on('change:content', () => {
|
|
96
|
+
this._updateXMLContent();
|
|
97
|
+
this._colorFillPaths();
|
|
98
|
+
});
|
|
99
|
+
this.on('change:fillColor', () => {
|
|
100
|
+
this._colorFillPaths();
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Updates the {@link #element} with the value of {@link #content}.
|
|
105
|
+
*
|
|
106
|
+
* @private
|
|
107
|
+
*/
|
|
108
|
+
_updateXMLContent() {
|
|
109
|
+
if (this.content) {
|
|
110
|
+
const parsed = new DOMParser().parseFromString(this.content.trim(), 'image/svg+xml');
|
|
111
|
+
const svg = parsed.querySelector('svg');
|
|
112
|
+
const viewBox = svg.getAttribute('viewBox');
|
|
113
|
+
if (viewBox) {
|
|
114
|
+
this.viewBox = viewBox;
|
|
115
|
+
}
|
|
116
|
+
// Preserve presentational attributes of the <svg> element from the source.
|
|
117
|
+
// They can affect rendering of the entire icon (https://github.com/ckeditor/ckeditor5/issues/12597).
|
|
118
|
+
for (const { name, value } of Array.from(svg.attributes)) {
|
|
119
|
+
if (IconView.presentationalAttributeNames.includes(name)) {
|
|
120
|
+
this.element.setAttribute(name, value);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
while (this.element.firstChild) {
|
|
124
|
+
this.element.removeChild(this.element.firstChild);
|
|
125
|
+
}
|
|
126
|
+
while (svg.childNodes.length > 0) {
|
|
127
|
+
this.element.appendChild(svg.childNodes[0]);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Fills all child `path.ck-icon__fill` with the `#fillColor`.
|
|
133
|
+
*
|
|
134
|
+
* @private
|
|
135
|
+
*/
|
|
136
|
+
_colorFillPaths() {
|
|
137
|
+
if (this.fillColor) {
|
|
138
|
+
this.element.querySelectorAll('.ck-icon__fill').forEach(path => {
|
|
139
|
+
path.style.fill = this.fillColor;
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
128
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* A list of presentational attributes that can be set on the `<svg>` element and should be preserved
|
|
146
|
+
* when the icon {@link module:ui/icon/iconview~IconView#content content} is loaded.
|
|
147
|
+
*
|
|
148
|
+
* See the [specification](https://www.w3.org/TR/SVG/styling.html#TermPresentationAttribute) to learn more.
|
|
149
|
+
*
|
|
150
|
+
* @protected
|
|
151
|
+
* @member {Array.<String>} module:ui/icon/iconview~IconView.presentationalAttributeNames
|
|
152
|
+
*/
|
|
153
|
+
IconView.presentationalAttributeNames = [
|
|
154
|
+
'alignment-baseline', 'baseline-shift', 'clip-path', 'clip-rule', 'color', 'color-interpolation',
|
|
155
|
+
'color-interpolation-filters', 'color-rendering', 'cursor', 'direction', 'display', 'dominant-baseline', 'fill', 'fill-opacity',
|
|
156
|
+
'fill-rule', 'filter', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style',
|
|
157
|
+
'font-variant', 'font-weight', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start',
|
|
158
|
+
'mask', 'opacity', 'overflow', 'paint-order', 'pointer-events', 'shape-rendering', 'stop-color', 'stop-opacity', 'stroke',
|
|
159
|
+
'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width',
|
|
160
|
+
'text-anchor', 'text-decoration', 'text-overflow', 'text-rendering', 'transform', 'unicode-bidi', 'vector-effect',
|
|
161
|
+
'visibility', 'white-space', 'word-spacing', 'writing-mode'
|
|
162
|
+
];
|
package/src/iframe/iframeview.js
CHANGED
|
@@ -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/iframe/iframeview
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
import View from '../view';
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* The iframe view class.
|
|
14
11
|
*
|
|
@@ -26,50 +23,41 @@ import View from '../view';
|
|
|
26
23
|
* @extends module:ui/view~View
|
|
27
24
|
*/
|
|
28
25
|
export default class IframeView extends View {
|
|
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
|
-
super.render();
|
|
67
|
-
} );
|
|
68
|
-
}
|
|
26
|
+
/**
|
|
27
|
+
* Creates a new instance of the iframe view.
|
|
28
|
+
*
|
|
29
|
+
* @param {module:utils/locale~Locale} [locale] The locale instance.
|
|
30
|
+
*/
|
|
31
|
+
constructor(locale) {
|
|
32
|
+
super(locale);
|
|
33
|
+
const bind = this.bindTemplate;
|
|
34
|
+
this.setTemplate({
|
|
35
|
+
tag: 'iframe',
|
|
36
|
+
attributes: {
|
|
37
|
+
class: [
|
|
38
|
+
'ck',
|
|
39
|
+
'ck-reset_all'
|
|
40
|
+
],
|
|
41
|
+
// It seems that we need to allow scripts in order to be able to listen to events.
|
|
42
|
+
// TODO: Research that. Perhaps the src must be set?
|
|
43
|
+
sandbox: 'allow-same-origin allow-scripts'
|
|
44
|
+
},
|
|
45
|
+
on: {
|
|
46
|
+
load: bind.to('loaded')
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Renders the iframe's {@link #element} and returns a `Promise` for asynchronous
|
|
52
|
+
* child `contentDocument` loading process.
|
|
53
|
+
*
|
|
54
|
+
* @returns {Promise} A promise which resolves once the iframe `contentDocument` has
|
|
55
|
+
* been {@link #event:loaded}.
|
|
56
|
+
*/
|
|
57
|
+
render() {
|
|
58
|
+
return new Promise(resolve => {
|
|
59
|
+
this.on('loaded', resolve);
|
|
60
|
+
return super.render();
|
|
61
|
+
});
|
|
62
|
+
}
|
|
69
63
|
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Fired when the DOM iframe's `contentDocument` finished loading.
|
|
73
|
-
*
|
|
74
|
-
* @event loaded
|
|
75
|
-
*/
|
package/src/index.js
CHANGED
|
@@ -2,65 +2,48 @@
|
|
|
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
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
8
|
export { default as clickOutsideHandler } from './bindings/clickoutsidehandler';
|
|
11
9
|
export { default as injectCssTransitionDisabler } from './bindings/injectcsstransitiondisabler';
|
|
12
10
|
export { default as submitHandler } from './bindings/submithandler';
|
|
13
11
|
export { default as addKeyboardHandlingForGrid } from './bindings/addkeyboardhandlingforgrid';
|
|
14
|
-
|
|
15
12
|
export { default as BodyCollection } from './editorui/bodycollection';
|
|
16
|
-
|
|
17
13
|
export { default as ButtonView } from './button/buttonview';
|
|
18
14
|
export { default as SwitchButtonView } from './button/switchbuttonview';
|
|
19
|
-
|
|
20
15
|
export * from './colorgrid/utils';
|
|
21
16
|
export { default as ColorGridView } from './colorgrid/colorgridview';
|
|
22
17
|
export { default as ColorTileView } from './colorgrid/colortileview';
|
|
23
|
-
|
|
24
18
|
export { default as DropdownButtonView } from './dropdown/button/dropdownbuttonview';
|
|
25
19
|
export { default as SplitButtonView } from './dropdown/button/splitbuttonview';
|
|
26
20
|
export * from './dropdown/utils';
|
|
27
|
-
|
|
28
21
|
export { default as EditorUIView } from './editorui/editoruiview';
|
|
29
22
|
export { default as BoxedEditorUIView } from './editorui/boxed/boxededitoruiview';
|
|
30
23
|
export { default as InlineEditableUIView } from './editableui/inline/inlineeditableuiview';
|
|
31
|
-
|
|
32
24
|
export { default as FormHeaderView } from './formheader/formheaderview';
|
|
33
25
|
export { default as FocusCycler } from './focuscycler';
|
|
34
|
-
|
|
35
26
|
export { default as IconView } from './icon/iconview';
|
|
36
27
|
export { default as InputView } from './input/inputview';
|
|
37
28
|
export { default as InputTextView } from './inputtext/inputtextview';
|
|
38
29
|
export { default as InputNumberView } from './inputnumber/inputnumberview';
|
|
39
|
-
|
|
40
30
|
export { default as IframeView } from './iframe/iframeview';
|
|
41
|
-
|
|
42
31
|
export { default as LabelView } from './label/labelview';
|
|
43
32
|
export { default as LabeledFieldView } from './labeledfield/labeledfieldview';
|
|
44
33
|
export * from './labeledfield/utils';
|
|
45
|
-
|
|
46
34
|
export { default as ListItemView } from './list/listitemview';
|
|
47
35
|
export { default as ListView } from './list/listview';
|
|
48
|
-
|
|
49
36
|
export { default as Notification } from './notification/notification';
|
|
50
|
-
|
|
51
37
|
export { default as Model } from './model';
|
|
52
38
|
export { default as BalloonPanelView } from './panel/balloon/balloonpanelview';
|
|
53
39
|
export { default as ContextualBalloon } from './panel/balloon/contextualballoon';
|
|
54
40
|
export { default as StickyPanelView } from './panel/sticky/stickypanelview';
|
|
55
|
-
|
|
56
41
|
export { default as TooltipManager } from './tooltipmanager';
|
|
57
42
|
export { default as Template } from './template';
|
|
58
|
-
|
|
59
43
|
export { default as ToolbarView } from './toolbar/toolbarview';
|
|
60
44
|
export { default as ToolbarSeparatorView } from './toolbar/toolbarseparatorview';
|
|
61
45
|
export { default as normalizeToolbarConfig } from './toolbar/normalizetoolbarconfig';
|
|
62
46
|
export { default as BalloonToolbar } from './toolbar/balloon/balloontoolbar';
|
|
63
47
|
export { default as BlockToolbar } from './toolbar/block/blocktoolbar';
|
|
64
|
-
|
|
65
48
|
export { default as View } from './view';
|
|
66
49
|
export { default as ViewCollection } from './viewcollection';
|