@ckeditor/ckeditor5-ui 41.0.0 → 41.2.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.
Files changed (99) hide show
  1. package/ckeditor5-metadata.json +14 -0
  2. package/lang/contexts.json +7 -1
  3. package/lang/translations/ar.po +24 -0
  4. package/lang/translations/ast.po +24 -0
  5. package/lang/translations/az.po +24 -0
  6. package/lang/translations/bg.po +24 -0
  7. package/lang/translations/bn.po +24 -0
  8. package/lang/translations/ca.po +24 -0
  9. package/lang/translations/cs.po +24 -0
  10. package/lang/translations/da.po +24 -0
  11. package/lang/translations/de-ch.po +24 -0
  12. package/lang/translations/de.po +24 -0
  13. package/lang/translations/el.po +24 -0
  14. package/lang/translations/en-au.po +24 -0
  15. package/lang/translations/en-gb.po +24 -0
  16. package/lang/translations/en.po +24 -0
  17. package/lang/translations/eo.po +24 -0
  18. package/lang/translations/es.po +24 -0
  19. package/lang/translations/et.po +24 -0
  20. package/lang/translations/eu.po +24 -0
  21. package/lang/translations/fa.po +24 -0
  22. package/lang/translations/fi.po +24 -0
  23. package/lang/translations/fr.po +24 -0
  24. package/lang/translations/gl.po +24 -0
  25. package/lang/translations/he.po +25 -1
  26. package/lang/translations/hi.po +24 -0
  27. package/lang/translations/hr.po +24 -0
  28. package/lang/translations/hu.po +24 -0
  29. package/lang/translations/id.po +24 -0
  30. package/lang/translations/it.po +24 -0
  31. package/lang/translations/ja.po +24 -0
  32. package/lang/translations/km.po +24 -0
  33. package/lang/translations/kn.po +24 -0
  34. package/lang/translations/ko.po +24 -0
  35. package/lang/translations/ku.po +24 -0
  36. package/lang/translations/lt.po +24 -0
  37. package/lang/translations/lv.po +24 -0
  38. package/lang/translations/ms.po +24 -0
  39. package/lang/translations/nb.po +24 -0
  40. package/lang/translations/ne.po +24 -0
  41. package/lang/translations/nl.po +24 -0
  42. package/lang/translations/no.po +24 -0
  43. package/lang/translations/pl.po +24 -0
  44. package/lang/translations/pt-br.po +24 -0
  45. package/lang/translations/pt.po +25 -1
  46. package/lang/translations/ro.po +24 -0
  47. package/lang/translations/ru.po +24 -0
  48. package/lang/translations/sk.po +24 -0
  49. package/lang/translations/sl.po +24 -0
  50. package/lang/translations/sq.po +24 -0
  51. package/lang/translations/sr-latn.po +24 -0
  52. package/lang/translations/sr.po +24 -0
  53. package/lang/translations/sv.po +24 -0
  54. package/lang/translations/th.po +24 -0
  55. package/lang/translations/tk.po +24 -0
  56. package/lang/translations/tr.po +24 -0
  57. package/lang/translations/tt.po +24 -0
  58. package/lang/translations/ug.po +24 -0
  59. package/lang/translations/uk.po +24 -0
  60. package/lang/translations/ur.po +24 -0
  61. package/lang/translations/uz.po +24 -0
  62. package/lang/translations/vi.po +24 -0
  63. package/lang/translations/zh-cn.po +24 -0
  64. package/lang/translations/zh.po +24 -0
  65. package/package.json +3 -3
  66. package/src/augmentation.d.ts +2 -1
  67. package/src/bindings/draggableviewmixin.d.ts +4 -4
  68. package/src/bindings/draggableviewmixin.js +5 -5
  69. package/src/button/button.d.ts +3 -0
  70. package/src/colorpicker/colorpickerview.d.ts +8 -3
  71. package/src/colorpicker/colorpickerview.js +8 -5
  72. package/src/colorpicker/utils.d.ts +5 -0
  73. package/src/colorpicker/utils.js +9 -0
  74. package/src/colorselector/colorgridsfragmentview.js +0 -1
  75. package/src/dialog/dialog.d.ts +23 -23
  76. package/src/dialog/dialog.js +22 -12
  77. package/src/dialog/dialogactionsview.d.ts +3 -3
  78. package/src/dialog/dialogactionsview.js +2 -2
  79. package/src/dialog/dialogview.d.ts +24 -24
  80. package/src/dialog/dialogview.js +17 -17
  81. package/src/editorui/accessibilityhelp/accessibilityhelp.d.ts +47 -0
  82. package/src/editorui/accessibilityhelp/accessibilityhelp.js +111 -0
  83. package/src/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +35 -0
  84. package/src/editorui/accessibilityhelp/accessibilityhelpcontentview.js +112 -0
  85. package/src/focuscycler.d.ts +2 -2
  86. package/src/focuscycler.js +2 -2
  87. package/src/formheader/formheaderview.js +2 -1
  88. package/src/icon/iconview.d.ts +3 -0
  89. package/src/index.d.ts +1 -0
  90. package/src/index.js +1 -0
  91. package/src/list/listview.js +1 -1
  92. package/src/toolbar/balloon/balloontoolbar.d.ts +0 -5
  93. package/src/toolbar/balloon/balloontoolbar.js +5 -8
  94. package/src/toolbar/block/blocktoolbar.d.ts +0 -8
  95. package/src/toolbar/block/blocktoolbar.js +9 -14
  96. package/src/tooltipmanager.d.ts +5 -1
  97. package/src/tooltipmanager.js +32 -4
  98. package/theme/components/editorui/accessibilityhelp.css +10 -0
  99. package/theme/icons/accessibility.svg +1 -0
@@ -14,12 +14,12 @@ import { global } from '@ckeditor/ckeditor5-utils';
14
14
  * ```
15
15
  *
16
16
  * Creating a class extending it attaches a set of mouse and touch listeners allowing to observe dragging of the view element:
17
- * * `mousedown` and `touchstart` on the view element - starting the dragging,
18
- * * `mousemove` and `touchmove` on the document - updating the view coordinates,
17
+ * * `mousedown` and `touchstart` on the view element - starting the dragging.
18
+ * * `mousemove` and `touchmove` on the document - updating the view coordinates.
19
19
  * * `mouseup` and `touchend` on the document - stopping the dragging.
20
20
  *
21
- * The mixin itself doesn't provide a visual feedback (i.e. the dragged element doesn't change its position) -
22
- * it's up to the developer to implement it.
21
+ * The mixin itself does not provide a visual feedback (that is, the dragged element does not change its position) -
22
+ * it is up to the developer to implement it.
23
23
  */
24
24
  export default function DraggableViewMixin(view) {
25
25
  class DraggableMixin extends view {
@@ -37,7 +37,7 @@ export default function DraggableViewMixin(view) {
37
37
  */
38
38
  this._onDragEndBound = this._onDragEnd.bind(this);
39
39
  /**
40
- * The last coordinates of the view. It's updated on every mouse move.
40
+ * The last coordinates of the view. It is updated on every mouse move.
41
41
  */
42
42
  this._lastDraggingCoordinates = { x: 0, y: 0 };
43
43
  this.on('render', () => {
@@ -118,6 +118,9 @@ export default interface Button {
118
118
  * (Optional) An XML {@link module:ui/icon/iconview~IconView#content content} of the icon.
119
119
  * When defined, an `iconView` should be added to the button.
120
120
  *
121
+ * The user must provide the entire XML string, not just the path. See the
122
+ * {@glink framework/architecture/ui-library#setting-label-icon-and-tooltip UI library} guide for details.
123
+ *
121
124
  * @observable
122
125
  */
123
126
  icon: string | undefined;
@@ -9,8 +9,13 @@ import { type ColorPickerViewConfig } from './utils.js';
9
9
  import { type Locale } from '@ckeditor/ckeditor5-utils';
10
10
  import View from '../view.js';
11
11
  import type ViewCollection from '../viewcollection.js';
12
- import 'vanilla-colorful/hex-color-picker.js';
12
+ import { HexBase } from 'vanilla-colorful/lib/entrypoints/hex';
13
13
  import '../../theme/components/colorpicker/colorpicker.css';
14
+ declare global {
15
+ interface HTMLElementTagNameMap {
16
+ 'hex-color-picker': HexBase;
17
+ }
18
+ }
14
19
  /**
15
20
  * A class which represents a color picker with an input field for defining custom colors.
16
21
  */
@@ -18,7 +23,7 @@ export default class ColorPickerView extends View {
18
23
  /**
19
24
  * Element with saturation and hue sliders.
20
25
  */
21
- picker: HTMLElement;
26
+ picker: HexBase;
22
27
  /**
23
28
  * Container for a `#` sign prefix and an input for displaying and defining custom colors
24
29
  * in HEX format.
@@ -96,7 +101,7 @@ export default class ColorPickerView extends View {
96
101
  }
97
102
  declare class SliderView extends View {
98
103
  /**
99
- * @param element HTML elemnt of slider in color picker.
104
+ * @param element HTML element of slider in color picker.
100
105
  */
101
106
  constructor(element: HTMLElement);
102
107
  /**
@@ -5,13 +5,15 @@
5
5
  /**
6
6
  * @module ui/colorpicker/colorpickerview
7
7
  */
8
- import { convertColor, convertToHex } from './utils.js';
8
+ import { convertColor, convertToHex, registerCustomElement } from './utils.js';
9
9
  import { global, env } from '@ckeditor/ckeditor5-utils';
10
10
  import { debounce } from 'lodash-es';
11
11
  import View from '../view.js';
12
12
  import LabeledFieldView from '../labeledfield/labeledfieldview.js';
13
13
  import { createLabeledInputText } from '../labeledfield/utils.js';
14
- import 'vanilla-colorful/hex-color-picker.js';
14
+ // Custom export due to https://github.com/ckeditor/ckeditor5/issues/15698.
15
+ // eslint-disable-next-line ckeditor5-rules/require-file-extensions-in-imports
16
+ import { HexBase } from 'vanilla-colorful/lib/entrypoints/hex';
15
17
  import '../../theme/components/colorpicker/colorpicker.css';
16
18
  const waitingTime = 150;
17
19
  /**
@@ -79,6 +81,8 @@ export default class ColorPickerView extends View {
79
81
  */
80
82
  render() {
81
83
  super.render();
84
+ // Extracted to the helper to make it testable.
85
+ registerCustomElement('hex-color-picker', HexBase);
82
86
  this.picker = global.document.createElement('hex-color-picker');
83
87
  this.picker.setAttribute('class', 'hex-color-picker');
84
88
  this.picker.setAttribute('tabindex', '-1');
@@ -100,8 +104,7 @@ export default class ColorPickerView extends View {
100
104
  this.picker.shadowRoot.appendChild(styleSheetForFocusedColorPicker);
101
105
  }
102
106
  this.picker.addEventListener('color-changed', event => {
103
- const customEvent = event;
104
- const color = customEvent.detail.value;
107
+ const color = event.detail.value;
105
108
  this._debounceColorPickerEvent(color);
106
109
  });
107
110
  }
@@ -213,7 +216,7 @@ function convertColorToCommonHexFormat(inputColor) {
213
216
  // View abstraction over pointer in color picker.
214
217
  class SliderView extends View {
215
218
  /**
216
- * @param element HTML elemnt of slider in color picker.
219
+ * @param element HTML element of slider in color picker.
217
220
  */
218
221
  constructor(element) {
219
222
  super();
@@ -41,3 +41,8 @@ export declare function convertColor(color: string, outputFormat: ColorPickerOut
41
41
  * @returns A color string.
42
42
  */
43
43
  export declare function convertToHex(color: string): string;
44
+ /**
45
+ * Registers the custom element in the
46
+ * [CustomElementsRegistry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry).
47
+ */
48
+ export declare function registerCustomElement(elementName: string, constructor: CustomElementConstructor): void;
@@ -58,6 +58,15 @@ export function convertToHex(color) {
58
58
  }
59
59
  return convertColor(color, 'hex');
60
60
  }
61
+ /**
62
+ * Registers the custom element in the
63
+ * [CustomElementsRegistry](https://developer.mozilla.org/en-US/docs/Web/API/CustomElementRegistry).
64
+ */
65
+ export function registerCustomElement(elementName, constructor) {
66
+ if (customElements.get(elementName) === undefined) {
67
+ customElements.define(elementName, constructor);
68
+ }
69
+ }
61
70
  /**
62
71
  * Formats the passed color channels according to the requested format.
63
72
  *
@@ -133,7 +133,6 @@ export default class ColorGridsFragmentView extends View {
133
133
  }
134
134
  this._createColorPickerButton();
135
135
  this._addColorSelectorElementsToFocusTracker();
136
- this.focus();
137
136
  }
138
137
  /**
139
138
  * Focuses the component.
@@ -54,15 +54,15 @@ export default class Dialog extends Plugin {
54
54
  /**
55
55
  * Initiates listeners for the `show` and `hide` events emitted by this plugin.
56
56
  *
57
- * We couldn't simply decorate the {@link #show} and {@link #hide} methods to fire events,
58
- * because they would be fired in the wrong order - first would be `show` and then `hide`
57
+ * We could not simply decorate the {@link #show} and {@link #hide} methods to fire events,
58
+ * because they would be fired in the wrong order – first would be `show` and then `hide`
59
59
  * (because showing the dialog actually starts with hiding the previously visible one).
60
60
  * Hence, we added private methods {@link #_show} and {@link #_hide} which are called on events
61
61
  * in the desired sequence.
62
62
  */
63
63
  private _initShowHideListeners;
64
64
  /**
65
- * Initiates keystroke handler for toggling the focus between the editor and dialog view.
65
+ * Initiates keystroke handler for toggling the focus between the editor and the dialog view.
66
66
  */
67
67
  private _initFocusToggler;
68
68
  /**
@@ -72,12 +72,12 @@ export default class Dialog extends Plugin {
72
72
  /**
73
73
  * Displays a dialog window.
74
74
  *
75
- * This method requires a {@link ~DialogDefinition} that defines dialog's content, title, icon, action buttons, etc.
75
+ * This method requires a {@link ~DialogDefinition} that defines the dialog's content, title, icon, action buttons, etc.
76
76
  *
77
77
  * For example, the following definition will create a dialog with:
78
- * * a header consisting of an icon, a title and a "Close" button (it's added by default),
79
- * * a content consisting of a view with a single paragraph,
80
- * * a footer consisting of two buttons: "Yes" and "No".
78
+ * * A header consisting of an icon, a title, and a "Close" button (it is added by default).
79
+ * * A content consisting of a view with a single paragraph.
80
+ * * A footer consisting of two buttons: "Yes" and "No".
81
81
  *
82
82
  * ```js
83
83
  * // Create the view that will be used as the dialog's content.
@@ -102,7 +102,7 @@ export default class Dialog extends Plugin {
102
102
  * // Show the dialog.
103
103
  * editor.plugins.get( 'Dialog' ).show( {
104
104
  * id: 'myDialog',
105
- * icon: 'myIcon', // this should be an SVG string
105
+ * icon: 'myIcon', // This should be an SVG string.
106
106
  * title: 'My dialog',
107
107
  * content: textView,
108
108
  * actionButtons: [
@@ -122,18 +122,18 @@ export default class Dialog extends Plugin {
122
122
  * ```
123
123
  *
124
124
  * By specifying the {@link ~DialogDefinition#onShow} and {@link ~DialogDefinition#onHide} callbacks
125
- * it's also possible to add callbacks that will be called when the dialog is shown or hidden.
125
+ * it is also possible to add callbacks that will be called when the dialog is shown or hidden.
126
126
  *
127
127
  * For example, the callbacks in the following definition:
128
- * * disable the default behavior of the `Esc` key,
129
- * * fire a custom event when the dialog gets hidden.
128
+ * * Disable the default behavior of the <kbd>Esc</kbd> key.
129
+ * * Fire a custom event when the dialog gets hidden.
130
130
  *
131
131
  * ```js
132
132
  * editor.plugins.get( 'Dialog' ).show( {
133
133
  * // ...
134
134
  * onShow: dialog => {
135
135
  * dialog.view.on( 'close', ( evt, data ) => {
136
- * // Only prevent the event from `Esc` key - don't affect the other ways of closing the dialog.
136
+ * // Only prevent the event from the "Esc" key - do not affect the other ways of closing the dialog.
137
137
  * if ( data.source === 'escKeyPress' ) {
138
138
  * evt.stop();
139
139
  * }
@@ -173,8 +173,8 @@ export default class Dialog extends Plugin {
173
173
  */
174
174
  export interface DialogDefinition {
175
175
  /**
176
- * A unique identifier of the dialog. Allows for distinguishing between different dialogs and their visibility.
177
- * For instance, when open, the id of currently visible dialog is stored in {@link module:ui/dialog/dialog~Dialog#id}.
176
+ * A unique identifier of the dialog. It allows for distinguishing between different dialogs and their visibility.
177
+ * For instance, when open, the ID of the currently visible dialog is stored in {@link module:ui/dialog/dialog~Dialog#id}.
178
178
  *
179
179
  * The `id` is also passed along the {@link module:ui/dialog/dialog~DialogShowEvent} and {@link module:ui/dialog/dialog~DialogHideEvent}
180
180
  * events.
@@ -188,7 +188,7 @@ export interface DialogDefinition {
188
188
  */
189
189
  icon?: string;
190
190
  /**
191
- * A title displayed in dialogs's header. Also works as an accessible name of the dialog used by assistive technologies.
191
+ * A title displayed in the dialogs's header. It also works as an accessible name of the dialog used by assistive technologies.
192
192
  *
193
193
  * When not set, the header is not displayed. Affects {@link #icon} and {@link #hasCloseButton}.
194
194
  */
@@ -213,7 +213,7 @@ export interface DialogDefinition {
213
213
  */
214
214
  className?: string;
215
215
  /**
216
- * When set `true`, the dialog will become a modal, i.e. it will block the UI until it is closed.
216
+ * When set to `true`, the dialog will become a modal, that is, it will block the UI until it is closed.
217
217
  */
218
218
  isModal?: boolean;
219
219
  /**
@@ -224,18 +224,18 @@ export interface DialogDefinition {
224
224
  */
225
225
  position?: typeof DialogViewPosition[keyof typeof DialogViewPosition];
226
226
  /**
227
- * A callback called when the dialog shows up with `low` priority. It allows for setting up the dialog's {@link #content}.
227
+ * A callback called when the dialog shows up with a `low` priority. It allows for setting up the dialog's {@link #content}.
228
228
  */
229
229
  onShow?: (dialog: Dialog) => void;
230
230
  /**
231
- * A callback called when the dialog hides with `low` priority.
232
- * It allows for cleaning up (e.g. resetting) the dialog's {@link #content}.
231
+ * A callback called when the dialog hides with a `low` priority.
232
+ * It allows for cleaning up (for example, resetting) the dialog's {@link #content}.
233
233
  */
234
234
  onHide?: (dialog: Dialog) => void;
235
235
  }
236
236
  /**
237
- * An event fired after {@link module:ui/dialog/dialog~Dialog#show} is called. You can use it to customize behavior
238
- * any dialog.
237
+ * An event fired after {@link module:ui/dialog/dialog~Dialog#show} is called. You can use it to customize the behavior
238
+ * of any dialog.
239
239
  *
240
240
  * ```js
241
241
  * import { DialogViewPosition } from 'ckeditor5/src/ui.js';
@@ -255,8 +255,8 @@ export type DialogShowEvent = {
255
255
  args: [dialogDefinition: DialogDefinition];
256
256
  };
257
257
  /**
258
- * An event fired after {@link module:ui/dialog/dialog~Dialog#hide} is called. You can use it to customize behavior
259
- * any dialog.
258
+ * An event fired after {@link module:ui/dialog/dialog~Dialog#hide} is called. You can use it to customize the behavior
259
+ * of any dialog.
260
260
  *
261
261
  * ```js
262
262
  * // Logs after the "Find and Replace" dialog gets hidden
@@ -19,16 +19,26 @@ export default class Dialog extends Plugin {
19
19
  */
20
20
  constructor(editor) {
21
21
  super(editor);
22
+ const t = editor.t;
22
23
  this._initShowHideListeners();
23
24
  this._initFocusToggler();
24
25
  this._initMultiRootIntegration();
25
26
  this.set('id', null);
27
+ // Add the information about the keystroke to the accessibility database.
28
+ editor.accessibility.addKeystrokeInfos({
29
+ categoryId: 'navigation',
30
+ keystrokes: [{
31
+ label: t('Move focus in and out of an active dialog window'),
32
+ keystroke: 'Ctrl+F6',
33
+ mayRequireFn: true
34
+ }]
35
+ });
26
36
  }
27
37
  /**
28
38
  * Initiates listeners for the `show` and `hide` events emitted by this plugin.
29
39
  *
30
- * We couldn't simply decorate the {@link #show} and {@link #hide} methods to fire events,
31
- * because they would be fired in the wrong order - first would be `show` and then `hide`
40
+ * We could not simply decorate the {@link #show} and {@link #hide} methods to fire events,
41
+ * because they would be fired in the wrong order &ndash; first would be `show` and then `hide`
32
42
  * (because showing the dialog actually starts with hiding the previously visible one).
33
43
  * Hence, we added private methods {@link #_show} and {@link #_hide} which are called on events
34
44
  * in the desired sequence.
@@ -57,7 +67,7 @@ export default class Dialog extends Plugin {
57
67
  }, { priority: 'low' });
58
68
  }
59
69
  /**
60
- * Initiates keystroke handler for toggling the focus between the editor and dialog view.
70
+ * Initiates keystroke handler for toggling the focus between the editor and the dialog view.
61
71
  */
62
72
  _initFocusToggler() {
63
73
  const editor = this.editor;
@@ -94,12 +104,12 @@ export default class Dialog extends Plugin {
94
104
  /**
95
105
  * Displays a dialog window.
96
106
  *
97
- * This method requires a {@link ~DialogDefinition} that defines dialog's content, title, icon, action buttons, etc.
107
+ * This method requires a {@link ~DialogDefinition} that defines the dialog's content, title, icon, action buttons, etc.
98
108
  *
99
109
  * For example, the following definition will create a dialog with:
100
- * * a header consisting of an icon, a title and a "Close" button (it's added by default),
101
- * * a content consisting of a view with a single paragraph,
102
- * * a footer consisting of two buttons: "Yes" and "No".
110
+ * * A header consisting of an icon, a title, and a "Close" button (it is added by default).
111
+ * * A content consisting of a view with a single paragraph.
112
+ * * A footer consisting of two buttons: "Yes" and "No".
103
113
  *
104
114
  * ```js
105
115
  * // Create the view that will be used as the dialog's content.
@@ -124,7 +134,7 @@ export default class Dialog extends Plugin {
124
134
  * // Show the dialog.
125
135
  * editor.plugins.get( 'Dialog' ).show( {
126
136
  * id: 'myDialog',
127
- * icon: 'myIcon', // this should be an SVG string
137
+ * icon: 'myIcon', // This should be an SVG string.
128
138
  * title: 'My dialog',
129
139
  * content: textView,
130
140
  * actionButtons: [
@@ -144,18 +154,18 @@ export default class Dialog extends Plugin {
144
154
  * ```
145
155
  *
146
156
  * By specifying the {@link ~DialogDefinition#onShow} and {@link ~DialogDefinition#onHide} callbacks
147
- * it's also possible to add callbacks that will be called when the dialog is shown or hidden.
157
+ * it is also possible to add callbacks that will be called when the dialog is shown or hidden.
148
158
  *
149
159
  * For example, the callbacks in the following definition:
150
- * * disable the default behavior of the `Esc` key,
151
- * * fire a custom event when the dialog gets hidden.
160
+ * * Disable the default behavior of the <kbd>Esc</kbd> key.
161
+ * * Fire a custom event when the dialog gets hidden.
152
162
  *
153
163
  * ```js
154
164
  * editor.plugins.get( 'Dialog' ).show( {
155
165
  * // ...
156
166
  * onShow: dialog => {
157
167
  * dialog.view.on( 'close', ( evt, data ) => {
158
- * // Only prevent the event from `Esc` key - don't affect the other ways of closing the dialog.
168
+ * // Only prevent the event from the "Esc" key - do not affect the other ways of closing the dialog.
159
169
  * if ( data.source === 'escKeyPress' ) {
160
170
  * evt.stop();
161
171
  * }
@@ -13,7 +13,7 @@ import ViewCollection from '../viewcollection.js';
13
13
  import FocusCycler, { type FocusableView } from '../focuscycler.js';
14
14
  import '../../theme/components/dialog/dialogactions.css';
15
15
  /**
16
- * A dialog actions view class. Contains button views which are used to execute dialog actions.
16
+ * A dialog actions view class. It contains button views which are used to execute dialog actions.
17
17
  */
18
18
  export default class DialogActionsView extends View {
19
19
  /**
@@ -54,13 +54,13 @@ export default class DialogActionsView extends View {
54
54
  */
55
55
  focus(direction?: 1 | -1): void;
56
56
  /**
57
- * Add all elements from the {@link #children} collection to the {@link #_focusables} collection
57
+ * Adds all elements from the {@link #children} collection to the {@link #_focusables} collection
58
58
  * and to the {@link #_focusTracker} instance.
59
59
  */
60
60
  private _updateFocusCyclableItems;
61
61
  }
62
62
  /**
63
- * A dialog action button definition. It's a slightly modified version
63
+ * A dialog action button definition. It is a slightly modified version
64
64
  * of the {@link module:ui/button/button~Button} definition.
65
65
  */
66
66
  export type DialogActionButtonDefinition = Pick<Button, 'label'> & Partial<Pick<Button, 'withText' | 'class' | 'icon'>> & {
@@ -12,7 +12,7 @@ import ViewCollection from '../viewcollection.js';
12
12
  import FocusCycler from '../focuscycler.js';
13
13
  import '../../theme/components/dialog/dialogactions.css';
14
14
  /**
15
- * A dialog actions view class. Contains button views which are used to execute dialog actions.
15
+ * A dialog actions view class. It contains button views which are used to execute dialog actions.
16
16
  */
17
17
  export default class DialogActionsView extends View {
18
18
  /**
@@ -86,7 +86,7 @@ export default class DialogActionsView extends View {
86
86
  }
87
87
  }
88
88
  /**
89
- * Add all elements from the {@link #children} collection to the {@link #_focusables} collection
89
+ * Adds all elements from the {@link #children} collection to the {@link #_focusables} collection
90
90
  * and to the {@link #_focusTracker} instance.
91
91
  */
92
92
  _updateFocusCyclableItems() {
@@ -18,17 +18,17 @@ import '../../theme/components/dialog/dialog.css';
18
18
  /**
19
19
  * Available dialog view positions:
20
20
  *
21
- * * `DialogViewPosition.SCREEN_CENTER` - a fixed position in the center of the screen,
22
- * * `DialogViewPosition.EDITOR_CENTER` - a dynamic position in the center of the editor editable area,
23
- * * `DialogViewPosition.EDITOR_TOP_SIDE` - a dynamic position at the top-right (for the left-to-right languages)
24
- * or top-left (for right-to-left languages) corner of the editor editable area,
25
- * * `DialogViewPosition.EDITOR_TOP_CENTER` - a dynamic position at the top-center of the editor editable area,
26
- * * `DialogViewPosition.EDITOR_BOTTOM_CENTER` - a dynamic position at the bottom-center of the editor editable area,
27
- * * `DialogViewPosition.EDITOR_ABOVE_CENTER` - a dynamic position centered above the editor editable area,
28
- * * `DialogViewPosition.EDITOR_BELOW_CENTER` - a dynamic position centered below the editor editable area.
21
+ * * `DialogViewPosition.SCREEN_CENTER` &ndash; A fixed position in the center of the screen.
22
+ * * `DialogViewPosition.EDITOR_CENTER` &ndash; A dynamic position in the center of the editor editable area.
23
+ * * `DialogViewPosition.EDITOR_TOP_SIDE` &ndash; A dynamic position at the top-right (for the left-to-right languages)
24
+ * or top-left (for right-to-left languages) corner of the editor editable area.
25
+ * * `DialogViewPosition.EDITOR_TOP_CENTER` &ndash; A dynamic position at the top-center of the editor editable area.
26
+ * * `DialogViewPosition.EDITOR_BOTTOM_CENTER` &ndash; A dynamic position at the bottom-center of the editor editable area.
27
+ * * `DialogViewPosition.EDITOR_ABOVE_CENTER` &ndash; A dynamic position centered above the editor editable area.
28
+ * * `DialogViewPosition.EDITOR_BELOW_CENTER` &ndash; A dynamic position centered below the editor editable area.
29
29
  *
30
30
  * The position of a dialog is specified by a {@link module:ui/dialog/dialog~DialogDefinition#position `position` property} of a
31
- * definition passed to {@link module:ui/dialog/dialog~Dialog#show} method.
31
+ * definition passed to the {@link module:ui/dialog/dialog~Dialog#show} method.
32
32
  */
33
33
  export declare const DialogViewPosition: {
34
34
  readonly SCREEN_CENTER: "screen-center";
@@ -46,15 +46,15 @@ declare const DialogView_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof
46
46
  export default class DialogView extends DialogView_base implements DraggableView {
47
47
  /**
48
48
  * A collection of the child views inside of the dialog.
49
- * Dialog can have 3 optional parts: header, content and actions.
49
+ * A dialog can have 3 optional parts: header, content, and actions.
50
50
  */
51
51
  readonly parts: ViewCollection;
52
52
  /**
53
- * A header view of the dialog. It's also a drag handle of the dialog.
53
+ * A header view of the dialog. It is also a drag handle of the dialog.
54
54
  */
55
55
  headerView?: FormHeaderView;
56
56
  /**
57
- * A close button view. It's automatically added to the header view if present.
57
+ * A close button view. It is automatically added to the header view if present.
58
58
  */
59
59
  closeButtonView?: ButtonView;
60
60
  /**
@@ -79,11 +79,11 @@ export default class DialogView extends DialogView_base implements DraggableView
79
79
  readonly focusTracker: FocusTracker;
80
80
  /**
81
81
  * A flag indicating if the dialog was moved manually. If so, its position
82
- * won't be updated automatically upon window resize or document scroll.
82
+ * will not be updated automatically upon window resize or document scroll.
83
83
  */
84
84
  wasMoved: boolean;
85
85
  /**
86
- * A flag indicating if this DialogView is a modal.
86
+ * A flag indicating if this dialog view is a modal.
87
87
  *
88
88
  * @observable
89
89
  */
@@ -117,7 +117,7 @@ export default class DialogView extends DialogView_base implements DraggableView
117
117
  */
118
118
  _isVisible: boolean;
119
119
  /**
120
- * A flag indicating if dialog is transparent. It is used to prevent the dialog from being visible
120
+ * A flag indicating if a dialog is transparent. It is used to prevent the dialog from being visible
121
121
  * before its position is calculated.
122
122
  *
123
123
  * @observable
@@ -125,25 +125,25 @@ export default class DialogView extends DialogView_base implements DraggableView
125
125
  */
126
126
  _isTransparent: boolean;
127
127
  /**
128
- * The calculated `top` CSS dialog property used for positioning.
128
+ * The calculated dialog `top` CSS property used for positioning.
129
129
  *
130
130
  * @observable
131
131
  * @internal
132
132
  */
133
133
  _top: number;
134
134
  /**
135
- * The calculated `left` CSS dialog property used for positioning.
135
+ * The calculated dialog `left` CSS property used for positioning.
136
136
  *
137
137
  * @observable
138
138
  * @internal
139
139
  */
140
140
  _left: number;
141
141
  /**
142
- * Callback returning the DOM root that requested the dialog.
142
+ * A callback returning the DOM root that requested the dialog.
143
143
  */
144
144
  private _getCurrentDomRoot;
145
145
  /**
146
- * Callback returning the configured editor viewport offset.
146
+ * A callback returning the configured editor viewport offset.
147
147
  */
148
148
  private _getViewportOffset;
149
149
  /**
@@ -171,7 +171,7 @@ export default class DialogView extends DialogView_base implements DraggableView
171
171
  get dragHandleElement(): HTMLElement | null;
172
172
  /**
173
173
  * Creates the dialog parts. Which of them are created depends on the arguments passed to the method.
174
- * There are no rules regarding the dialog construction, i.e. no part is mandatory.
174
+ * There are no rules regarding the dialog construction, that is, no part is mandatory.
175
175
  * Each part can only be created once.
176
176
  *
177
177
  * @internal
@@ -188,7 +188,7 @@ export default class DialogView extends DialogView_base implements DraggableView
188
188
  */
189
189
  focus(): void;
190
190
  /**
191
- * Normalises the passed coordinates to make sure the dialog view
191
+ * Normalizes the passed coordinates to make sure the dialog view
192
192
  * is displayed within the visible viewport and moves it there.
193
193
  *
194
194
  * @internal
@@ -206,11 +206,11 @@ export default class DialogView extends DialogView_base implements DraggableView
206
206
  moveBy(left: number, top: number): void;
207
207
  /**
208
208
  * Moves the dialog view to the off-screen position.
209
- * Used when there's no space to display the dialog.
209
+ * Used when there is no space to display the dialog.
210
210
  */
211
211
  private _moveOffScreen;
212
212
  /**
213
- * Recalculates the dialog according to the set position and viewport
213
+ * Recalculates the dialog according to the set position and viewport,
214
214
  * and moves it to the new position.
215
215
  */
216
216
  updatePosition(): void;
@@ -232,7 +232,7 @@ export default class DialogView extends DialogView_base implements DraggableView
232
232
  */
233
233
  private _updateFocusCyclableItems;
234
234
  /**
235
- * Creates a close button view that is displayed in the header view corner.
235
+ * Creates the close button view that is displayed in the header view corner.
236
236
  */
237
237
  private _createCloseButton;
238
238
  }
@@ -6,6 +6,7 @@
6
6
  * @module ui/dialog/dialogview
7
7
  */
8
8
  import { KeystrokeHandler, FocusTracker, Rect, global, toUnit } from '@ckeditor/ckeditor5-utils';
9
+ import { icons } from '@ckeditor/ckeditor5-core';
9
10
  import ViewCollection from '../viewcollection.js';
10
11
  import View from '../view.js';
11
12
  import FormHeaderView from '../formheader/formheaderview.js';
@@ -16,21 +17,20 @@ import DialogActionsView from './dialogactionsview.js';
16
17
  import DialogContentView from './dialogcontentview.js';
17
18
  import '../../theme/components/dialog/dialog.css';
18
19
  // @if CK_DEBUG_DIALOG // const RectDrawer = require( '@ckeditor/ckeditor5-utils/tests/_utils/rectdrawer' ).default;
19
- import cancelIcon from '@ckeditor/ckeditor5-core/theme/icons/cancel.svg';
20
20
  /**
21
21
  * Available dialog view positions:
22
22
  *
23
- * * `DialogViewPosition.SCREEN_CENTER` - a fixed position in the center of the screen,
24
- * * `DialogViewPosition.EDITOR_CENTER` - a dynamic position in the center of the editor editable area,
25
- * * `DialogViewPosition.EDITOR_TOP_SIDE` - a dynamic position at the top-right (for the left-to-right languages)
26
- * or top-left (for right-to-left languages) corner of the editor editable area,
27
- * * `DialogViewPosition.EDITOR_TOP_CENTER` - a dynamic position at the top-center of the editor editable area,
28
- * * `DialogViewPosition.EDITOR_BOTTOM_CENTER` - a dynamic position at the bottom-center of the editor editable area,
29
- * * `DialogViewPosition.EDITOR_ABOVE_CENTER` - a dynamic position centered above the editor editable area,
30
- * * `DialogViewPosition.EDITOR_BELOW_CENTER` - a dynamic position centered below the editor editable area.
23
+ * * `DialogViewPosition.SCREEN_CENTER` &ndash; A fixed position in the center of the screen.
24
+ * * `DialogViewPosition.EDITOR_CENTER` &ndash; A dynamic position in the center of the editor editable area.
25
+ * * `DialogViewPosition.EDITOR_TOP_SIDE` &ndash; A dynamic position at the top-right (for the left-to-right languages)
26
+ * or top-left (for right-to-left languages) corner of the editor editable area.
27
+ * * `DialogViewPosition.EDITOR_TOP_CENTER` &ndash; A dynamic position at the top-center of the editor editable area.
28
+ * * `DialogViewPosition.EDITOR_BOTTOM_CENTER` &ndash; A dynamic position at the bottom-center of the editor editable area.
29
+ * * `DialogViewPosition.EDITOR_ABOVE_CENTER` &ndash; A dynamic position centered above the editor editable area.
30
+ * * `DialogViewPosition.EDITOR_BELOW_CENTER` &ndash; A dynamic position centered below the editor editable area.
31
31
  *
32
32
  * The position of a dialog is specified by a {@link module:ui/dialog/dialog~DialogDefinition#position `position` property} of a
33
- * definition passed to {@link module:ui/dialog/dialog~Dialog#show} method.
33
+ * definition passed to the {@link module:ui/dialog/dialog~Dialog#show} method.
34
34
  */
35
35
  export const DialogViewPosition = {
36
36
  SCREEN_CENTER: 'screen-center',
@@ -53,7 +53,7 @@ class DialogView extends DraggableViewMixin(View) {
53
53
  super(locale);
54
54
  /**
55
55
  * A flag indicating if the dialog was moved manually. If so, its position
56
- * won't be updated automatically upon window resize or document scroll.
56
+ * will not be updated automatically upon window resize or document scroll.
57
57
  */
58
58
  this.wasMoved = false;
59
59
  const bind = this.bindTemplate;
@@ -176,7 +176,7 @@ class DialogView extends DraggableViewMixin(View) {
176
176
  }
177
177
  /**
178
178
  * Creates the dialog parts. Which of them are created depends on the arguments passed to the method.
179
- * There are no rules regarding the dialog construction, i.e. no part is mandatory.
179
+ * There are no rules regarding the dialog construction, that is, no part is mandatory.
180
180
  * Each part can only be created once.
181
181
  *
182
182
  * @internal
@@ -215,7 +215,7 @@ class DialogView extends DraggableViewMixin(View) {
215
215
  this._focusCycler.focusFirst();
216
216
  }
217
217
  /**
218
- * Normalises the passed coordinates to make sure the dialog view
218
+ * Normalizes the passed coordinates to make sure the dialog view
219
219
  * is displayed within the visible viewport and moves it there.
220
220
  *
221
221
  * @internal
@@ -256,13 +256,13 @@ class DialogView extends DraggableViewMixin(View) {
256
256
  }
257
257
  /**
258
258
  * Moves the dialog view to the off-screen position.
259
- * Used when there's no space to display the dialog.
259
+ * Used when there is no space to display the dialog.
260
260
  */
261
261
  _moveOffScreen() {
262
262
  this._moveTo(-9999, -9999);
263
263
  }
264
264
  /**
265
- * Recalculates the dialog according to the set position and viewport
265
+ * Recalculates the dialog according to the set position and viewport,
266
266
  * and moves it to the new position.
267
267
  */
268
268
  updatePosition() {
@@ -431,7 +431,7 @@ class DialogView extends DraggableViewMixin(View) {
431
431
  });
432
432
  }
433
433
  /**
434
- * Creates a close button view that is displayed in the header view corner.
434
+ * Creates the close button view that is displayed in the header view corner.
435
435
  */
436
436
  _createCloseButton() {
437
437
  const buttonView = new ButtonView(this.locale);
@@ -439,7 +439,7 @@ class DialogView extends DraggableViewMixin(View) {
439
439
  buttonView.set({
440
440
  label: t('Close'),
441
441
  tooltip: true,
442
- icon: cancelIcon
442
+ icon: icons.cancel
443
443
  });
444
444
  buttonView.on('execute', () => this.fire('close', { source: 'closeButton' }));
445
445
  return buttonView;