@ckeditor/ckeditor5-ui 34.2.0 → 35.1.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 (91) hide show
  1. package/CHANGELOG.md +542 -0
  2. package/LICENSE.md +4 -0
  3. package/lang/contexts.json +4 -2
  4. package/lang/translations/ar.po +31 -23
  5. package/lang/translations/ast.po +12 -4
  6. package/lang/translations/az.po +12 -4
  7. package/lang/translations/bg.po +113 -0
  8. package/lang/translations/bn.po +113 -0
  9. package/lang/translations/ca.po +113 -0
  10. package/lang/translations/cs.po +12 -4
  11. package/lang/translations/da.po +12 -4
  12. package/lang/translations/de-ch.po +12 -4
  13. package/lang/translations/de.po +12 -4
  14. package/lang/translations/el.po +12 -4
  15. package/lang/translations/en-au.po +12 -4
  16. package/lang/translations/en-gb.po +12 -4
  17. package/lang/translations/en.po +12 -4
  18. package/lang/translations/eo.po +12 -4
  19. package/lang/translations/es.po +12 -4
  20. package/lang/translations/et.po +12 -4
  21. package/lang/translations/eu.po +12 -4
  22. package/lang/translations/fa.po +12 -4
  23. package/lang/translations/fi.po +14 -6
  24. package/lang/translations/fr.po +12 -4
  25. package/lang/translations/gl.po +12 -4
  26. package/lang/translations/he.po +26 -18
  27. package/lang/translations/hi.po +12 -4
  28. package/lang/translations/hr.po +12 -4
  29. package/lang/translations/hu.po +12 -4
  30. package/lang/translations/id.po +12 -4
  31. package/lang/translations/it.po +12 -4
  32. package/lang/translations/ja.po +17 -9
  33. package/lang/translations/km.po +12 -4
  34. package/lang/translations/kn.po +12 -4
  35. package/lang/translations/ko.po +12 -4
  36. package/lang/translations/ku.po +12 -4
  37. package/lang/translations/lt.po +16 -8
  38. package/lang/translations/lv.po +12 -4
  39. package/lang/translations/ms.po +113 -0
  40. package/lang/translations/nb.po +12 -4
  41. package/lang/translations/ne.po +12 -4
  42. package/lang/translations/nl.po +12 -4
  43. package/lang/translations/no.po +12 -4
  44. package/lang/translations/pl.po +12 -4
  45. package/lang/translations/pt-br.po +12 -4
  46. package/lang/translations/pt.po +29 -21
  47. package/lang/translations/ro.po +12 -4
  48. package/lang/translations/ru.po +12 -4
  49. package/lang/translations/sk.po +12 -4
  50. package/lang/translations/sl.po +11 -3
  51. package/lang/translations/sq.po +12 -4
  52. package/lang/translations/sr-latn.po +12 -4
  53. package/lang/translations/sr.po +12 -4
  54. package/lang/translations/sv.po +31 -23
  55. package/lang/translations/th.po +18 -10
  56. package/lang/translations/tk.po +12 -4
  57. package/lang/translations/tr.po +12 -4
  58. package/lang/translations/tt.po +113 -0
  59. package/lang/translations/ug.po +12 -4
  60. package/lang/translations/uk.po +12 -4
  61. package/lang/translations/ur.po +29 -21
  62. package/lang/translations/uz.po +12 -4
  63. package/lang/translations/vi.po +12 -4
  64. package/lang/translations/zh-cn.po +12 -4
  65. package/lang/translations/zh.po +12 -4
  66. package/package.json +23 -20
  67. package/src/bindings/addkeyboardhandlingforgrid.js +76 -0
  68. package/src/button/button.jsdoc +2 -2
  69. package/src/button/buttonview.js +19 -35
  70. package/src/colorgrid/colorgridview.js +19 -25
  71. package/src/dropdown/button/dropdownbuttonview.js +2 -1
  72. package/src/dropdown/button/splitbuttonview.js +4 -1
  73. package/src/dropdown/dropdownpanelview.js +22 -2
  74. package/src/dropdown/dropdownview.js +12 -2
  75. package/src/dropdown/utils.js +71 -1
  76. package/src/editableui/inline/inlineeditableuiview.js +18 -3
  77. package/src/icon/iconview.js +3 -1
  78. package/src/index.js +2 -2
  79. package/src/list/listitemview.js +14 -1
  80. package/src/panel/balloon/balloonpanelview.js +132 -78
  81. package/src/toolbar/balloon/balloontoolbar.js +17 -5
  82. package/src/toolbar/block/blocktoolbar.js +17 -0
  83. package/src/tooltipmanager.js +430 -0
  84. package/theme/components/button/button.css +0 -8
  85. package/theme/components/dropdown/dropdown.css +0 -12
  86. package/theme/components/dropdown/splitbutton.css +0 -7
  87. package/theme/components/responsive-form/responsiveform.css +28 -16
  88. package/theme/components/tooltip/tooltip.css +3 -26
  89. package/src/toolbar/enabletoolbarkeyboardfocus.js +0 -64
  90. package/src/tooltip/tooltipview.js +0 -107
  91. package/theme/components/tooltip/mixins/_tooltip.css +0 -54
@@ -0,0 +1,430 @@
1
+ /**
2
+ * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+
6
+ /**
7
+ * @module ui/tooltipmanager
8
+ */
9
+
10
+ import View from './view';
11
+ import BalloonPanelView, { generatePositions } from './panel/balloon/balloonpanelview';
12
+
13
+ import DomEmitterMixin from '@ckeditor/ckeditor5-utils/src/dom/emittermixin';
14
+ import { global, isVisible, mix, first } from '@ckeditor/ckeditor5-utils';
15
+ import { isElement, debounce } from 'lodash-es';
16
+
17
+ import '../theme/components/tooltip/tooltip.css';
18
+
19
+ const BALLOON_CLASS = 'ck-tooltip';
20
+
21
+ /**
22
+ * A tooltip manager class for the UI of the editor.
23
+ *
24
+ * **Note**: Most likely you do not have to use the `TooltipManager` API listed below in order to display tooltips. Popular
25
+ * {@glink framework/guides/architecture/ui-library UI components} support tooltips out-of-the-box via observable properties
26
+ * (see {@link module:ui/button/buttonview~ButtonView#tooltip} and {@link module:ui/button/buttonview~ButtonView#tooltipPosition}).
27
+ *
28
+ * # Displaying tooltips
29
+ *
30
+ * To display a tooltip, set `data-cke-tooltip-text` attribute on any DOM element:
31
+ *
32
+ * domElement.dataset.ckeTooltipText = 'My tooltip';
33
+ *
34
+ * The tooltip will show up whenever the user moves the mouse over the element or the element gets focus in DOM.
35
+ *
36
+ * # Positioning tooltips
37
+ *
38
+ * To change the position of the tooltip, use the `data-cke-tooltip-position` attribute (`s`, `se`, `sw`, `n`, `e`, or `w`):
39
+ *
40
+ * domElement.dataset.ckeTooltipText = 'Tooltip to the north';
41
+ * domElement.dataset.ckeTooltipPosition = 'n';
42
+ *
43
+ * # Disabling tooltips
44
+ *
45
+ * In order to disable the tooltip temporarily, use the `data-cke-tooltip-disabled` attribute:
46
+ *
47
+ * domElement.dataset.ckeTooltipText = 'Disabled. For now.';
48
+ * domElement.dataset.ckeTooltipDisabled = 'true';
49
+ *
50
+ *
51
+ * # Styling tooltips
52
+ *
53
+ * By default, the tooltip has `.ck-tooltip` class and its text inner `.ck-tooltip__text`.
54
+ *
55
+ * If your tooltip requires custom styling, using `data-cke-tooltip-class` attribute will add additional class to the balloon
56
+ * displaying the tooltip:
57
+ *
58
+ * domElement.dataset.ckeTooltipText = 'Tooltip with a red text';
59
+ * domElement.dataset.ckeTooltipClass = 'my-class';
60
+ *
61
+ * .ck.ck-tooltip.my-class { color: red }
62
+ *
63
+ * **Note**: This class is a singleton. All editor instances re-use the same instance loaded by
64
+ * {@link module:core/editor/editorui~EditorUI} of the first editor.
65
+ *
66
+ * @mixes module:utils/domemittermixin~DomEmitterMixin
67
+ */
68
+ export default class TooltipManager {
69
+ /**
70
+ * Creates an instance of the tooltip manager.
71
+ *
72
+ * @param {module:core/editor/editor~Editor} editor
73
+ */
74
+ constructor( editor ) {
75
+ TooltipManager._editors.add( editor );
76
+
77
+ // TooltipManager must be a singleton. Multiple instances would mean multiple tooltips attached
78
+ // to the same DOM element with data-cke-tooltip-* attributes.
79
+ if ( TooltipManager._instance ) {
80
+ return TooltipManager._instance;
81
+ }
82
+
83
+ TooltipManager._instance = this;
84
+
85
+ /**
86
+ * The view rendering text of the tooltip.
87
+ *
88
+ * @readonly
89
+ * @member {module:ui/view~View} #tooltipTextView
90
+ */
91
+ this.tooltipTextView = new View( editor.locale );
92
+ this.tooltipTextView.set( 'text', '' );
93
+ this.tooltipTextView.setTemplate( {
94
+ tag: 'span',
95
+ attributes: {
96
+ class: [
97
+ 'ck',
98
+ 'ck-tooltip__text'
99
+ ]
100
+ },
101
+ children: [
102
+ {
103
+ text: this.tooltipTextView.bindTemplate.to( 'text' )
104
+ }
105
+ ]
106
+ } );
107
+
108
+ /**
109
+ * The instance of the balloon panel that renders and positions the tooltip.
110
+ *
111
+ * @readonly
112
+ * @member {module:ui/panel/balloon/balloonpanelview~BalloonPanelView} #balloonPanelView
113
+ */
114
+ this.balloonPanelView = new BalloonPanelView( editor.locale );
115
+ this.balloonPanelView.class = BALLOON_CLASS;
116
+ this.balloonPanelView.content.add( this.tooltipTextView );
117
+
118
+ /**
119
+ * Stores the reference to the DOM element the tooltip is attached to. `null` when there's no tooltip
120
+ * in the UI.
121
+ *
122
+ * @private
123
+ * @readonly
124
+ * @member {HTMLElement|null} #_currentElementWithTooltip
125
+ */
126
+ this._currentElementWithTooltip = null;
127
+
128
+ /**
129
+ * Stores the current tooltip position. `null` when there's no tooltip in the UI.
130
+ *
131
+ * @private
132
+ * @readonly
133
+ * @member {String|null} #_currentTooltipPosition
134
+ */
135
+ this._currentTooltipPosition = null;
136
+
137
+ /**
138
+ * A debounced version of {@link #_pinTooltip}. Tooltips show with a delay to avoid flashing and
139
+ * to improve the UX.
140
+ *
141
+ * @private
142
+ * @readonly
143
+ * @member {Function} #_pinTooltipDebounced
144
+ */
145
+ this._pinTooltipDebounced = debounce( this._pinTooltip, 600 );
146
+
147
+ this.listenTo( global.document, 'mouseenter', this._onEnterOrFocus.bind( this ), { useCapture: true } );
148
+ this.listenTo( global.document, 'mouseleave', this._onLeaveOrBlur.bind( this ), { useCapture: true } );
149
+
150
+ this.listenTo( global.document, 'focus', this._onEnterOrFocus.bind( this ), { useCapture: true } );
151
+ this.listenTo( global.document, 'blur', this._onLeaveOrBlur.bind( this ), { useCapture: true } );
152
+
153
+ this.listenTo( global.document, 'scroll', this._onScroll.bind( this ), { useCapture: true } );
154
+
155
+ // Because this class is a singleton, its only instance is shared across all editors and connects them through the reference.
156
+ // This causes issues with the ContextWatchdog. When an error is thrown in one editor, the watchdog traverses the references
157
+ // and (because of shared tooltip manager) figures that the error affects all editors and restarts them all.
158
+ // This flag, excludes tooltip manager instance from the traversal and brings ContextWatchdog back to normal.
159
+ // More in https://github.com/ckeditor/ckeditor5/issues/12292.
160
+ this._watchdogExcluded = true;
161
+ }
162
+
163
+ /**
164
+ * Destroys the tooltip manager.
165
+ *
166
+ * **Note**: The manager singleton cannot be destroyed until all editors that use it are destroyed.
167
+ *
168
+ * @param {module:core/editor/editor~Editor} editor The editor the manager was created for.
169
+ */
170
+ destroy( editor ) {
171
+ TooltipManager._editors.delete( editor );
172
+ this.stopListening( editor.ui );
173
+
174
+ if ( !TooltipManager._editors.size ) {
175
+ this._unpinTooltip();
176
+ this.balloonPanelView.destroy();
177
+ this.stopListening();
178
+
179
+ TooltipManager._instance = null;
180
+ }
181
+ }
182
+
183
+ /**
184
+ * Handles displaying tooltips on `mouseenter` and `focus` in DOM.
185
+ *
186
+ * @private
187
+ * @param {module:utils/eventinfo~EventInfo} evt An object containing information about the fired event.
188
+ * @param {Event} domEvent The DOM event.
189
+ */
190
+ _onEnterOrFocus( evt, { target } ) {
191
+ const elementWithTooltipAttribute = getDescendantWithTooltip( target );
192
+
193
+ // Abort when there's no descendant needing tooltip.
194
+ if ( !elementWithTooltipAttribute ) {
195
+ return;
196
+ }
197
+
198
+ // Abort to avoid flashing when, for instance:
199
+ // * a tooltip is displayed for a focused element, then the same element gets mouseentered,
200
+ // * a tooltip is displayed for an element via mouseenter, then the focus moves to the same element.
201
+ if ( elementWithTooltipAttribute === this._currentElementWithTooltip ) {
202
+ return;
203
+ }
204
+
205
+ this._unpinTooltip();
206
+
207
+ this._pinTooltipDebounced( elementWithTooltipAttribute, getTooltipData( elementWithTooltipAttribute ) );
208
+ }
209
+
210
+ /**
211
+ * Handles hiding tooltips on `mouseleave` and `blur` in DOM.
212
+ *
213
+ * @private
214
+ * @param {module:utils/eventinfo~EventInfo} evt An object containing information about the fired event.
215
+ * @param {Event} domEvent The DOM event.
216
+ */
217
+ _onLeaveOrBlur( evt, { target, relatedTarget } ) {
218
+ if ( evt.name === 'mouseleave' ) {
219
+ // Don't act when the event does not concern a DOM element (e.g. a mouseleave out of an entire document),
220
+ if ( !isElement( target ) ) {
221
+ return;
222
+ }
223
+
224
+ // If a tooltip is currently visible, don't act for a targets other than the one it is attached to.
225
+ // For instance, a random mouseleave far away in the page should not unpin the tooltip that was pinned because
226
+ // of a previous focus. Only leaving the same element should hide the tooltip.
227
+ if ( this._currentElementWithTooltip && target !== this._currentElementWithTooltip ) {
228
+ return;
229
+ }
230
+
231
+ const descendantWithTooltip = getDescendantWithTooltip( target );
232
+ const relatedDescendantWithTooltip = getDescendantWithTooltip( relatedTarget );
233
+
234
+ // Unpin when the mouse was leaving element with a tooltip to a place which does not have or has a different tooltip.
235
+ // Note that this should happen whether the tooltip is already visible or not, for instance, it could be invisible but queued
236
+ // (debounced): it should get canceled.
237
+ if ( descendantWithTooltip && descendantWithTooltip !== relatedDescendantWithTooltip ) {
238
+ this._unpinTooltip();
239
+ }
240
+ }
241
+ else {
242
+ // If a tooltip is currently visible, don't act for a targets other than the one it is attached to.
243
+ // For instance, a random blur in the web page should not unpin the tooltip that was pinned because of a previous mouseenter.
244
+ if ( this._currentElementWithTooltip && target !== this._currentElementWithTooltip ) {
245
+ return;
246
+ }
247
+
248
+ // Note that unpinning should happen whether the tooltip is already visible or not, for instance, it could be invisible but
249
+ // queued (debounced): it should get canceled (e.g. quick focus then quick blur using the keyboard).
250
+ this._unpinTooltip();
251
+ }
252
+ }
253
+
254
+ /**
255
+ * Handles hiding tooltips on `scroll` in DOM.
256
+ *
257
+ * @private
258
+ * @param {module:utils/eventinfo~EventInfo} evt An object containing information about the fired event.
259
+ * @param {Event} domEvent The DOM event.
260
+ */
261
+ _onScroll( evt, { target } ) {
262
+ // No tooltip, no reason to react on scroll.
263
+ if ( !this._currentElementWithTooltip ) {
264
+ return;
265
+ }
266
+
267
+ // When scrolling a container that has both the balloon and the current element (common ancestor), the balloon can remain
268
+ // visible (e.g. scrolling ≤body>). Otherwise, to avoid glitches (clipping, lagging) better just hide the tooltip.
269
+ // Also, don't do anything when scrolling an unrelated DOM element that has nothing to do with the current element and the balloon.
270
+ if ( target.contains( this.balloonPanelView.element ) && target.contains( this._currentElementWithTooltip ) ) {
271
+ return;
272
+ }
273
+
274
+ this._unpinTooltip();
275
+ }
276
+
277
+ /**
278
+ * Pins the tooltip to a specific DOM element.
279
+ *
280
+ * @private
281
+ * @param {Element} targetDomElement
282
+ * @param {Object} options
283
+ * @param {String} options.text Text of the tooltip to display.
284
+ * @param {String} options.position The position of the tooltip.
285
+ * @param {String} options.cssClass Additional CSS class of the balloon with the tooltip.
286
+ */
287
+ _pinTooltip( targetDomElement, { text, position, cssClass } ) {
288
+ // Use the body collection of the first editor.
289
+ const bodyViewCollection = first( TooltipManager._editors.values() ).ui.view.body;
290
+
291
+ if ( !bodyViewCollection.has( this.balloonPanelView ) ) {
292
+ bodyViewCollection.add( this.balloonPanelView );
293
+ }
294
+
295
+ this.tooltipTextView.text = text;
296
+
297
+ this.balloonPanelView.pin( {
298
+ target: targetDomElement,
299
+ positions: TooltipManager.getPositioningFunctions( position )
300
+ } );
301
+
302
+ this.balloonPanelView.class = [ BALLOON_CLASS, cssClass ]
303
+ .filter( className => className )
304
+ .join( ' ' );
305
+
306
+ // Start responding to changes in editor UI or content layout. For instance, when collaborators change content
307
+ // and a contextual toolbar attached to a content starts to move (and so should move the tooltip).
308
+ // Note: Using low priority to let other listeners that position contextual toolbars etc. to react first.
309
+ for ( const editor of TooltipManager._editors ) {
310
+ this.listenTo( editor.ui, 'update', this._updateTooltipPosition.bind( this ), { priority: 'low' } );
311
+ }
312
+
313
+ this._currentElementWithTooltip = targetDomElement;
314
+ this._currentTooltipPosition = position;
315
+ }
316
+
317
+ /**
318
+ * Unpins the tooltip and cancels all queued pinning.
319
+ *
320
+ * @private
321
+ */
322
+ _unpinTooltip() {
323
+ this._pinTooltipDebounced.cancel();
324
+
325
+ this.balloonPanelView.unpin();
326
+
327
+ for ( const editor of TooltipManager._editors ) {
328
+ this.stopListening( editor.ui, 'update' );
329
+ }
330
+
331
+ this._currentElementWithTooltip = null;
332
+ this._currentTooltipPosition = null;
333
+ }
334
+
335
+ /**
336
+ * Updates the position of the tooltip so it stays in sync with the element it is pinned to.
337
+ *
338
+ * Hides the tooltip when the element is no longer visible in DOM.
339
+ *
340
+ * @private
341
+ */
342
+ _updateTooltipPosition() {
343
+ // This could happen if the tooltip was attached somewhere in a contextual content toolbar and the toolbar
344
+ // disappeared (e.g. removed an image).
345
+ if ( !isVisible( this._currentElementWithTooltip ) ) {
346
+ this._unpinTooltip();
347
+
348
+ return;
349
+ }
350
+
351
+ this.balloonPanelView.pin( {
352
+ target: this._currentElementWithTooltip,
353
+ positions: TooltipManager.getPositioningFunctions( this._currentTooltipPosition )
354
+ } );
355
+ }
356
+
357
+ /**
358
+ * Returns {@link #balloonPanelView} {@link module:utils/dom/position~PositioningFunction positioning functions} for a given position
359
+ * name.
360
+ *
361
+ * @static
362
+ * @param {String} position Name of the position (`s`, `se`, `sw`, `n`, `e`, or `w`).
363
+ * @returns {Array.<module:utils/dom/position~PositioningFunction>} Positioning functions to be used by the {@link #balloonPanelView}.
364
+ */
365
+ static getPositioningFunctions( position ) {
366
+ const defaultPositions = TooltipManager.defaultBalloonPositions;
367
+
368
+ return {
369
+ // South is most popular. We can use positioning heuristics to avoid clipping by the viewport with the sane fallback.
370
+ s: [
371
+ defaultPositions.southArrowNorth,
372
+ defaultPositions.southArrowNorthEast,
373
+ defaultPositions.southArrowNorthWest
374
+ ],
375
+ n: [ defaultPositions.northArrowSouth ],
376
+ e: [ defaultPositions.eastArrowWest ],
377
+ w: [ defaultPositions.westArrowEast ],
378
+ sw: [ defaultPositions.southArrowNorthEast ],
379
+ se: [ defaultPositions.southArrowNorthWest ]
380
+ }[ position ];
381
+ }
382
+ }
383
+
384
+ mix( TooltipManager, DomEmitterMixin );
385
+
386
+ /**
387
+ * A set of default {@link module:utils/dom/position~PositioningFunction positioning functions} used by the `TooltipManager`
388
+ * to pin tooltips in different positions.
389
+ *
390
+ * @member {Object.<String,module:utils/dom/position~PositioningFunction>}
391
+ * module:ui/tooltipmanager~TooltipManager.defaultBalloonPositions
392
+ */
393
+ TooltipManager.defaultBalloonPositions = generatePositions( {
394
+ heightOffset: 5,
395
+ sideOffset: 13
396
+ } );
397
+
398
+ /**
399
+ * A reference to the `TooltipManager` instance. The class is a singleton and as such,
400
+ * successive attempts at creating instances should return this instance.
401
+ *
402
+ * @private
403
+ * @member {module:ui/tooltipmanager~TooltipManager} module:ui/tooltipmanager~TooltipManager._instance
404
+ */
405
+ TooltipManager._instance = null;
406
+
407
+ /**
408
+ * An array of editors the single tooltip manager instance must listen to.
409
+ * This is mostly to handle `EditorUI#update` listeners from individual editors.
410
+ *
411
+ * @private
412
+ * @member {Set.<module:core/editor/editor~Editor>} module:ui/tooltipmanager~TooltipManager._editors
413
+ */
414
+ TooltipManager._editors = new Set();
415
+
416
+ function getDescendantWithTooltip( element ) {
417
+ if ( !isElement( element ) ) {
418
+ return null;
419
+ }
420
+
421
+ return element.closest( '[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])' );
422
+ }
423
+
424
+ function getTooltipData( element ) {
425
+ return {
426
+ text: element.dataset.ckeTooltipText,
427
+ position: element.dataset.ckeTooltipPosition || 's',
428
+ cssClass: element.dataset.ckeTooltipClass || ''
429
+ };
430
+ }
@@ -4,12 +4,10 @@
4
4
  */
5
5
 
6
6
  @import "../../mixins/_unselectable.css";
7
- @import "../tooltip/mixins/_tooltip.css";
8
7
 
9
8
  .ck.ck-button,
10
9
  a.ck.ck-button {
11
10
  @mixin ck-unselectable;
12
- @mixin ck-tooltip_enabled;
13
11
 
14
12
  position: relative;
15
13
  display: inline-flex;
@@ -30,10 +28,4 @@ a.ck.ck-button {
30
28
  &:not(.ck-button_with-text) {
31
29
  justify-content: center;
32
30
  }
33
-
34
- &:hover,
35
- /* Enable toolbar button tooltips for keyboard users too. See https://github.com/ckeditor/ckeditor5/issues/5581. */
36
- &:focus {
37
- @mixin ck-tooltip_visible;
38
- }
39
31
  }
@@ -3,8 +3,6 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
6
- @import "../tooltip/mixins/_tooltip.css";
7
-
8
6
  :root {
9
7
  --ck-dropdown-max-width: 75vw;
10
8
  }
@@ -21,19 +19,9 @@
21
19
  /* Dropdown button should span horizontally, e.g. in vertical toolbars */
22
20
  & .ck-button.ck-dropdown__button {
23
21
  width: 100%;
24
-
25
- /* Disable main button's tooltip when the dropdown is open. Otherwise the panel may
26
- partially cover the tooltip */
27
- &.ck-on {
28
- @mixin ck-tooltip_disabled;
29
- }
30
22
  }
31
23
 
32
24
  & .ck-dropdown__panel {
33
- /* This is to get rid of flickering when the tooltip is shown under the panel,
34
- which looks like the panel moves vertically a pixel down and up. */
35
- -webkit-backface-visibility: hidden;
36
-
37
25
  display: none;
38
26
  z-index: var(--ck-z-modal);
39
27
  max-width: var(--ck-dropdown-max-width);
@@ -3,8 +3,6 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
6
- @import "../tooltip/mixins/_tooltip.css";
7
-
8
6
  .ck.ck-splitbutton {
9
7
  /* Enable font size inheritance, which allows fluid UI scaling. */
10
8
  font-size: inherit;
@@ -12,10 +10,5 @@
12
10
  & .ck-splitbutton__action:focus {
13
11
  z-index: calc(var(--ck-z-default) + 1);
14
12
  }
15
-
16
- /* Disable tooltips for the buttons when the button is "open" */
17
- &.ck-splitbutton_open > .ck-button {
18
- @mixin ck-tooltip_disabled;
19
- }
20
13
  }
21
14
 
@@ -5,26 +5,38 @@
5
5
 
6
6
  @import "@ckeditor/ckeditor5-ui/theme/mixins/_rwd.css";
7
7
 
8
- .ck-vertical-form .ck-button::after {
9
- content: "";
10
- width: 0;
11
- position: absolute;
12
- right: -1px;
13
- top: var(--ck-spacing-small);
14
- bottom: var(--ck-spacing-small);
15
- z-index: 1;
8
+ .ck-vertical-form .ck-button {
9
+ &::after {
10
+ content: "";
11
+ width: 0;
12
+ position: absolute;
13
+ right: -1px;
14
+ top: -1px;
15
+ bottom: -1px;
16
+ z-index: 1;
17
+ }
18
+
19
+ &:focus::after {
20
+ display: none;
21
+ }
16
22
  }
17
23
 
18
24
  .ck.ck-responsive-form {
19
25
  @mixin ck-media-phone {
20
- & .ck-button::after {
21
- content: "";
22
- width: 0;
23
- position: absolute;
24
- right: -1px;
25
- top: var(--ck-spacing-small);
26
- bottom: var(--ck-spacing-small);
27
- z-index: 1;
26
+ & .ck-button {
27
+ &::after {
28
+ content: "";
29
+ width: 0;
30
+ position: absolute;
31
+ right: -1px;
32
+ top: -1px;
33
+ bottom: -1px;
34
+ z-index: 1;
35
+ }
36
+
37
+ &:focus::after {
38
+ display: none;
39
+ }
28
40
  }
29
41
  }
30
42
  }
@@ -3,32 +3,9 @@
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
 
6
- .ck.ck-tooltip,
7
- .ck.ck-tooltip .ck-tooltip__text::after {
8
- position: absolute;
9
-
10
- /* Without this, hovering the tooltip could keep it visible. */
6
+ .ck.ck-balloon-panel.ck-tooltip {
7
+ /* Keep tooltips transparent for any interactions. */
11
8
  pointer-events: none;
12
9
 
13
- /* This is to get rid of flickering when transitioning opacity in Chrome.
14
- It's weird but it works. */
15
- -webkit-backface-visibility: hidden;
16
- }
17
-
18
- .ck.ck-tooltip {
19
- /* Tooltip is hidden by default. */
20
- visibility: hidden;
21
- opacity: 0;
22
- display: none;
23
- z-index: var(--ck-z-modal);
24
-
25
- & .ck-tooltip__text {
26
- display: inline-block;
27
-
28
- &::after {
29
- content: "";
30
- width: 0;
31
- height: 0;
32
- }
33
- }
10
+ z-index: calc( var(--ck-z-modal) + 100 );
34
11
  }
@@ -1,64 +0,0 @@
1
- /**
2
- * @license Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
-
6
- /**
7
- * @module ui/toolbar/enabletoolbarkeyboardfocus
8
- */
9
-
10
- /**
11
- * Enables focus/blur toolbar navigation using `Alt+F10` and `Esc` keystrokes.
12
- *
13
- * @param {Object} options Options of the utility.
14
- * @param {*} options.origin A view to which the focus will return when `Esc` is pressed and
15
- * `options.toolbar` is focused.
16
- * @param {module:utils/keystrokehandler~KeystrokeHandler} options.originKeystrokeHandler A keystroke
17
- * handler to register `Alt+F10` keystroke.
18
- * @param {module:utils/focustracker~FocusTracker} options.originFocusTracker A focus tracker
19
- * for `options.origin`.
20
- * @param {module:ui/toolbar/toolbarview~ToolbarView} options.toolbar A toolbar which is to gain
21
- * focus when `Alt+F10` is pressed.
22
- * @param {Function} [options.beforeFocus] A callback executed before the `options.toolbar` gains focus
23
- * upon the `Alt+F10` keystroke.
24
- * @param {Function} [options.afterBlur] A callback executed after `options.toolbar` loses focus upon
25
- * `Esc` keystroke but before the focus goes back to `options.origin`.
26
- */
27
- export default function enableToolbarKeyboardFocus( {
28
- origin,
29
- originKeystrokeHandler,
30
- originFocusTracker,
31
- toolbar,
32
- beforeFocus,
33
- afterBlur
34
- } ) {
35
- // Because toolbar items can get focus, the overall state of the toolbar must
36
- // also be tracked.
37
- originFocusTracker.add( toolbar.element );
38
-
39
- // Focus the toolbar on the keystroke, if not already focused.
40
- originKeystrokeHandler.set( 'Alt+F10', ( data, cancel ) => {
41
- if ( originFocusTracker.isFocused && !toolbar.focusTracker.isFocused ) {
42
- if ( beforeFocus ) {
43
- beforeFocus();
44
- }
45
-
46
- toolbar.focus();
47
-
48
- cancel();
49
- }
50
- } );
51
-
52
- // Blur the toolbar and bring the focus back to origin.
53
- toolbar.keystrokes.set( 'Esc', ( data, cancel ) => {
54
- if ( toolbar.focusTracker.isFocused ) {
55
- origin.focus();
56
-
57
- if ( afterBlur ) {
58
- afterBlur();
59
- }
60
-
61
- cancel();
62
- }
63
- } );
64
- }