@ckeditor/ckeditor5-ui 47.6.1-alpha.1 → 48.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/ckeditor5-metadata.json +3 -3
- package/{src → dist}/colorselector/documentcolorcollection.d.ts +4 -4
- package/{src → dist}/dialog/dialog.d.ts +1 -1
- package/dist/index-editor.css +2728 -587
- package/dist/index.css +2673 -850
- package/dist/index.css.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/{src → dist}/menubar/menubarmenuview.d.ts +4 -0
- package/{src → dist}/view.d.ts +1 -1
- package/package.json +25 -47
- package/lang/contexts.json +0 -51
- package/lang/translations/af.po +0 -208
- package/lang/translations/ar.po +0 -208
- package/lang/translations/ast.po +0 -208
- package/lang/translations/az.po +0 -208
- package/lang/translations/be.po +0 -208
- package/lang/translations/bg.po +0 -208
- package/lang/translations/bn.po +0 -208
- package/lang/translations/bs.po +0 -208
- package/lang/translations/ca.po +0 -208
- package/lang/translations/cs.po +0 -208
- package/lang/translations/da.po +0 -208
- package/lang/translations/de-ch.po +0 -208
- package/lang/translations/de.po +0 -208
- package/lang/translations/el.po +0 -208
- package/lang/translations/en-au.po +0 -208
- package/lang/translations/en-gb.po +0 -208
- package/lang/translations/en.po +0 -208
- package/lang/translations/eo.po +0 -208
- package/lang/translations/es-co.po +0 -208
- package/lang/translations/es.po +0 -208
- package/lang/translations/et.po +0 -208
- package/lang/translations/eu.po +0 -208
- package/lang/translations/fa.po +0 -208
- package/lang/translations/fi.po +0 -208
- package/lang/translations/fr.po +0 -208
- package/lang/translations/gl.po +0 -208
- package/lang/translations/gu.po +0 -208
- package/lang/translations/he.po +0 -208
- package/lang/translations/hi.po +0 -208
- package/lang/translations/hr.po +0 -208
- package/lang/translations/hu.po +0 -208
- package/lang/translations/hy.po +0 -208
- package/lang/translations/id.po +0 -208
- package/lang/translations/it.po +0 -208
- package/lang/translations/ja.po +0 -208
- package/lang/translations/jv.po +0 -208
- package/lang/translations/kk.po +0 -208
- package/lang/translations/km.po +0 -208
- package/lang/translations/kn.po +0 -208
- package/lang/translations/ko.po +0 -208
- package/lang/translations/ku.po +0 -208
- package/lang/translations/lt.po +0 -208
- package/lang/translations/lv.po +0 -208
- package/lang/translations/ms.po +0 -208
- package/lang/translations/nb.po +0 -208
- package/lang/translations/ne.po +0 -208
- package/lang/translations/nl.po +0 -208
- package/lang/translations/no.po +0 -208
- package/lang/translations/oc.po +0 -208
- package/lang/translations/pl.po +0 -208
- package/lang/translations/pt-br.po +0 -208
- package/lang/translations/pt.po +0 -208
- package/lang/translations/ro.po +0 -208
- package/lang/translations/ru.po +0 -208
- package/lang/translations/si.po +0 -208
- package/lang/translations/sk.po +0 -208
- package/lang/translations/sl.po +0 -208
- package/lang/translations/sq.po +0 -208
- package/lang/translations/sr-latn.po +0 -208
- package/lang/translations/sr.po +0 -208
- package/lang/translations/sv.po +0 -208
- package/lang/translations/th.po +0 -208
- package/lang/translations/ti.po +0 -208
- package/lang/translations/tk.po +0 -208
- package/lang/translations/tr.po +0 -208
- package/lang/translations/tt.po +0 -208
- package/lang/translations/ug.po +0 -208
- package/lang/translations/uk.po +0 -208
- package/lang/translations/ur.po +0 -208
- package/lang/translations/uz.po +0 -208
- package/lang/translations/vi.po +0 -208
- package/lang/translations/zh-cn.po +0 -208
- package/lang/translations/zh.po +0 -208
- package/src/arialiveannouncer.js +0 -189
- package/src/augmentation.js +0 -5
- package/src/autocomplete/autocompleteview.js +0 -157
- package/src/badge/badge.js +0 -226
- package/src/bindings/addkeyboardhandlingforgrid.js +0 -107
- package/src/bindings/clickoutsidehandler.js +0 -36
- package/src/bindings/csstransitiondisablermixin.js +0 -58
- package/src/bindings/draggableviewmixin.js +0 -144
- package/src/bindings/preventdefault.js +0 -35
- package/src/bindings/submithandler.js +0 -47
- package/src/button/button.js +0 -5
- package/src/button/buttonlabel.js +0 -5
- package/src/button/buttonlabelview.js +0 -42
- package/src/button/buttonview.js +0 -278
- package/src/button/filedialogbuttonview.js +0 -147
- package/src/button/listitembuttonview.js +0 -136
- package/src/button/switchbuttonview.js +0 -79
- package/src/collapsible/collapsibleview.js +0 -106
- package/src/colorgrid/colorgridview.js +0 -140
- package/src/colorgrid/colortileview.js +0 -42
- package/src/colorgrid/utils.js +0 -84
- package/src/colorpicker/colorpickerview.js +0 -356
- package/src/colorpicker/utils.js +0 -108
- package/src/colorselector/colorgridsfragmentview.js +0 -368
- package/src/colorselector/colorpickerfragmentview.js +0 -254
- package/src/colorselector/colorselectorview.js +0 -294
- package/src/colorselector/documentcolorcollection.js +0 -42
- package/src/componentfactory.js +0 -108
- package/src/dialog/dialog.js +0 -325
- package/src/dialog/dialogactionsview.js +0 -118
- package/src/dialog/dialogcontentview.js +0 -39
- package/src/dialog/dialogview.js +0 -507
- package/src/dropdown/button/dropdownbutton.js +0 -5
- package/src/dropdown/button/dropdownbuttonview.js +0 -70
- package/src/dropdown/button/splitbuttonview.js +0 -178
- package/src/dropdown/dropdownpanelfocusable.js +0 -5
- package/src/dropdown/dropdownpanelview.js +0 -106
- package/src/dropdown/dropdownview.js +0 -438
- package/src/dropdown/menu/dropdownmenubehaviors.js +0 -125
- package/src/dropdown/menu/dropdownmenubuttonview.js +0 -69
- package/src/dropdown/menu/dropdownmenulistitembuttonview.js +0 -30
- package/src/dropdown/menu/dropdownmenulistitemview.js +0 -38
- package/src/dropdown/menu/dropdownmenulistview.js +0 -29
- package/src/dropdown/menu/dropdownmenunestedmenupanelview.js +0 -63
- package/src/dropdown/menu/dropdownmenunestedmenuview.js +0 -214
- package/src/dropdown/menu/dropdownmenurootlistview.js +0 -168
- package/src/dropdown/menu/utils.js +0 -61
- package/src/dropdown/utils.js +0 -654
- package/src/editableui/editableuiview.js +0 -130
- package/src/editableui/inline/inlineeditableuiview.js +0 -75
- package/src/editorui/accessibilityhelp/accessibilityhelp.js +0 -142
- package/src/editorui/accessibilityhelp/accessibilityhelpcontentview.js +0 -112
- package/src/editorui/bodycollection.js +0 -128
- package/src/editorui/boxed/boxededitoruiview.js +0 -95
- package/src/editorui/editorui.js +0 -586
- package/src/editorui/editoruiview.js +0 -60
- package/src/editorui/evaluationbadge.js +0 -99
- package/src/editorui/poweredby.js +0 -120
- package/src/focuscycler.js +0 -383
- package/src/formheader/formheaderview.js +0 -77
- package/src/formrow/formrowview.js +0 -56
- package/src/highlightedtext/buttonlabelwithhighlightview.js +0 -31
- package/src/highlightedtext/highlightedtextview.js +0 -102
- package/src/highlightedtext/labelwithhighlightview.js +0 -37
- package/src/icon/iconview.js +0 -123
- package/src/iframe/iframeview.js +0 -63
- package/src/index.js +0 -132
- package/src/input/inputbase.js +0 -119
- package/src/input/inputview.js +0 -24
- package/src/inputnumber/inputnumberview.js +0 -40
- package/src/inputtext/inputtextview.js +0 -27
- package/src/label/labelview.js +0 -46
- package/src/labeledfield/labeledfieldview.js +0 -177
- package/src/labeledfield/utils.js +0 -176
- package/src/labeledinput/labeledinputview.js +0 -138
- package/src/legacyerrors.js +0 -20
- package/src/list/listitemgroupview.js +0 -82
- package/src/list/listitemview.js +0 -46
- package/src/list/listseparatorview.js +0 -28
- package/src/list/listview.js +0 -210
- package/src/menubar/menubarmenubuttonview.js +0 -68
- package/src/menubar/menubarmenulistitembuttonview.js +0 -30
- package/src/menubar/menubarmenulistitemfiledialogbuttonview.js +0 -32
- package/src/menubar/menubarmenulistitemview.js +0 -34
- package/src/menubar/menubarmenulistview.js +0 -72
- package/src/menubar/menubarmenupanelview.js +0 -64
- package/src/menubar/menubarmenuview.js +0 -198
- package/src/menubar/menubarview.js +0 -281
- package/src/menubar/utils.js +0 -1432
- package/src/model.js +0 -31
- package/src/notification/notification.js +0 -192
- package/src/panel/balloon/balloonpanelview.js +0 -1077
- package/src/panel/balloon/contextualballoon.js +0 -616
- package/src/panel/sticky/stickypanelview.js +0 -246
- package/src/search/filteredview.js +0 -5
- package/src/search/filtergroupanditemnames.js +0 -38
- package/src/search/searchinfoview.js +0 -59
- package/src/search/searchresultsview.js +0 -83
- package/src/search/text/searchtextqueryview.js +0 -87
- package/src/search/text/searchtextview.js +0 -242
- package/src/spinner/spinnerview.js +0 -38
- package/src/template.js +0 -1396
- package/src/textarea/textareaview.js +0 -189
- package/src/toolbar/balloon/balloontoolbar.js +0 -358
- package/src/toolbar/block/blockbuttonview.js +0 -41
- package/src/toolbar/block/blocktoolbar.js +0 -507
- package/src/toolbar/normalizetoolbarconfig.js +0 -52
- package/src/toolbar/toolbarlinebreakview.js +0 -28
- package/src/toolbar/toolbarseparatorview.js +0 -28
- package/src/toolbar/toolbarview.js +0 -873
- package/src/tooltipmanager.js +0 -454
- package/src/view.js +0 -471
- package/src/viewcollection.js +0 -210
- package/theme/components/arialiveannouncer/arialiveannouncer.css +0 -14
- package/theme/components/autocomplete/autocomplete.css +0 -22
- package/theme/components/button/button.css +0 -39
- package/theme/components/button/listitembutton.css +0 -48
- package/theme/components/button/switchbutton.css +0 -14
- package/theme/components/collapsible/collapsible.css +0 -10
- package/theme/components/colorgrid/colorgrid.css +0 -8
- package/theme/components/colorpicker/colorpicker.css +0 -34
- package/theme/components/colorselector/colorselector.css +0 -35
- package/theme/components/dialog/dialog.css +0 -42
- package/theme/components/dialog/dialogactions.css +0 -11
- package/theme/components/dropdown/dropdown.css +0 -95
- package/theme/components/dropdown/listdropdown.css +0 -10
- package/theme/components/dropdown/menu/dropdownmenu.css +0 -8
- package/theme/components/dropdown/menu/dropdownmenubutton.css +0 -9
- package/theme/components/dropdown/menu/dropdownmenulistitem.css +0 -10
- package/theme/components/dropdown/menu/dropdownmenulistitembutton.css +0 -10
- package/theme/components/dropdown/menu/dropdownmenupanel.css +0 -11
- package/theme/components/dropdown/splitbutton.css +0 -14
- package/theme/components/dropdown/toolbardropdown.css +0 -20
- package/theme/components/editorui/accessibilityhelp.css +0 -10
- package/theme/components/editorui/editorui.css +0 -10
- package/theme/components/form/form.css +0 -87
- package/theme/components/formheader/formheader.css +0 -18
- package/theme/components/formrow/formrow.css +0 -32
- package/theme/components/highlightedtext/highlightedtext.css +0 -12
- package/theme/components/icon/icon.css +0 -8
- package/theme/components/input/input.css +0 -10
- package/theme/components/label/label.css +0 -12
- package/theme/components/labeledfield/labeledfieldview.css +0 -16
- package/theme/components/labeledinput/labeledinput.css +0 -10
- package/theme/components/list/list.css +0 -26
- package/theme/components/menubar/menubar.css +0 -10
- package/theme/components/menubar/menubarmenu.css +0 -9
- package/theme/components/menubar/menubarmenubutton.css +0 -11
- package/theme/components/menubar/menubarmenulistitem.css +0 -10
- package/theme/components/menubar/menubarmenulistitembutton.css +0 -10
- package/theme/components/menubar/menubarmenupanel.css +0 -62
- package/theme/components/panel/balloonpanel.css +0 -56
- package/theme/components/panel/balloonrotator.css +0 -17
- package/theme/components/panel/fakepanel.css +0 -23
- package/theme/components/panel/stickypanel.css +0 -17
- package/theme/components/responsive-form/responsiveform.css +0 -42
- package/theme/components/search/search.css +0 -43
- package/theme/components/spinner/spinner.css +0 -23
- package/theme/components/textarea/textarea.css +0 -10
- package/theme/components/toolbar/blocktoolbar.css +0 -9
- package/theme/components/toolbar/toolbar.css +0 -58
- package/theme/components/tooltip/tooltip.css +0 -12
- package/theme/globals/_evaluationbadge.css +0 -54
- package/theme/globals/_hidden.css +0 -13
- package/theme/globals/_poweredby.css +0 -84
- package/theme/globals/_transition.css +0 -12
- package/theme/globals/_zindex.css +0 -10
- package/theme/globals/globals.css +0 -10
- package/theme/mixins/_dir.css +0 -10
- package/theme/mixins/_mediacolors.css +0 -20
- package/theme/mixins/_rwd.css +0 -10
- package/theme/mixins/_unselectable.css +0 -14
- /package/{src → dist}/arialiveannouncer.d.ts +0 -0
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/autocomplete/autocompleteview.d.ts +0 -0
- /package/{src → dist}/badge/badge.d.ts +0 -0
- /package/{src → dist}/bindings/addkeyboardhandlingforgrid.d.ts +0 -0
- /package/{src → dist}/bindings/clickoutsidehandler.d.ts +0 -0
- /package/{src → dist}/bindings/csstransitiondisablermixin.d.ts +0 -0
- /package/{src → dist}/bindings/draggableviewmixin.d.ts +0 -0
- /package/{src → dist}/bindings/preventdefault.d.ts +0 -0
- /package/{src → dist}/bindings/submithandler.d.ts +0 -0
- /package/{src → dist}/button/button.d.ts +0 -0
- /package/{src → dist}/button/buttonlabel.d.ts +0 -0
- /package/{src → dist}/button/buttonlabelview.d.ts +0 -0
- /package/{src → dist}/button/buttonview.d.ts +0 -0
- /package/{src → dist}/button/filedialogbuttonview.d.ts +0 -0
- /package/{src → dist}/button/listitembuttonview.d.ts +0 -0
- /package/{src → dist}/button/switchbuttonview.d.ts +0 -0
- /package/{src → dist}/collapsible/collapsibleview.d.ts +0 -0
- /package/{src → dist}/colorgrid/colorgridview.d.ts +0 -0
- /package/{src → dist}/colorgrid/colortileview.d.ts +0 -0
- /package/{src → dist}/colorgrid/utils.d.ts +0 -0
- /package/{src → dist}/colorpicker/colorpickerview.d.ts +0 -0
- /package/{src → dist}/colorpicker/utils.d.ts +0 -0
- /package/{src → dist}/colorselector/colorgridsfragmentview.d.ts +0 -0
- /package/{src → dist}/colorselector/colorpickerfragmentview.d.ts +0 -0
- /package/{src → dist}/colorselector/colorselectorview.d.ts +0 -0
- /package/{src → dist}/componentfactory.d.ts +0 -0
- /package/{src → dist}/dialog/dialogactionsview.d.ts +0 -0
- /package/{src → dist}/dialog/dialogcontentview.d.ts +0 -0
- /package/{src → dist}/dialog/dialogview.d.ts +0 -0
- /package/{src → dist}/dropdown/button/dropdownbutton.d.ts +0 -0
- /package/{src → dist}/dropdown/button/dropdownbuttonview.d.ts +0 -0
- /package/{src → dist}/dropdown/button/splitbuttonview.d.ts +0 -0
- /package/{src → dist}/dropdown/dropdownpanelfocusable.d.ts +0 -0
- /package/{src → dist}/dropdown/dropdownpanelview.d.ts +0 -0
- /package/{src → dist}/dropdown/dropdownview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenubehaviors.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenubuttonview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenulistitembuttonview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenulistitemview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenulistview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenunestedmenupanelview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenunestedmenuview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenurootlistview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/utils.d.ts +0 -0
- /package/{src → dist}/dropdown/utils.d.ts +0 -0
- /package/{src → dist}/editableui/editableuiview.d.ts +0 -0
- /package/{src → dist}/editableui/inline/inlineeditableuiview.d.ts +0 -0
- /package/{src → dist}/editorui/accessibilityhelp/accessibilityhelp.d.ts +0 -0
- /package/{src → dist}/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +0 -0
- /package/{src → dist}/editorui/bodycollection.d.ts +0 -0
- /package/{src → dist}/editorui/boxed/boxededitoruiview.d.ts +0 -0
- /package/{src → dist}/editorui/editorui.d.ts +0 -0
- /package/{src → dist}/editorui/editoruiview.d.ts +0 -0
- /package/{src → dist}/editorui/evaluationbadge.d.ts +0 -0
- /package/{src → dist}/editorui/poweredby.d.ts +0 -0
- /package/{src → dist}/focuscycler.d.ts +0 -0
- /package/{src → dist}/formheader/formheaderview.d.ts +0 -0
- /package/{src → dist}/formrow/formrowview.d.ts +0 -0
- /package/{src → dist}/highlightedtext/buttonlabelwithhighlightview.d.ts +0 -0
- /package/{src → dist}/highlightedtext/highlightedtextview.d.ts +0 -0
- /package/{src → dist}/highlightedtext/labelwithhighlightview.d.ts +0 -0
- /package/{src → dist}/icon/iconview.d.ts +0 -0
- /package/{src → dist}/iframe/iframeview.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/input/inputbase.d.ts +0 -0
- /package/{src → dist}/input/inputview.d.ts +0 -0
- /package/{src → dist}/inputnumber/inputnumberview.d.ts +0 -0
- /package/{src → dist}/inputtext/inputtextview.d.ts +0 -0
- /package/{src → dist}/label/labelview.d.ts +0 -0
- /package/{src → dist}/labeledfield/labeledfieldview.d.ts +0 -0
- /package/{src → dist}/labeledfield/utils.d.ts +0 -0
- /package/{src → dist}/labeledinput/labeledinputview.d.ts +0 -0
- /package/{src → dist}/legacyerrors.d.ts +0 -0
- /package/{src → dist}/list/listitemgroupview.d.ts +0 -0
- /package/{src → dist}/list/listitemview.d.ts +0 -0
- /package/{src → dist}/list/listseparatorview.d.ts +0 -0
- /package/{src → dist}/list/listview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenubuttonview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenulistitembuttonview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenulistitemfiledialogbuttonview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenulistitemview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenulistview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenupanelview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarview.d.ts +0 -0
- /package/{src → dist}/menubar/utils.d.ts +0 -0
- /package/{src → dist}/model.d.ts +0 -0
- /package/{src → dist}/notification/notification.d.ts +0 -0
- /package/{src → dist}/panel/balloon/balloonpanelview.d.ts +0 -0
- /package/{src → dist}/panel/balloon/contextualballoon.d.ts +0 -0
- /package/{src → dist}/panel/sticky/stickypanelview.d.ts +0 -0
- /package/{src → dist}/search/filteredview.d.ts +0 -0
- /package/{src → dist}/search/filtergroupanditemnames.d.ts +0 -0
- /package/{src → dist}/search/searchinfoview.d.ts +0 -0
- /package/{src → dist}/search/searchresultsview.d.ts +0 -0
- /package/{src → dist}/search/text/searchtextqueryview.d.ts +0 -0
- /package/{src → dist}/search/text/searchtextview.d.ts +0 -0
- /package/{src → dist}/spinner/spinnerview.d.ts +0 -0
- /package/{src → dist}/template.d.ts +0 -0
- /package/{src → dist}/textarea/textareaview.d.ts +0 -0
- /package/{src → dist}/toolbar/balloon/balloontoolbar.d.ts +0 -0
- /package/{src → dist}/toolbar/block/blockbuttonview.d.ts +0 -0
- /package/{src → dist}/toolbar/block/blocktoolbar.d.ts +0 -0
- /package/{src → dist}/toolbar/normalizetoolbarconfig.d.ts +0 -0
- /package/{src → dist}/toolbar/toolbarlinebreakview.d.ts +0 -0
- /package/{src → dist}/toolbar/toolbarseparatorview.d.ts +0 -0
- /package/{src → dist}/toolbar/toolbarview.d.ts +0 -0
- /package/{src → dist}/tooltipmanager.d.ts +0 -0
- /package/{src → dist}/viewcollection.d.ts +0 -0
package/src/tooltipmanager.js
DELETED
|
@@ -1,454 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license Copyright (c) 2003-2026, 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/tooltipmanager
|
|
7
|
-
*/
|
|
8
|
-
import { View } from './view.js';
|
|
9
|
-
import { BalloonPanelView } from './panel/balloon/balloonpanelview.js';
|
|
10
|
-
import { DomEmitterMixin, first, global, isVisible } from '@ckeditor/ckeditor5-utils';
|
|
11
|
-
import { isElement, debounce } from 'es-toolkit/compat';
|
|
12
|
-
import '../theme/components/tooltip/tooltip.css';
|
|
13
|
-
const BALLOON_CLASS = 'ck-tooltip';
|
|
14
|
-
/**
|
|
15
|
-
* A tooltip manager class for the UI of the editor.
|
|
16
|
-
*
|
|
17
|
-
* **Note**: Most likely you do not have to use the `TooltipManager` API listed below in order to display tooltips. Popular
|
|
18
|
-
* {@glink framework/architecture/ui-library UI components} support tooltips out-of-the-box via observable properties
|
|
19
|
-
* (see {@link module:ui/button/buttonview~ButtonView#tooltip} and {@link module:ui/button/buttonview~ButtonView#tooltipPosition}).
|
|
20
|
-
*
|
|
21
|
-
* # Displaying tooltips
|
|
22
|
-
*
|
|
23
|
-
* To display a tooltip, set `data-cke-tooltip-text` attribute on any DOM element:
|
|
24
|
-
*
|
|
25
|
-
* ```ts
|
|
26
|
-
* domElement.dataset.ckeTooltipText = 'My tooltip';
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* The tooltip will show up whenever the user moves the mouse over the element or the element gets focus in DOM.
|
|
30
|
-
*
|
|
31
|
-
* # Positioning tooltips
|
|
32
|
-
*
|
|
33
|
-
* To change the position of the tooltip, use the `data-cke-tooltip-position` attribute (`s`, `se`, `sw`, `n`, `e`, or `w`):
|
|
34
|
-
*
|
|
35
|
-
* ```ts
|
|
36
|
-
* domElement.dataset.ckeTooltipText = 'Tooltip to the north';
|
|
37
|
-
* domElement.dataset.ckeTooltipPosition = 'n';
|
|
38
|
-
* ```
|
|
39
|
-
*
|
|
40
|
-
* # Disabling tooltips
|
|
41
|
-
*
|
|
42
|
-
* In order to disable the tooltip temporarily, use the `data-cke-tooltip-disabled` attribute:
|
|
43
|
-
*
|
|
44
|
-
* ```ts
|
|
45
|
-
* domElement.dataset.ckeTooltipText = 'Disabled. For now.';
|
|
46
|
-
* domElement.dataset.ckeTooltipDisabled = 'true';
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* # Instant tooltips
|
|
50
|
-
*
|
|
51
|
-
* To remove the delay before showing or hiding the tooltip, use the `data-cke-tooltip-instant` attribute:
|
|
52
|
-
*
|
|
53
|
-
* ```ts
|
|
54
|
-
* domElement.dataset.ckeTooltipInstant = 'true';
|
|
55
|
-
* ```
|
|
56
|
-
*
|
|
57
|
-
* # Styling tooltips
|
|
58
|
-
*
|
|
59
|
-
* By default, the tooltip has `.ck-tooltip` class and its text inner `.ck-tooltip__text`.
|
|
60
|
-
*
|
|
61
|
-
* If your tooltip requires custom styling, using `data-cke-tooltip-class` attribute will add additional class to the balloon
|
|
62
|
-
* displaying the tooltip:
|
|
63
|
-
*
|
|
64
|
-
* ```ts
|
|
65
|
-
* domElement.dataset.ckeTooltipText = 'Tooltip with a red text';
|
|
66
|
-
* domElement.dataset.ckeTooltipClass = 'my-class';
|
|
67
|
-
* ```
|
|
68
|
-
*
|
|
69
|
-
* ```css
|
|
70
|
-
* .ck.ck-tooltip.my-class { color: red }
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* **Note**: This class is a singleton. All editor instances re-use the same instance loaded by
|
|
74
|
-
* {@link module:ui/editorui/editorui~EditorUI} of the first editor.
|
|
75
|
-
*/
|
|
76
|
-
export class TooltipManager extends /* #__PURE__ */ DomEmitterMixin() {
|
|
77
|
-
/**
|
|
78
|
-
* The view rendering text of the tooltip.
|
|
79
|
-
*/
|
|
80
|
-
tooltipTextView;
|
|
81
|
-
/**
|
|
82
|
-
* The instance of the balloon panel that renders and positions the tooltip.
|
|
83
|
-
*/
|
|
84
|
-
balloonPanelView;
|
|
85
|
-
/**
|
|
86
|
-
* A set of default {@link module:utils/dom/position~PositioningFunction positioning functions} used by the `TooltipManager`
|
|
87
|
-
* to pin tooltips in different positions.
|
|
88
|
-
*/
|
|
89
|
-
static defaultBalloonPositions = /* #__PURE__ */ BalloonPanelView.generatePositions({
|
|
90
|
-
heightOffset: 5,
|
|
91
|
-
sideOffset: 13
|
|
92
|
-
});
|
|
93
|
-
/**
|
|
94
|
-
* Stores the reference to the DOM element the tooltip is attached to. `null` when there's no tooltip
|
|
95
|
-
* in the UI.
|
|
96
|
-
*/
|
|
97
|
-
_currentElementWithTooltip = null;
|
|
98
|
-
/**
|
|
99
|
-
* Stores the current tooltip position. `null` when there's no tooltip in the UI.
|
|
100
|
-
*/
|
|
101
|
-
_currentTooltipPosition = null;
|
|
102
|
-
/**
|
|
103
|
-
* An instance of the mutation observer that keeps track on target element attributes changes.
|
|
104
|
-
*/
|
|
105
|
-
_mutationObserver = null;
|
|
106
|
-
/**
|
|
107
|
-
* A debounced version of {@link #_pinTooltip}. Tooltips show with a delay to avoid flashing and
|
|
108
|
-
* to improve the UX.
|
|
109
|
-
*/
|
|
110
|
-
_pinTooltipDebounced;
|
|
111
|
-
/**
|
|
112
|
-
* A debounced version of {@link #_unpinTooltip}. Tooltips hide with a delay to allow hovering of their titles.
|
|
113
|
-
*/
|
|
114
|
-
_unpinTooltipDebounced;
|
|
115
|
-
_watchdogExcluded;
|
|
116
|
-
/**
|
|
117
|
-
* A set of editors the single tooltip manager instance must listen to.
|
|
118
|
-
* This is mostly to handle `EditorUI#update` listeners from individual editors.
|
|
119
|
-
*/
|
|
120
|
-
static _editors = new Set();
|
|
121
|
-
/**
|
|
122
|
-
* A reference to the `TooltipManager` instance. The class is a singleton and as such,
|
|
123
|
-
* successive attempts at creating instances should return this instance.
|
|
124
|
-
*/
|
|
125
|
-
static _instance = null;
|
|
126
|
-
/**
|
|
127
|
-
* Creates an instance of the tooltip manager.
|
|
128
|
-
*/
|
|
129
|
-
constructor(editor) {
|
|
130
|
-
super();
|
|
131
|
-
TooltipManager._editors.add(editor);
|
|
132
|
-
// TooltipManager must be a singleton. Multiple instances would mean multiple tooltips attached
|
|
133
|
-
// to the same DOM element with data-cke-tooltip-* attributes.
|
|
134
|
-
if (TooltipManager._instance) {
|
|
135
|
-
return TooltipManager._instance;
|
|
136
|
-
}
|
|
137
|
-
TooltipManager._instance = this;
|
|
138
|
-
this.tooltipTextView = new View(editor.locale);
|
|
139
|
-
this.tooltipTextView.set('text', '');
|
|
140
|
-
this.tooltipTextView.setTemplate({
|
|
141
|
-
tag: 'span',
|
|
142
|
-
attributes: {
|
|
143
|
-
class: [
|
|
144
|
-
'ck',
|
|
145
|
-
'ck-tooltip__text'
|
|
146
|
-
]
|
|
147
|
-
},
|
|
148
|
-
children: [
|
|
149
|
-
{
|
|
150
|
-
text: this.tooltipTextView.bindTemplate.to('text')
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
});
|
|
154
|
-
this.balloonPanelView = new BalloonPanelView(editor.locale);
|
|
155
|
-
this.balloonPanelView.class = BALLOON_CLASS;
|
|
156
|
-
this.balloonPanelView.content.add(this.tooltipTextView);
|
|
157
|
-
this._mutationObserver = createMutationObserver(() => {
|
|
158
|
-
this._updateTooltipPosition();
|
|
159
|
-
});
|
|
160
|
-
this._pinTooltipDebounced = debounce(this._pinTooltip, 600);
|
|
161
|
-
this._unpinTooltipDebounced = debounce(this._unpinTooltip, 400);
|
|
162
|
-
this.listenTo(global.document, 'keydown', this._onKeyDown.bind(this), { useCapture: true });
|
|
163
|
-
this.listenTo(global.document, 'mouseenter', this._onEnterOrFocus.bind(this), { useCapture: true });
|
|
164
|
-
this.listenTo(global.document, 'mouseleave', this._onLeaveOrBlur.bind(this), { useCapture: true });
|
|
165
|
-
this.listenTo(global.document, 'focus', this._onEnterOrFocus.bind(this), { useCapture: true });
|
|
166
|
-
this.listenTo(global.document, 'blur', this._onLeaveOrBlur.bind(this), { useCapture: true });
|
|
167
|
-
this.listenTo(global.document, 'scroll', this._onScroll.bind(this), { useCapture: true });
|
|
168
|
-
// Because this class is a singleton, its only instance is shared across all editors and connects them through the reference.
|
|
169
|
-
// This causes issues with the ContextWatchdog. When an error is thrown in one editor, the watchdog traverses the references
|
|
170
|
-
// and (because of shared tooltip manager) figures that the error affects all editors and restarts them all.
|
|
171
|
-
// This flag, excludes tooltip manager instance from the traversal and brings ContextWatchdog back to normal.
|
|
172
|
-
// More in https://github.com/ckeditor/ckeditor5/issues/12292.
|
|
173
|
-
this._watchdogExcluded = true;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Destroys the tooltip manager.
|
|
177
|
-
*
|
|
178
|
-
* **Note**: The manager singleton cannot be destroyed until all editors that use it are destroyed.
|
|
179
|
-
*
|
|
180
|
-
* @param editor The editor the manager was created for.
|
|
181
|
-
*/
|
|
182
|
-
destroy(editor) {
|
|
183
|
-
const editorBodyViewCollection = editor.ui.view && editor.ui.view.body;
|
|
184
|
-
TooltipManager._editors.delete(editor);
|
|
185
|
-
this.stopListening(editor.ui);
|
|
186
|
-
// Prevent the balloon panel from being destroyed in the EditorUI#destroy() cascade. It should be destroyed along
|
|
187
|
-
// with the last editor only (https://github.com/ckeditor/ckeditor5/issues/12602).
|
|
188
|
-
if (editorBodyViewCollection && editorBodyViewCollection.has(this.balloonPanelView)) {
|
|
189
|
-
editorBodyViewCollection.remove(this.balloonPanelView);
|
|
190
|
-
}
|
|
191
|
-
if (!TooltipManager._editors.size) {
|
|
192
|
-
this._unpinTooltip();
|
|
193
|
-
this.balloonPanelView.destroy();
|
|
194
|
-
this.stopListening();
|
|
195
|
-
TooltipManager._instance = null;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Returns {@link #balloonPanelView} {@link module:utils/dom/position~PositioningFunction positioning functions} for a given position
|
|
200
|
-
* name.
|
|
201
|
-
*
|
|
202
|
-
* @param position Name of the position (`s`, `se`, `sw`, `n`, `e`, or `w`).
|
|
203
|
-
* @returns Positioning functions to be used by the {@link #balloonPanelView}.
|
|
204
|
-
*/
|
|
205
|
-
static getPositioningFunctions(position) {
|
|
206
|
-
const defaultPositions = TooltipManager.defaultBalloonPositions;
|
|
207
|
-
return {
|
|
208
|
-
// South is most popular. We can use positioning heuristics to avoid clipping by the viewport with the sane fallback.
|
|
209
|
-
s: [
|
|
210
|
-
defaultPositions.southArrowNorth,
|
|
211
|
-
defaultPositions.southArrowNorthEast,
|
|
212
|
-
defaultPositions.southArrowNorthWest
|
|
213
|
-
],
|
|
214
|
-
n: [defaultPositions.northArrowSouth],
|
|
215
|
-
e: [defaultPositions.eastArrowWest],
|
|
216
|
-
w: [defaultPositions.westArrowEast],
|
|
217
|
-
sw: [defaultPositions.southArrowNorthEast],
|
|
218
|
-
se: [defaultPositions.southArrowNorthWest]
|
|
219
|
-
}[position];
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Handles hiding tooltips on `keydown` in DOM.
|
|
223
|
-
*
|
|
224
|
-
* @param evt An object containing information about the fired event.
|
|
225
|
-
* @param domEvent The DOM event.
|
|
226
|
-
*/
|
|
227
|
-
_onKeyDown(evt, domEvent) {
|
|
228
|
-
if (domEvent.key === 'Escape' && this._currentElementWithTooltip) {
|
|
229
|
-
this._unpinTooltip();
|
|
230
|
-
domEvent.stopPropagation();
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Handles displaying tooltips on `mouseenter` and `focus` in DOM.
|
|
235
|
-
*
|
|
236
|
-
* @param evt An object containing information about the fired event.
|
|
237
|
-
* @param domEvent The DOM event.
|
|
238
|
-
*/
|
|
239
|
-
_onEnterOrFocus(evt, { target }) {
|
|
240
|
-
const elementWithTooltipAttribute = getDescendantWithTooltip(target);
|
|
241
|
-
// Abort when there's no descendant needing tooltip.
|
|
242
|
-
if (!elementWithTooltipAttribute) {
|
|
243
|
-
// Unpin if element is focused, regardless of whether it contains a label or not.
|
|
244
|
-
// It also prevents tooltips from overlapping the menu bar
|
|
245
|
-
if (evt.name === 'focus') {
|
|
246
|
-
this._unpinTooltip();
|
|
247
|
-
}
|
|
248
|
-
return;
|
|
249
|
-
}
|
|
250
|
-
// Abort to avoid flashing when, for instance:
|
|
251
|
-
// * a tooltip is displayed for a focused element, then the same element gets mouseentered,
|
|
252
|
-
// * a tooltip is displayed for an element via mouseenter, then the focus moves to the same element.
|
|
253
|
-
if (elementWithTooltipAttribute === this._currentElementWithTooltip) {
|
|
254
|
-
this._unpinTooltipDebounced.cancel();
|
|
255
|
-
return;
|
|
256
|
-
}
|
|
257
|
-
this._unpinTooltip();
|
|
258
|
-
// The tooltip should be pinned immediately when the element gets focused using keyboard.
|
|
259
|
-
// If it is focused using the mouse, the tooltip should be pinned after a delay to prevent flashing.
|
|
260
|
-
// See https://github.com/ckeditor/ckeditor5/issues/16383
|
|
261
|
-
// Also, if the element has an attribute `data-cke-tooltip-instant`, the tooltip should be pinned immediately.
|
|
262
|
-
// This is useful for elements that have their content partially hidden (e.g. a long text in a small container)
|
|
263
|
-
// and should show a tooltip on hover, like merge field.
|
|
264
|
-
if (evt.name === 'focus' && !elementWithTooltipAttribute.matches(':hover') ||
|
|
265
|
-
elementWithTooltipAttribute.matches('[data-cke-tooltip-instant]')) {
|
|
266
|
-
this._pinTooltip(elementWithTooltipAttribute, getTooltipData(elementWithTooltipAttribute));
|
|
267
|
-
}
|
|
268
|
-
else {
|
|
269
|
-
this._pinTooltipDebounced(elementWithTooltipAttribute, getTooltipData(elementWithTooltipAttribute));
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
/**
|
|
273
|
-
* Handles hiding tooltips on `mouseleave` and `blur` in DOM.
|
|
274
|
-
*
|
|
275
|
-
* @param evt An object containing information about the fired event.
|
|
276
|
-
* @param domEvent The DOM event.
|
|
277
|
-
*/
|
|
278
|
-
_onLeaveOrBlur(evt, { target, relatedTarget }) {
|
|
279
|
-
if (evt.name === 'mouseleave') {
|
|
280
|
-
// Don't act when the event does not concern a DOM element (e.g. a mouseleave out of an entire document),
|
|
281
|
-
if (!isElement(target)) {
|
|
282
|
-
return;
|
|
283
|
-
}
|
|
284
|
-
const balloonElement = this.balloonPanelView.element;
|
|
285
|
-
const isEnteringBalloon = balloonElement && (balloonElement === relatedTarget || balloonElement.contains(relatedTarget));
|
|
286
|
-
const isLeavingBalloon = !isEnteringBalloon && target === balloonElement;
|
|
287
|
-
// Do not hide the tooltip when the user moves the cursor over it.
|
|
288
|
-
if (isEnteringBalloon) {
|
|
289
|
-
this._unpinTooltipDebounced.cancel();
|
|
290
|
-
return;
|
|
291
|
-
}
|
|
292
|
-
// If a tooltip is currently visible, don't act for a targets other than the one it is attached to.
|
|
293
|
-
// The only exception is leaving balloon, in this scenario tooltip should be closed.
|
|
294
|
-
// For instance, a random mouseleave far away in the page should not unpin the tooltip that was pinned because
|
|
295
|
-
// of a previous focus. Only leaving the same element should hide the tooltip.
|
|
296
|
-
if (!isLeavingBalloon && this._currentElementWithTooltip && target !== this._currentElementWithTooltip) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
const descendantWithTooltip = getDescendantWithTooltip(target);
|
|
300
|
-
const relatedDescendantWithTooltip = getDescendantWithTooltip(relatedTarget);
|
|
301
|
-
// Unpin when the mouse was leaving element with a tooltip to a place which does not have or has a different tooltip.
|
|
302
|
-
// Note that this should happen whether the tooltip is already visible or not, for instance,
|
|
303
|
-
// it could be invisible but queued (debounced): it should get canceled.
|
|
304
|
-
if (isLeavingBalloon || (descendantWithTooltip && descendantWithTooltip !== relatedDescendantWithTooltip)) {
|
|
305
|
-
this._pinTooltipDebounced.cancel();
|
|
306
|
-
// If the currently visible tooltip is instant, unpin it immediately.
|
|
307
|
-
if (this._currentElementWithTooltip && this._currentElementWithTooltip.matches('[data-cke-tooltip-instant]') ||
|
|
308
|
-
descendantWithTooltip && descendantWithTooltip.matches('[data-cke-tooltip-instant]')) {
|
|
309
|
-
this._unpinTooltip();
|
|
310
|
-
}
|
|
311
|
-
else {
|
|
312
|
-
this._unpinTooltipDebounced();
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
// If a tooltip is currently visible, don't act for a targets other than the one it is attached to.
|
|
318
|
-
// For instance, a random blur in the web page should not unpin the tooltip that was pinned because of a previous mouseenter.
|
|
319
|
-
if (this._currentElementWithTooltip && target !== this._currentElementWithTooltip) {
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
// Note that unpinning should happen whether the tooltip is already visible or not, for instance, it could be invisible but
|
|
323
|
-
// queued (debounced): it should get canceled (e.g. quick focus then quick blur using the keyboard).
|
|
324
|
-
this._pinTooltipDebounced.cancel();
|
|
325
|
-
this._unpinTooltipDebounced();
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Handles hiding tooltips on `scroll` in DOM.
|
|
330
|
-
*
|
|
331
|
-
* @param evt An object containing information about the fired event.
|
|
332
|
-
* @param domEvent The DOM event.
|
|
333
|
-
*/
|
|
334
|
-
_onScroll(evt, { target }) {
|
|
335
|
-
// No tooltip, no reason to react on scroll.
|
|
336
|
-
if (!this._currentElementWithTooltip) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
// When scrolling a container that has both the balloon and the current element (common ancestor), the balloon can remain
|
|
340
|
-
// visible (e.g. scrolling ≤body>). Otherwise, to avoid glitches (clipping, lagging) better just hide the tooltip.
|
|
341
|
-
// Also, don't do anything when scrolling an unrelated DOM element that has nothing to do with the current element and the balloon.
|
|
342
|
-
if (target.contains(this.balloonPanelView.element) && target.contains(this._currentElementWithTooltip)) {
|
|
343
|
-
return;
|
|
344
|
-
}
|
|
345
|
-
this._unpinTooltip();
|
|
346
|
-
}
|
|
347
|
-
/**
|
|
348
|
-
* Pins the tooltip to a specific DOM element.
|
|
349
|
-
*
|
|
350
|
-
* @param targetDomElement Element to be pinned to.
|
|
351
|
-
* @param options Options for the tooltip.
|
|
352
|
-
* @param options.text Text of the tooltip to display.
|
|
353
|
-
* @param options.position The position of the tooltip.
|
|
354
|
-
* @param options.cssClass Additional CSS class of the balloon with the tooltip.
|
|
355
|
-
*/
|
|
356
|
-
_pinTooltip(targetDomElement, { text, position, cssClass }) {
|
|
357
|
-
this._unpinTooltip();
|
|
358
|
-
// Use the body collection of the first editor.
|
|
359
|
-
const bodyViewCollection = first(TooltipManager._editors.values()).ui.view.body;
|
|
360
|
-
if (!bodyViewCollection.has(this.balloonPanelView)) {
|
|
361
|
-
bodyViewCollection.add(this.balloonPanelView);
|
|
362
|
-
}
|
|
363
|
-
this.tooltipTextView.text = text;
|
|
364
|
-
this.balloonPanelView.class = [BALLOON_CLASS, cssClass]
|
|
365
|
-
.filter(className => className)
|
|
366
|
-
.join(' ');
|
|
367
|
-
// Ensure that all changes to the tooltip are set before pinning it.
|
|
368
|
-
// Setting class or text after pinning can cause the tooltip to be pinned in the wrong position.
|
|
369
|
-
// It happens especially often when tooltip has class modified (like adding `ck-tooltip_multi-line`).
|
|
370
|
-
// See https://github.com/ckeditor/ckeditor5/issues/16365
|
|
371
|
-
this.balloonPanelView.pin({
|
|
372
|
-
target: targetDomElement,
|
|
373
|
-
positions: TooltipManager.getPositioningFunctions(position)
|
|
374
|
-
});
|
|
375
|
-
this._mutationObserver.attach(targetDomElement);
|
|
376
|
-
// Start responding to changes in editor UI or content layout. For instance, when collaborators change content
|
|
377
|
-
// and a contextual toolbar attached to a content starts to move (and so should move the tooltip).
|
|
378
|
-
// Note: Using low priority to let other listeners that position contextual toolbars etc. to react first.
|
|
379
|
-
for (const editor of TooltipManager._editors) {
|
|
380
|
-
this.listenTo(editor.ui, 'update', this._updateTooltipPosition.bind(this), { priority: 'low' });
|
|
381
|
-
}
|
|
382
|
-
this._currentElementWithTooltip = targetDomElement;
|
|
383
|
-
this._currentTooltipPosition = position;
|
|
384
|
-
}
|
|
385
|
-
/**
|
|
386
|
-
* Unpins the tooltip and cancels all queued pinning.
|
|
387
|
-
*/
|
|
388
|
-
_unpinTooltip() {
|
|
389
|
-
this._unpinTooltipDebounced.cancel();
|
|
390
|
-
this._pinTooltipDebounced.cancel();
|
|
391
|
-
this.balloonPanelView.unpin();
|
|
392
|
-
for (const editor of TooltipManager._editors) {
|
|
393
|
-
this.stopListening(editor.ui, 'update');
|
|
394
|
-
}
|
|
395
|
-
this._currentElementWithTooltip = null;
|
|
396
|
-
this._currentTooltipPosition = null;
|
|
397
|
-
this.tooltipTextView.text = '';
|
|
398
|
-
this._mutationObserver.detach();
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Updates the position of the tooltip so it stays in sync with the element it is pinned to.
|
|
402
|
-
*
|
|
403
|
-
* Hides the tooltip when the element is no longer visible in DOM or the tooltip text was removed.
|
|
404
|
-
*/
|
|
405
|
-
_updateTooltipPosition() {
|
|
406
|
-
// The tooltip might get removed by focus listener triggered by the same UI `update` event.
|
|
407
|
-
// See https://github.com/ckeditor/ckeditor5/pull/16363.
|
|
408
|
-
if (!this._currentElementWithTooltip) {
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
const tooltipData = getTooltipData(this._currentElementWithTooltip);
|
|
412
|
-
// This could happen if the tooltip was attached somewhere in a contextual content toolbar and the toolbar
|
|
413
|
-
// disappeared (e.g. removed an image), or the tooltip text was removed.
|
|
414
|
-
if (!isVisible(this._currentElementWithTooltip) || !tooltipData.text) {
|
|
415
|
-
this._unpinTooltip();
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
this.balloonPanelView.pin({
|
|
419
|
-
target: this._currentElementWithTooltip,
|
|
420
|
-
positions: TooltipManager.getPositioningFunctions(tooltipData.position)
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
function getDescendantWithTooltip(element) {
|
|
425
|
-
if (!isElement(element)) {
|
|
426
|
-
return null;
|
|
427
|
-
}
|
|
428
|
-
return element.closest('[data-cke-tooltip-text]:not([data-cke-tooltip-disabled])');
|
|
429
|
-
}
|
|
430
|
-
function getTooltipData(element) {
|
|
431
|
-
return {
|
|
432
|
-
text: element.dataset.ckeTooltipText,
|
|
433
|
-
position: (element.dataset.ckeTooltipPosition || 's'),
|
|
434
|
-
cssClass: element.dataset.ckeTooltipClass || ''
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
// Creates a simple `MutationObserver` instance wrapper that observes changes in the tooltip-related attributes of the given element.
|
|
438
|
-
// Used instead of the `MutationObserver` from the engine for simplicity.
|
|
439
|
-
function createMutationObserver(callback) {
|
|
440
|
-
const mutationObserver = new MutationObserver(() => {
|
|
441
|
-
callback();
|
|
442
|
-
});
|
|
443
|
-
return {
|
|
444
|
-
attach(element) {
|
|
445
|
-
mutationObserver.observe(element, {
|
|
446
|
-
attributes: true,
|
|
447
|
-
attributeFilter: ['data-cke-tooltip-text', 'data-cke-tooltip-position']
|
|
448
|
-
});
|
|
449
|
-
},
|
|
450
|
-
detach() {
|
|
451
|
-
mutationObserver.disconnect();
|
|
452
|
-
}
|
|
453
|
-
};
|
|
454
|
-
}
|