@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.
Files changed (107) hide show
  1. package/LICENSE.md +1 -1
  2. package/ckeditor5-metadata.json +1 -1
  3. package/dist/index-editor.css +28 -0
  4. package/dist/index.css +33 -0
  5. package/dist/index.css.map +1 -1
  6. package/dist/index.js +196 -74
  7. package/dist/index.js.map +1 -1
  8. package/dist/translations/be.d.ts +8 -0
  9. package/dist/translations/be.js +5 -0
  10. package/dist/translations/be.umd.js +11 -0
  11. package/lang/translations/be.po +208 -0
  12. package/package.json +12 -6
  13. package/src/arialiveannouncer.js +24 -0
  14. package/src/autocomplete/autocompleteview.js +29 -25
  15. package/src/badge/badge.js +23 -15
  16. package/src/bindings/draggableviewmixin.js +12 -12
  17. package/src/button/buttonview.js +35 -5
  18. package/src/button/filedialogbuttonview.js +11 -1
  19. package/src/button/listitembuttonview.js +14 -10
  20. package/src/button/switchbuttonview.js +4 -0
  21. package/src/collapsible/collapsibleview.d.ts +1 -4
  22. package/src/collapsible/collapsibleview.js +13 -2
  23. package/src/colorgrid/colorgridview.js +18 -2
  24. package/src/colorgrid/colortileview.d.ts +1 -4
  25. package/src/colorgrid/colortileview.js +3 -3
  26. package/src/colorpicker/colorpickerview.js +28 -1
  27. package/src/colorselector/colorgridsfragmentview.js +80 -4
  28. package/src/colorselector/colorpickerfragmentview.js +44 -3
  29. package/src/colorselector/colorselectorview.js +36 -0
  30. package/src/componentfactory.js +8 -4
  31. package/src/dialog/dialog.js +18 -0
  32. package/src/dialog/dialogactionsview.js +20 -0
  33. package/src/dialog/dialogcontentview.js +4 -0
  34. package/src/dialog/dialogview.d.ts +1 -1
  35. package/src/dialog/dialogview.js +56 -11
  36. package/src/dropdown/button/dropdownbuttonview.d.ts +0 -3
  37. package/src/dropdown/button/dropdownbuttonview.js +6 -2
  38. package/src/dropdown/button/splitbuttonview.d.ts +1 -4
  39. package/src/dropdown/button/splitbuttonview.js +27 -3
  40. package/src/dropdown/dropdownpanelview.js +8 -0
  41. package/src/dropdown/dropdownview.js +235 -184
  42. package/src/dropdown/menu/dropdownmenubuttonview.d.ts +0 -3
  43. package/src/dropdown/menu/dropdownmenubuttonview.js +6 -2
  44. package/src/dropdown/menu/dropdownmenulistitembuttonview.js +1 -0
  45. package/src/dropdown/menu/dropdownmenulistitemview.js +4 -0
  46. package/src/dropdown/menu/dropdownmenunestedmenuview.js +31 -8
  47. package/src/dropdown/menu/dropdownmenurootlistview.js +16 -8
  48. package/src/editableui/editableuiview.js +22 -4
  49. package/src/editableui/inline/inlineeditableuiview.js +4 -0
  50. package/src/editorui/accessibilityhelp/accessibilityhelp.js +8 -11
  51. package/src/editorui/bodycollection.js +13 -0
  52. package/src/editorui/boxed/boxededitoruiview.js +14 -0
  53. package/src/editorui/editorui.d.ts +1 -1
  54. package/src/editorui/editorui.js +56 -25
  55. package/src/editorui/editoruiview.d.ts +15 -1
  56. package/src/editorui/editoruiview.js +22 -0
  57. package/src/editorui/evaluationbadge.js +5 -5
  58. package/src/editorui/poweredby.d.ts +1 -4
  59. package/src/editorui/poweredby.js +5 -2
  60. package/src/focuscycler.js +31 -0
  61. package/src/formheader/formheaderview.js +8 -0
  62. package/src/formrow/formrowview.d.ts +57 -0
  63. package/src/formrow/formrowview.js +56 -0
  64. package/src/highlightedtext/highlightedtextview.js +1 -1
  65. package/src/highlightedtext/labelwithhighlightview.js +4 -0
  66. package/src/icon/iconview.js +25 -16
  67. package/src/index.d.ts +1 -0
  68. package/src/index.js +1 -0
  69. package/src/input/inputbase.js +5 -0
  70. package/src/label/labelview.js +5 -0
  71. package/src/labeledfield/labeledfieldview.js +20 -0
  72. package/src/labeledinput/labeledinputview.js +13 -0
  73. package/src/list/listitemgroupview.js +15 -0
  74. package/src/list/listitemview.js +4 -0
  75. package/src/list/listview.js +27 -5
  76. package/src/menubar/menubarmenubuttonview.d.ts +0 -3
  77. package/src/menubar/menubarmenubuttonview.js +6 -2
  78. package/src/menubar/menubarmenupanelview.js +4 -0
  79. package/src/menubar/menubarmenuview.js +23 -6
  80. package/src/menubar/menubarview.d.ts +8 -0
  81. package/src/menubar/menubarview.js +27 -7
  82. package/src/menubar/utils.d.ts +6 -0
  83. package/src/menubar/utils.js +16 -3
  84. package/src/model.js +1 -1
  85. package/src/panel/balloon/balloonpanelview.js +464 -449
  86. package/src/panel/balloon/contextualballoon.js +60 -24
  87. package/src/panel/sticky/stickypanelview.js +14 -0
  88. package/src/search/searchresultsview.js +18 -0
  89. package/src/search/text/searchtextqueryview.d.ts +0 -3
  90. package/src/search/text/searchtextqueryview.js +15 -3
  91. package/src/search/text/searchtextview.js +43 -3
  92. package/src/template.js +69 -1
  93. package/src/textarea/textareaview.js +12 -5
  94. package/src/toolbar/balloon/balloontoolbar.d.ts +1 -1
  95. package/src/toolbar/balloon/balloontoolbar.js +38 -11
  96. package/src/toolbar/block/blocktoolbar.js +24 -8
  97. package/src/toolbar/toolbarview.d.ts +15 -2
  98. package/src/toolbar/toolbarview.js +206 -58
  99. package/src/tooltipmanager.js +50 -32
  100. package/src/view.js +76 -0
  101. package/src/viewcollection.js +4 -0
  102. package/theme/components/form/form.css +87 -0
  103. package/theme/components/formrow/formrow.css +32 -0
  104. package/theme/icons/accessibility.svg +0 -1
  105. package/theme/icons/color-tile-check.svg +0 -1
  106. package/theme/icons/dropdown-arrow.svg +0 -1
  107. package/theme/icons/project-logo.svg +0 -1
@@ -6,12 +6,12 @@
6
6
  * @module ui/editorui/accessibilityhelp/accessibilityhelp
7
7
  */
8
8
  import { Plugin } from '@ckeditor/ckeditor5-core';
9
+ import { IconAccessibility } from '@ckeditor/ckeditor5-icons';
9
10
  import ButtonView from '../../button/buttonview.js';
10
11
  import Dialog from '../../dialog/dialog.js';
11
12
  import MenuBarMenuListItemButtonView from '../../menubar/menubarmenulistitembuttonview.js';
12
13
  import AccessibilityHelpContentView from './accessibilityhelpcontentview.js';
13
14
  import { getEnvKeystrokeText } from '@ckeditor/ckeditor5-utils';
14
- import accessibilityIcon from '../../../theme/icons/accessibility.svg';
15
15
  import '../../../theme/components/editorui/accessibilityhelp.css';
16
16
  /**
17
17
  * A plugin that brings the accessibility help dialog to the editor available under the <kbd>Alt</kbd>+<kbd>0</kbd>
@@ -22,14 +22,11 @@ import '../../../theme/components/editorui/accessibilityhelp.css';
22
22
  * added using the API provided by the {@link module:core/accessibility~Accessibility} class.
23
23
  */
24
24
  export default class AccessibilityHelp extends Plugin {
25
- constructor() {
26
- super(...arguments);
27
- /**
28
- * The view that displays the dialog content (list of keystrokes).
29
- * Created when the dialog is opened for the first time.
30
- */
31
- this.contentView = null;
32
- }
25
+ /**
26
+ * The view that displays the dialog content (list of keystrokes).
27
+ * Created when the dialog is opened for the first time.
28
+ */
29
+ contentView = null;
33
30
  /**
34
31
  * @inheritDoc
35
32
  */
@@ -84,7 +81,7 @@ export default class AccessibilityHelp extends Plugin {
84
81
  const view = new ButtonClass(locale);
85
82
  view.set({
86
83
  keystroke: 'Alt+0',
87
- icon: accessibilityIcon,
84
+ icon: IconAccessibility,
88
85
  isToggleable: true
89
86
  });
90
87
  view.on('execute', () => this._toggleDialog());
@@ -136,7 +133,7 @@ export default class AccessibilityHelp extends Plugin {
136
133
  id: 'accessibilityHelp',
137
134
  className: 'ck-accessibility-help-dialog',
138
135
  title: t('Accessibility help'),
139
- icon: accessibilityIcon,
136
+ icon: IconAccessibility,
140
137
  hasCloseButton: true,
141
138
  content: this.contentView
142
139
  });
@@ -57,6 +57,19 @@ import { createElement } from '@ckeditor/ckeditor5-utils';
57
57
  * last body collection is {@link ~BodyCollection#detachFromDom detached} and does not require any special handling.
58
58
  */
59
59
  export default class BodyCollection extends ViewCollection {
60
+ /**
61
+ * The {@link module:core/editor/editor~Editor#locale editor's locale} instance.
62
+ * See the view {@link module:ui/view~View#locale locale} property.
63
+ */
64
+ locale;
65
+ /**
66
+ * The element holding elements of the body collection.
67
+ */
68
+ _bodyCollectionContainer;
69
+ /**
70
+ * The wrapper element that holds all of the {@link #_bodyCollectionContainer} elements.
71
+ */
72
+ static _bodyWrapper;
60
73
  /**
61
74
  * Creates a new instance of the {@link module:ui/editorui/bodycollection~BodyCollection}.
62
75
  *
@@ -12,6 +12,20 @@ import LabelView from '../../label/labelview.js';
12
12
  * consisting of a toolbar and an editable area, enclosed within a box.
13
13
  */
14
14
  export default class BoxedEditorUIView extends EditorUIView {
15
+ /**
16
+ * Collection of the child views located in the top (`.ck-editor__top`)
17
+ * area of the UI.
18
+ */
19
+ top;
20
+ /**
21
+ * Collection of the child views located in the main (`.ck-editor__main`)
22
+ * area of the UI.
23
+ */
24
+ main;
25
+ /**
26
+ * Voice label of the UI.
27
+ */
28
+ _voiceLabelView;
15
29
  /**
16
30
  * Creates an instance of the boxed editor UI view class.
17
31
  *
@@ -228,7 +228,7 @@ export default abstract class EditorUI extends /* #__PURE__ */ EditorUI_base {
228
228
  /**
229
229
  * Initializes menu bar.
230
230
  */
231
- protected _initMenuBar(menuBarView: MenuBarView): void;
231
+ initMenuBar(menuBarView: MenuBarView): void;
232
232
  /**
233
233
  * Returns viewport offsets object:
234
234
  *
@@ -17,6 +17,60 @@ import { normalizeMenuBarConfig } from '../menubar/utils.js';
17
17
  * A class providing the minimal interface that is required to successfully bootstrap any editor UI.
18
18
  */
19
19
  export default class EditorUI extends /* #__PURE__ */ ObservableMixin() {
20
+ /**
21
+ * The editor that the UI belongs to.
22
+ */
23
+ editor;
24
+ /**
25
+ * An instance of the {@link module:ui/componentfactory~ComponentFactory}, a registry used by plugins
26
+ * to register factories of specific UI components.
27
+ */
28
+ componentFactory;
29
+ /**
30
+ * Stores the information about the editor UI focus and propagates it so various plugins and components
31
+ * are unified as a focus group.
32
+ */
33
+ focusTracker;
34
+ /**
35
+ * Manages the tooltips displayed on mouseover and focus across the UI.
36
+ */
37
+ tooltipManager;
38
+ /**
39
+ * A helper that enables the "powered by" feature in the editor and renders a link to the project's webpage.
40
+ */
41
+ poweredBy;
42
+ /**
43
+ * A helper that enables the "evaluation badge" feature in the editor.
44
+ */
45
+ evaluationBadge;
46
+ /**
47
+ * A helper that manages the content of an `aria-live` regions used by editor features to announce status changes
48
+ * to screen readers.
49
+ */
50
+ ariaLiveAnnouncer;
51
+ /**
52
+ * Indicates the UI is ready. Set `true` after {@link #event:ready} event is fired.
53
+ *
54
+ * @readonly
55
+ * @default false
56
+ */
57
+ isReady = false;
58
+ /**
59
+ * Stores all editable elements used by the editor instance.
60
+ */
61
+ _editableElementsMap = new Map();
62
+ /**
63
+ * All available & focusable toolbars.
64
+ */
65
+ _focusableToolbarDefinitions = [];
66
+ /**
67
+ * All additional menu bar items, groups or menus that have their default location defined.
68
+ */
69
+ _extraMenuBarElements = [];
70
+ /**
71
+ * The last focused element to which focus should return on `Esc` press.
72
+ */
73
+ _lastFocusedForeignElement = null;
20
74
  /**
21
75
  * Creates an instance of the editor UI class.
22
76
  *
@@ -24,29 +78,6 @@ export default class EditorUI extends /* #__PURE__ */ ObservableMixin() {
24
78
  */
25
79
  constructor(editor) {
26
80
  super();
27
- /**
28
- * Indicates the UI is ready. Set `true` after {@link #event:ready} event is fired.
29
- *
30
- * @readonly
31
- * @default false
32
- */
33
- this.isReady = false;
34
- /**
35
- * Stores all editable elements used by the editor instance.
36
- */
37
- this._editableElementsMap = new Map();
38
- /**
39
- * All available & focusable toolbars.
40
- */
41
- this._focusableToolbarDefinitions = [];
42
- /**
43
- * All additional menu bar items, groups or menus that have their default location defined.
44
- */
45
- this._extraMenuBarElements = [];
46
- /**
47
- * The last focused element to which focus should return on `Esc` press.
48
- */
49
- this._lastFocusedForeignElement = null;
50
81
  const editingView = editor.editing.view;
51
82
  this.editor = editor;
52
83
  this.componentFactory = new ComponentFactory(editor);
@@ -257,7 +288,7 @@ export default class EditorUI extends /* #__PURE__ */ ObservableMixin() {
257
288
  /**
258
289
  * Initializes menu bar.
259
290
  */
260
- _initMenuBar(menuBarView) {
291
+ initMenuBar(menuBarView) {
261
292
  const menuBarViewElement = menuBarView.element;
262
293
  this.focusTracker.add(menuBarViewElement);
263
294
  this.editor.keystrokes.listenTo(menuBarViewElement);
@@ -516,7 +547,7 @@ function getToolbarDefinitionWeight(toolbarDef) {
516
547
  }
517
548
  // Prioritize contextual toolbars. They are displayed at the selection.
518
549
  if (options.isContextual) {
519
- weight--;
550
+ weight -= 2;
520
551
  }
521
552
  return weight;
522
553
  }
@@ -11,6 +11,7 @@ import type EditableUIView from '../editableui/editableuiview.js';
11
11
  import type { Locale, LocaleTranslate } from '@ckeditor/ckeditor5-utils';
12
12
  import '../../theme/components/editorui/editorui.css';
13
13
  import type MenuBarView from '../menubar/menubarview.js';
14
+ import type ToolbarView from '../toolbar/toolbarview.js';
14
15
  /**
15
16
  * The editor UI view class. Base class for the editor main views.
16
17
  */
@@ -24,9 +25,22 @@ export default abstract class EditorUIView extends View {
24
25
  t: LocaleTranslate;
25
26
  abstract get editable(): EditableUIView;
26
27
  /**
27
- * Menu bar view instance. May not be initialized in some editor types.
28
+ * Menu bar view instance. Initialized by default in:
29
+ *
30
+ * * balloon editor;
31
+ * * decoupled editor;
32
+ * * multiroot editor.
28
33
  */
29
34
  menuBarView?: MenuBarView;
35
+ /**
36
+ * Toolbar view instance. Initialized by default in:
37
+ *
38
+ * * classic editor;
39
+ * * decoupled editor;
40
+ * * inline editor;
41
+ * * multiroot editor.
42
+ */
43
+ toolbar?: ToolbarView;
30
44
  /**
31
45
  * Creates an instance of the editor UI view class.
32
46
  *
@@ -12,6 +12,28 @@ import '../../theme/components/editorui/editorui.css';
12
12
  * The editor UI view class. Base class for the editor main views.
13
13
  */
14
14
  export default class EditorUIView extends View {
15
+ /**
16
+ * Collection of the child views, detached from the DOM
17
+ * structure of the editor, like panels, icons etc.
18
+ */
19
+ body;
20
+ /**
21
+ * Menu bar view instance. Initialized by default in:
22
+ *
23
+ * * balloon editor;
24
+ * * decoupled editor;
25
+ * * multiroot editor.
26
+ */
27
+ menuBarView;
28
+ /**
29
+ * Toolbar view instance. Initialized by default in:
30
+ *
31
+ * * classic editor;
32
+ * * decoupled editor;
33
+ * * inline editor;
34
+ * * multiroot editor.
35
+ */
36
+ toolbar;
15
37
  /**
16
38
  * Creates an instance of the editor UI view class.
17
39
  *
@@ -12,13 +12,13 @@ import Badge from '../badge/badge.js';
12
12
  * @private
13
13
  */
14
14
  export default class EvaluationBadge extends Badge {
15
+ licenseTypeMessage = {
16
+ evaluation: 'For evaluation purposes only',
17
+ trial: 'For evaluation purposes only',
18
+ development: 'For development purposes only'
19
+ };
15
20
  constructor(editor) {
16
21
  super(editor, { balloonClass: 'ck-evaluation-badge-balloon' });
17
- this.licenseTypeMessage = {
18
- evaluation: 'For evaluation purposes only',
19
- trial: 'For evaluation purposes only',
20
- development: 'For development purposes only'
21
- };
22
22
  }
23
23
  /**
24
24
  * Enables "evaluation badge" label.
@@ -2,12 +2,9 @@
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/editorui/poweredby
7
- */
8
- import type { Editor, UiConfig } from '@ckeditor/ckeditor5-core';
9
5
  import View from '../view.js';
10
6
  import Badge from '../badge/badge.js';
7
+ import type { Editor, UiConfig } from '@ckeditor/ckeditor5-core';
11
8
  type PoweredByConfig = Required<UiConfig>['poweredBy'];
12
9
  /**
13
10
  * A helper that enables the "powered by" feature in the editor and renders a link to the project's
@@ -2,11 +2,14 @@
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/editorui/poweredby
7
+ */
8
+ import { IconProjectLogo } from '@ckeditor/ckeditor5-icons';
5
9
  import { parseBase64EncodedObject } from '@ckeditor/ckeditor5-utils';
6
10
  import View from '../view.js';
7
11
  import Badge from '../badge/badge.js';
8
12
  import IconView from '../icon/iconview.js';
9
- import poweredByIcon from '../../theme/icons/project-logo.svg';
10
13
  const DEFAULT_LABEL = 'Powered by';
11
14
  /**
12
15
  * A helper that enables the "powered by" feature in the editor and renders a link to the project's
@@ -77,7 +80,7 @@ class PoweredByView extends View {
77
80
  const iconView = new IconView();
78
81
  const bind = this.bindTemplate;
79
82
  iconView.set({
80
- content: poweredByIcon,
83
+ content: IconProjectLogo,
81
84
  isColorInherited: false
82
85
  });
83
86
  this.setTemplate({
@@ -59,6 +59,37 @@ import { isVisible, EmitterMixin } from '@ckeditor/ckeditor5-utils';
59
59
  * Check out the {@glink framework/deep-dive/ui/focus-tracking "Deep dive into focus tracking"} guide to learn more.
60
60
  */
61
61
  export default class FocusCycler extends /* #__PURE__ */ EmitterMixin() {
62
+ /**
63
+ * A {@link module:ui/focuscycler~FocusableView focusable views} collection that the cycler operates on.
64
+ */
65
+ focusables;
66
+ /**
67
+ * A focus tracker instance that the cycler uses to determine the current focus
68
+ * state in {@link #focusables}.
69
+ */
70
+ focusTracker;
71
+ /**
72
+ * An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}
73
+ * which can respond to certain keystrokes and cycle the focus.
74
+ */
75
+ keystrokeHandler;
76
+ /**
77
+ * Actions that the cycler can take when a keystroke is pressed. Requires
78
+ * `options.keystrokeHandler` to be passed and working. When an action is
79
+ * performed, `preventDefault` and `stopPropagation` will be called on the event
80
+ * the keystroke fired in the DOM.
81
+ *
82
+ * ```ts
83
+ * actions: {
84
+ * // Will call #focusPrevious() when arrowleft or arrowup is pressed.
85
+ * focusPrevious: [ 'arrowleft', 'arrowup' ],
86
+ *
87
+ * // Will call #focusNext() when arrowdown is pressed.
88
+ * focusNext: 'arrowdown'
89
+ * }
90
+ * ```
91
+ */
92
+ actions;
62
93
  /**
63
94
  * Creates an instance of the focus cycler utility.
64
95
  *
@@ -21,6 +21,14 @@ import '../../theme/components/formheader/formheader.css';
21
21
  * The latter is an example, where the component has been extended by {@link module:ui/dropdown/dropdownview~DropdownView} view.
22
22
  */
23
23
  export default class FormHeaderView extends View {
24
+ /**
25
+ * A collection of header items.
26
+ */
27
+ children;
28
+ /**
29
+ * The icon view instance. Defined only if icon was passed in the constructor's options.
30
+ */
31
+ iconView;
24
32
  /**
25
33
  * Creates an instance of the form header class.
26
34
  *
@@ -0,0 +1,57 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module ui/formrow/formrowview
7
+ */
8
+ import View from '../view.js';
9
+ import type ViewCollection from '../viewcollection.js';
10
+ import type LabelView from '../label/labelview.js';
11
+ import { type ArrayOrItem, type Locale } from '@ckeditor/ckeditor5-utils';
12
+ import '../../theme/components/formrow/formrow.css';
13
+ /**
14
+ * The class representing a single row in a form,
15
+ */
16
+ export default class FormRowView extends View {
17
+ /**
18
+ * An additional CSS class added to the {@link #element}.
19
+ *
20
+ * @observable
21
+ */
22
+ class: Array<string>;
23
+ /**
24
+ * A collection of row items (buttons, dropdowns, etc.).
25
+ */
26
+ readonly children: ViewCollection;
27
+ /**
28
+ * The role property reflected by the `role` DOM attribute of the {@link #element}.
29
+ *
30
+ * **Note**: Used only when a `labelView` is passed to constructor `options`.
31
+ *
32
+ * @observable
33
+ * @internal
34
+ */
35
+ _role: string | null;
36
+ /**
37
+ * The ARIA property reflected by the `aria-labelledby` DOM attribute of the {@link #element}.
38
+ *
39
+ * **Note**: Used only when a `labelView` is passed to constructor `options`.
40
+ *
41
+ * @observable
42
+ * @internal
43
+ */
44
+ _ariaLabelledBy: string | null;
45
+ /**
46
+ * Creates an instance of the form row class.
47
+ *
48
+ * @param locale The locale instance.
49
+ * @param options.labelView When passed, the row gets the `group` and `aria-labelledby`
50
+ * DOM attributes and gets described by the label.
51
+ */
52
+ constructor(locale: Locale, options?: {
53
+ children?: Array<View>;
54
+ class?: ArrayOrItem<string>;
55
+ labelView?: LabelView;
56
+ });
57
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2025, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
4
+ */
5
+ /**
6
+ * @module ui/formrow/formrowview
7
+ */
8
+ import View from '../view.js';
9
+ import { toArray } from '@ckeditor/ckeditor5-utils';
10
+ import '../../theme/components/formrow/formrow.css';
11
+ /**
12
+ * The class representing a single row in a form,
13
+ */
14
+ export default class FormRowView extends View {
15
+ /**
16
+ * A collection of row items (buttons, dropdowns, etc.).
17
+ */
18
+ children;
19
+ /**
20
+ * Creates an instance of the form row class.
21
+ *
22
+ * @param locale The locale instance.
23
+ * @param options.labelView When passed, the row gets the `group` and `aria-labelledby`
24
+ * DOM attributes and gets described by the label.
25
+ */
26
+ constructor(locale, options = {}) {
27
+ super(locale);
28
+ const bind = this.bindTemplate;
29
+ this.set('class', [
30
+ 'ck',
31
+ 'ck-form__row',
32
+ ...toArray(options.class || [])
33
+ ]);
34
+ this.children = this.createCollection();
35
+ if (options.children) {
36
+ options.children.forEach(child => this.children.add(child));
37
+ }
38
+ this.set('_role', null);
39
+ this.set('_ariaLabelledBy', null);
40
+ if (options.labelView) {
41
+ this.set({
42
+ _role: 'group',
43
+ _ariaLabelledBy: options.labelView.id
44
+ });
45
+ }
46
+ this.setTemplate({
47
+ tag: 'div',
48
+ attributes: {
49
+ class: bind.to('class', classes => classes.join(' ')),
50
+ role: bind.to('_role'),
51
+ 'aria-labelledby': bind.to('_ariaLabelledBy')
52
+ },
53
+ children: this.children
54
+ });
55
+ }
56
+ }
@@ -6,7 +6,7 @@
6
6
  * @module ui/highlightedtext/highlightedtextview
7
7
  */
8
8
  import View from '../view.js';
9
- import { escape } from 'lodash-es';
9
+ import { escape } from 'es-toolkit/compat';
10
10
  import '../../theme/components/highlightedtext/highlightedtext.css';
11
11
  /**
12
12
  * A class representing a view that displays a text which subset can be highlighted using the
@@ -11,6 +11,10 @@ import { uid } from '@ckeditor/ckeditor5-utils';
11
11
  * A label view that can highlight a text fragment.
12
12
  */
13
13
  export default class LabelWithHighlightView extends HighlightedTextView {
14
+ /**
15
+ * @inheritDoc
16
+ */
17
+ id;
14
18
  /**
15
19
  * @inheritDoc
16
20
  */
@@ -7,11 +7,28 @@
7
7
  * @module ui/icon/iconview
8
8
  */
9
9
  import View from '../view.js';
10
+ import { CKEditorError } from '@ckeditor/ckeditor5-utils';
10
11
  import '../../theme/components/icon/icon.css';
11
12
  /**
12
13
  * The icon view class.
13
14
  */
14
15
  class IconView extends View {
16
+ /**
17
+ * A list of presentational attributes that can be set on the `<svg>` element and should be preserved
18
+ * when the icon {@link module:ui/icon/iconview~IconView#content content} is loaded.
19
+ *
20
+ * See the [specification](https://www.w3.org/TR/SVG/styling.html#TermPresentationAttribute) to learn more.
21
+ */
22
+ static presentationalAttributeNames = [
23
+ 'alignment-baseline', 'baseline-shift', 'clip-path', 'clip-rule', 'color', 'color-interpolation',
24
+ 'color-interpolation-filters', 'color-rendering', 'cursor', 'direction', 'display', 'dominant-baseline', 'fill', 'fill-opacity',
25
+ 'fill-rule', 'filter', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style',
26
+ 'font-variant', 'font-weight', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start',
27
+ 'mask', 'opacity', 'overflow', 'paint-order', 'pointer-events', 'shape-rendering', 'stop-color', 'stop-opacity', 'stroke',
28
+ 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width',
29
+ 'text-anchor', 'text-decoration', 'text-overflow', 'text-rendering', 'transform', 'unicode-bidi', 'vector-effect',
30
+ 'visibility', 'white-space', 'word-spacing', 'writing-mode'
31
+ ];
15
32
  /**
16
33
  * @inheritDoc
17
34
  */
@@ -67,6 +84,14 @@ class IconView extends View {
67
84
  if (this.content) {
68
85
  const parsed = new DOMParser().parseFromString(this.content.trim(), 'image/svg+xml');
69
86
  const svg = parsed.querySelector('svg');
87
+ if (!svg) {
88
+ /**
89
+ * The provided icon content is not a valid SVG.
90
+ *
91
+ * @error ui-iconview-invalid-svg
92
+ */
93
+ throw new CKEditorError('ui-iconview-invalid-svg', this);
94
+ }
70
95
  const viewBox = svg.getAttribute('viewBox');
71
96
  if (viewBox) {
72
97
  this.viewBox = viewBox;
@@ -97,20 +122,4 @@ class IconView extends View {
97
122
  }
98
123
  }
99
124
  }
100
- /**
101
- * A list of presentational attributes that can be set on the `<svg>` element and should be preserved
102
- * when the icon {@link module:ui/icon/iconview~IconView#content content} is loaded.
103
- *
104
- * See the [specification](https://www.w3.org/TR/SVG/styling.html#TermPresentationAttribute) to learn more.
105
- */
106
- IconView.presentationalAttributeNames = [
107
- 'alignment-baseline', 'baseline-shift', 'clip-path', 'clip-rule', 'color', 'color-interpolation',
108
- 'color-interpolation-filters', 'color-rendering', 'cursor', 'direction', 'display', 'dominant-baseline', 'fill', 'fill-opacity',
109
- 'fill-rule', 'filter', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style',
110
- 'font-variant', 'font-weight', 'image-rendering', 'letter-spacing', 'lighting-color', 'marker-end', 'marker-mid', 'marker-start',
111
- 'mask', 'opacity', 'overflow', 'paint-order', 'pointer-events', 'shape-rendering', 'stop-color', 'stop-opacity', 'stroke',
112
- 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width',
113
- 'text-anchor', 'text-decoration', 'text-overflow', 'text-rendering', 'transform', 'unicode-bidi', 'vector-effect',
114
- 'visibility', 'white-space', 'word-spacing', 'writing-mode'
115
- ];
116
125
  export default IconView;
package/src/index.d.ts CHANGED
@@ -46,6 +46,7 @@ export { default as EditorUI, type EditorUIReadyEvent, type EditorUIUpdateEvent
46
46
  export { default as EditorUIView } from './editorui/editoruiview.js';
47
47
  export { default as BoxedEditorUIView } from './editorui/boxed/boxededitoruiview.js';
48
48
  export { default as InlineEditableUIView } from './editableui/inline/inlineeditableuiview.js';
49
+ export { default as FormRowView } from './formrow/formrowview.js';
49
50
  export { default as FormHeaderView } from './formheader/formheaderview.js';
50
51
  export { default as FocusCycler, type FocusableView, type ViewWithFocusCycler, type FocusCyclerForwardCycleEvent, type FocusCyclerBackwardCycleEvent, isViewWithFocusCycler, isFocusable } from './focuscycler.js';
51
52
  export { default as IconView } from './icon/iconview.js';
package/src/index.js CHANGED
@@ -44,6 +44,7 @@ export { default as EditorUI } from './editorui/editorui.js';
44
44
  export { default as EditorUIView } from './editorui/editoruiview.js';
45
45
  export { default as BoxedEditorUIView } from './editorui/boxed/boxededitoruiview.js';
46
46
  export { default as InlineEditableUIView } from './editableui/inline/inlineeditableuiview.js';
47
+ export { default as FormRowView } from './formrow/formrowview.js';
47
48
  export { default as FormHeaderView } from './formheader/formheaderview.js';
48
49
  export { default as FocusCycler, isViewWithFocusCycler, isFocusable } from './focuscycler.js';
49
50
  export { default as IconView } from './icon/iconview.js';
@@ -11,6 +11,11 @@ import { FocusTracker } from '@ckeditor/ckeditor5-utils';
11
11
  * The base input view class.
12
12
  */
13
13
  export default class InputBase extends View {
14
+ /**
15
+ * Stores information about the editor UI focus and propagates it so various plugins and components
16
+ * are unified as a focus group.
17
+ */
18
+ focusTracker;
14
19
  /**
15
20
  * @inheritDoc
16
21
  */
@@ -12,6 +12,11 @@ import '../../theme/components/label/label.css';
12
12
  * The label view class.
13
13
  */
14
14
  export default class LabelView extends View {
15
+ /**
16
+ * An unique id of the label. It can be used by other UI components to reference
17
+ * the label, for instance, using the `aria-describedby` DOM attribute.
18
+ */
19
+ id;
15
20
  /**
16
21
  * @inheritDoc
17
22
  */
@@ -48,6 +48,26 @@ import '../../theme/components/labeledfield/labeledfieldview.css';
48
48
  * UI components.
49
49
  */
50
50
  export default class LabeledFieldView extends View {
51
+ /**
52
+ * The field view that gets labeled.
53
+ */
54
+ fieldView;
55
+ /**
56
+ * The label view instance that describes the entire view.
57
+ */
58
+ labelView;
59
+ /**
60
+ * The status view for the {@link #fieldView}. It displays {@link #errorText} and
61
+ * {@link #infoText}.
62
+ */
63
+ statusView;
64
+ /**
65
+ * A collection of children of the internal wrapper element. Allows inserting additional DOM elements (views) next to
66
+ * the {@link #fieldView} for easy styling (e.g. positioning).
67
+ *
68
+ * By default, the collection contains {@link #fieldView} and {@link #labelView}.
69
+ */
70
+ fieldWrapperChildren;
51
71
  /**
52
72
  * Creates an instance of the labeled field view class using a provided creator function
53
73
  * that provides the view to be labeled.