@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
|
@@ -1,157 +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/autocomplete/autocompleteview
|
|
7
|
-
*/
|
|
8
|
-
import { getOptimalPosition, global, toUnit, Rect } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import { SearchTextView } from '../search/text/searchtextview.js';
|
|
10
|
-
import '../../theme/components/autocomplete/autocomplete.css';
|
|
11
|
-
/**
|
|
12
|
-
* The autocomplete component's view class. It extends the {@link module:ui/search/text/searchtextview~SearchTextView} class
|
|
13
|
-
* with a floating {@link #resultsView} that shows up when the user starts typing and hides when they blur
|
|
14
|
-
* the component.
|
|
15
|
-
*/
|
|
16
|
-
export class AutocompleteView extends SearchTextView {
|
|
17
|
-
/**
|
|
18
|
-
* The configuration of the autocomplete view.
|
|
19
|
-
*/
|
|
20
|
-
_config;
|
|
21
|
-
/**
|
|
22
|
-
* @inheritDoc
|
|
23
|
-
*/
|
|
24
|
-
constructor(locale, config) {
|
|
25
|
-
super(locale, config);
|
|
26
|
-
this._config = config;
|
|
27
|
-
const toPx = toUnit('px');
|
|
28
|
-
this.extendTemplate({
|
|
29
|
-
attributes: {
|
|
30
|
-
class: ['ck-autocomplete']
|
|
31
|
-
}
|
|
32
|
-
});
|
|
33
|
-
const bindResultsView = this.resultsView.bindTemplate;
|
|
34
|
-
this.resultsView.set('isVisible', false);
|
|
35
|
-
this.resultsView.set('_position', 's');
|
|
36
|
-
this.resultsView.set('_width', 0);
|
|
37
|
-
this.resultsView.extendTemplate({
|
|
38
|
-
attributes: {
|
|
39
|
-
class: [
|
|
40
|
-
bindResultsView.if('isVisible', 'ck-hidden', value => !value),
|
|
41
|
-
bindResultsView.to('_position', value => `ck-search__results_${value}`)
|
|
42
|
-
],
|
|
43
|
-
style: {
|
|
44
|
-
width: bindResultsView.to('_width', toPx)
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
// Update the visibility of the results view when the user focuses or blurs the component.
|
|
49
|
-
// This is also integration for the `resetOnBlur` configuration.
|
|
50
|
-
this.focusTracker.on('change:isFocused', (evt, name, isFocused) => {
|
|
51
|
-
this._updateResultsVisibility();
|
|
52
|
-
if (isFocused) {
|
|
53
|
-
// Reset the scroll position of the results view whenever the autocomplete reopens.
|
|
54
|
-
this.resultsView.element.scrollTop = 0;
|
|
55
|
-
}
|
|
56
|
-
else if (config.resetOnBlur) {
|
|
57
|
-
this.queryView.reset();
|
|
58
|
-
}
|
|
59
|
-
});
|
|
60
|
-
// Update the visibility of the results view when the user types in the query field.
|
|
61
|
-
// This is an integration for `queryMinChars` configuration.
|
|
62
|
-
// This is an integration for search results changing length and the #resultsView requiring to be repositioned.
|
|
63
|
-
this.on('search', () => {
|
|
64
|
-
this._updateResultsVisibility();
|
|
65
|
-
this._updateResultsViewWidthAndPosition();
|
|
66
|
-
});
|
|
67
|
-
// Hide the results view when the user presses the ESC key.
|
|
68
|
-
this.keystrokes.set('esc', (evt, cancel) => {
|
|
69
|
-
// Let the DOM event pass through if the focus is in the query view.
|
|
70
|
-
if (!this.resultsView.isVisible) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// Focus the query view first and only then close the results view. Otherwise, if the focus
|
|
74
|
-
// was in the results view, it will get lost.
|
|
75
|
-
this.queryView.focus();
|
|
76
|
-
this.resultsView.isVisible = false;
|
|
77
|
-
cancel();
|
|
78
|
-
});
|
|
79
|
-
// Update the position of the results view when the user scrolls the page.
|
|
80
|
-
// TODO: This needs to be debounced down the road.
|
|
81
|
-
this.listenTo(global.document, 'scroll', () => {
|
|
82
|
-
this._updateResultsViewWidthAndPosition();
|
|
83
|
-
});
|
|
84
|
-
// Hide the results when the component becomes disabled.
|
|
85
|
-
this.on('change:isEnabled', () => {
|
|
86
|
-
this._updateResultsVisibility();
|
|
87
|
-
});
|
|
88
|
-
// Update the value of the query field when the user selects a result.
|
|
89
|
-
this.filteredView.on('execute', (evt, { value }) => {
|
|
90
|
-
// Focus the query view first to avoid losing the focus.
|
|
91
|
-
this.focus();
|
|
92
|
-
// Resetting the view will ensure that the #queryView will update its empty state correctly.
|
|
93
|
-
// This prevents bugs related to dynamic labels or auto-grow when re-setting the same value
|
|
94
|
-
// to #queryView.fieldView.value (which does not trigger empty state change) to an
|
|
95
|
-
// #queryView.fieldView.element that has been changed by the user.
|
|
96
|
-
this.reset();
|
|
97
|
-
// Update the value of the query field.
|
|
98
|
-
this.queryView.fieldView.value = this.queryView.fieldView.element.value = value;
|
|
99
|
-
// Finally, hide the results view. The focus has been moved earlier so this is safe.
|
|
100
|
-
this.resultsView.isVisible = false;
|
|
101
|
-
});
|
|
102
|
-
// Update the position and width of the results view when it becomes visible.
|
|
103
|
-
this.resultsView.on('change:isVisible', () => {
|
|
104
|
-
this._updateResultsViewWidthAndPosition();
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Updates the position of the results view on demand.
|
|
109
|
-
*/
|
|
110
|
-
_updateResultsViewWidthAndPosition() {
|
|
111
|
-
if (!this.resultsView.isVisible) {
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
this.resultsView._width = new Rect(this.queryView.fieldView.element).width;
|
|
115
|
-
const optimalResultsPosition = AutocompleteView._getOptimalPosition({
|
|
116
|
-
element: this.resultsView.element,
|
|
117
|
-
target: this.queryView.element,
|
|
118
|
-
fitInViewport: true,
|
|
119
|
-
positions: AutocompleteView.defaultResultsPositions
|
|
120
|
-
});
|
|
121
|
-
// _getOptimalPosition will return null if there is no optimal position found (e.g. target is off the viewport).
|
|
122
|
-
this.resultsView._position = optimalResultsPosition ? optimalResultsPosition.name : 's';
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Updates the visibility of the results view on demand.
|
|
126
|
-
*/
|
|
127
|
-
_updateResultsVisibility() {
|
|
128
|
-
const queryMinChars = typeof this._config.queryMinChars === 'undefined' ? 0 : this._config.queryMinChars;
|
|
129
|
-
const queryLength = this.queryView.fieldView.element.value.length;
|
|
130
|
-
this.resultsView.isVisible = this.focusTracker.isFocused && this.isEnabled && queryLength >= queryMinChars;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Positions for the autocomplete results view. Two positions are defined by default:
|
|
134
|
-
* * `s` - below the search field,
|
|
135
|
-
* * `n` - above the search field.
|
|
136
|
-
*/
|
|
137
|
-
static defaultResultsPositions = [
|
|
138
|
-
(fieldRect => {
|
|
139
|
-
return {
|
|
140
|
-
top: fieldRect.bottom,
|
|
141
|
-
left: fieldRect.left,
|
|
142
|
-
name: 's'
|
|
143
|
-
};
|
|
144
|
-
}),
|
|
145
|
-
((fieldRect, resultsRect) => {
|
|
146
|
-
return {
|
|
147
|
-
top: fieldRect.top - resultsRect.height,
|
|
148
|
-
left: fieldRect.left,
|
|
149
|
-
name: 'n'
|
|
150
|
-
};
|
|
151
|
-
})
|
|
152
|
-
];
|
|
153
|
-
/**
|
|
154
|
-
* A function used to calculate the optimal position for the dropdown panel.
|
|
155
|
-
*/
|
|
156
|
-
static _getOptimalPosition = getOptimalPosition;
|
|
157
|
-
}
|
package/src/badge/badge.js
DELETED
|
@@ -1,226 +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
|
-
import { Rect, DomEmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
6
|
-
import { BalloonPanelView } from '../panel/balloon/balloonpanelview.js';
|
|
7
|
-
import { throttle } from 'es-toolkit/compat';
|
|
8
|
-
// ⚠ Note, whenever changing the threshold, make sure to update the docs/support/managing-ckeditor-logo.md docs
|
|
9
|
-
// as this information is also mentioned there ⚠.
|
|
10
|
-
const NARROW_ROOT_HEIGHT_THRESHOLD = 50;
|
|
11
|
-
const NARROW_ROOT_WIDTH_THRESHOLD = 350;
|
|
12
|
-
/**
|
|
13
|
-
* A helper that enables the badge feature in the editor and renders a custom view next to the bottom of the editable element
|
|
14
|
-
* (editor root, source editing area, etc.) when the editor is focused.
|
|
15
|
-
*
|
|
16
|
-
* @private
|
|
17
|
-
*/
|
|
18
|
-
export class Badge extends /* #__PURE__ */ DomEmitterMixin() {
|
|
19
|
-
/**
|
|
20
|
-
* Editor instance the helper was created for.
|
|
21
|
-
*/
|
|
22
|
-
editor;
|
|
23
|
-
/**
|
|
24
|
-
* A reference to the balloon panel hosting and positioning the badge content.
|
|
25
|
-
*/
|
|
26
|
-
_balloonView = null;
|
|
27
|
-
/**
|
|
28
|
-
* A throttled version of the {@link #_showBalloon} method meant for frequent use to avoid performance loss.
|
|
29
|
-
*/
|
|
30
|
-
_showBalloonThrottled = throttle(() => this._showBalloon(), 50, { leading: true });
|
|
31
|
-
/**
|
|
32
|
-
* A reference to the last editable element (root, source editing area, etc.) focused by the user.
|
|
33
|
-
* Since the focus can move to other focusable elements in the UI, this reference allows positioning the balloon over the
|
|
34
|
-
* right element whether the user is typing or using the UI.
|
|
35
|
-
*/
|
|
36
|
-
_lastFocusedEditableElement = null;
|
|
37
|
-
/**
|
|
38
|
-
* An additional CSS class added to the `BalloonView`.
|
|
39
|
-
*/
|
|
40
|
-
_balloonClass;
|
|
41
|
-
/**
|
|
42
|
-
* Creates a badge for a given editor. The feature is initialized on Editor#ready
|
|
43
|
-
* event.
|
|
44
|
-
*/
|
|
45
|
-
constructor(editor, options = {}) {
|
|
46
|
-
super();
|
|
47
|
-
this.editor = editor;
|
|
48
|
-
this._balloonClass = options.balloonClass;
|
|
49
|
-
editor.on('ready', () => this._handleEditorReady());
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Destroys the badge along with its view.
|
|
53
|
-
*/
|
|
54
|
-
destroy() {
|
|
55
|
-
const balloon = this._balloonView;
|
|
56
|
-
if (balloon) {
|
|
57
|
-
// Balloon gets destroyed by the body collection.
|
|
58
|
-
// The badge view gets destroyed by the balloon.
|
|
59
|
-
balloon.unpin();
|
|
60
|
-
this._balloonView = null;
|
|
61
|
-
}
|
|
62
|
-
this._showBalloonThrottled.cancel();
|
|
63
|
-
this.stopListening();
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Enables badge label once the editor (ui) is ready.
|
|
67
|
-
*/
|
|
68
|
-
_handleEditorReady() {
|
|
69
|
-
const editor = this.editor;
|
|
70
|
-
if (!this._isEnabled()) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
// No view means no body collection to append the badge balloon to.
|
|
74
|
-
if (!editor.ui.view) {
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
editor.ui.focusTracker.on('change:isFocused', (evt, data, isFocused) => {
|
|
78
|
-
this._updateLastFocusedEditableElement();
|
|
79
|
-
if (isFocused) {
|
|
80
|
-
this._showBalloon();
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
this._hideBalloon();
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
editor.ui.focusTracker.on('change:focusedElement', (evt, data, focusedElement) => {
|
|
87
|
-
this._updateLastFocusedEditableElement();
|
|
88
|
-
if (focusedElement) {
|
|
89
|
-
this._showBalloon();
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
editor.ui.on('update', () => {
|
|
93
|
-
this._showBalloonThrottled();
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Returns normalized configuration for the badge.
|
|
98
|
-
*/
|
|
99
|
-
_getNormalizedConfig() {
|
|
100
|
-
return {
|
|
101
|
-
side: this.editor.locale.contentLanguageDirection === 'ltr' ? 'right' : 'left',
|
|
102
|
-
position: 'border',
|
|
103
|
-
verticalOffset: 0,
|
|
104
|
-
horizontalOffset: 5
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Attempts to display the balloon with the badge view.
|
|
109
|
-
*/
|
|
110
|
-
_showBalloon() {
|
|
111
|
-
const attachOptions = this._getBalloonAttachOptions();
|
|
112
|
-
if (!attachOptions) {
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
if (!this._balloonView) {
|
|
116
|
-
this._balloonView = this._createBalloonView();
|
|
117
|
-
}
|
|
118
|
-
this._balloonView.pin(attachOptions);
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Hides the badge balloon if already visible.
|
|
122
|
-
*/
|
|
123
|
-
_hideBalloon() {
|
|
124
|
-
if (this._balloonView) {
|
|
125
|
-
this._balloonView.unpin();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* Creates an instance of the {@link module:ui/panel/balloon/balloonpanelview~BalloonPanelView balloon panel}
|
|
130
|
-
* with the badge view inside ready for positioning.
|
|
131
|
-
*/
|
|
132
|
-
_createBalloonView() {
|
|
133
|
-
const editor = this.editor;
|
|
134
|
-
const balloon = new BalloonPanelView();
|
|
135
|
-
const view = this._createBadgeContent();
|
|
136
|
-
balloon.content.add(view);
|
|
137
|
-
if (this._balloonClass) {
|
|
138
|
-
balloon.class = this._balloonClass;
|
|
139
|
-
}
|
|
140
|
-
editor.ui.view.body.add(balloon);
|
|
141
|
-
return balloon;
|
|
142
|
-
}
|
|
143
|
-
/**
|
|
144
|
-
* Returns the options for attaching the balloon to the focused editable element.
|
|
145
|
-
*/
|
|
146
|
-
_getBalloonAttachOptions() {
|
|
147
|
-
if (!this._lastFocusedEditableElement) {
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
const badgeConfig = this._getNormalizedConfig();
|
|
151
|
-
const positioningFunction = badgeConfig.side === 'right' ?
|
|
152
|
-
getLowerRightCornerPosition(this._lastFocusedEditableElement, badgeConfig) :
|
|
153
|
-
getLowerLeftCornerPosition(this._lastFocusedEditableElement, badgeConfig);
|
|
154
|
-
return {
|
|
155
|
-
target: this._lastFocusedEditableElement,
|
|
156
|
-
positions: [positioningFunction]
|
|
157
|
-
};
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Updates the {@link #_lastFocusedEditableElement} based on the state of the global focus tracker.
|
|
161
|
-
*/
|
|
162
|
-
_updateLastFocusedEditableElement() {
|
|
163
|
-
const editor = this.editor;
|
|
164
|
-
const isFocused = editor.ui.focusTracker.isFocused;
|
|
165
|
-
const focusedElement = editor.ui.focusTracker.focusedElement;
|
|
166
|
-
if (!isFocused || !focusedElement) {
|
|
167
|
-
this._lastFocusedEditableElement = null;
|
|
168
|
-
return;
|
|
169
|
-
}
|
|
170
|
-
const editableEditorElements = Array.from(editor.ui.getEditableElementsNames()).map(name => {
|
|
171
|
-
return editor.ui.getEditableElement(name);
|
|
172
|
-
});
|
|
173
|
-
if (editableEditorElements.includes(focusedElement)) {
|
|
174
|
-
this._lastFocusedEditableElement = focusedElement;
|
|
175
|
-
}
|
|
176
|
-
else {
|
|
177
|
-
// If it's none of the editable element, then the focus is somewhere in the UI. Let's display the badge
|
|
178
|
-
// over the first element then.
|
|
179
|
-
this._lastFocusedEditableElement = editableEditorElements[0];
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
function getLowerRightCornerPosition(focusedEditableElement, config) {
|
|
184
|
-
return getLowerCornerPosition(focusedEditableElement, config, (rootRect, balloonRect) => {
|
|
185
|
-
return rootRect.left + rootRect.width - balloonRect.width - config.horizontalOffset;
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
function getLowerLeftCornerPosition(focusedEditableElement, config) {
|
|
189
|
-
return getLowerCornerPosition(focusedEditableElement, config, rootRect => rootRect.left + config.horizontalOffset);
|
|
190
|
-
}
|
|
191
|
-
function getLowerCornerPosition(focusedEditableElement, config, getBalloonLeft) {
|
|
192
|
-
return (visibleEditableElementRect, balloonRect) => {
|
|
193
|
-
const editableElementRect = new Rect(focusedEditableElement);
|
|
194
|
-
if (editableElementRect.width < NARROW_ROOT_WIDTH_THRESHOLD || editableElementRect.height < NARROW_ROOT_HEIGHT_THRESHOLD) {
|
|
195
|
-
return null;
|
|
196
|
-
}
|
|
197
|
-
let balloonTop;
|
|
198
|
-
if (config.position === 'inside') {
|
|
199
|
-
balloonTop = editableElementRect.bottom - balloonRect.height;
|
|
200
|
-
}
|
|
201
|
-
else {
|
|
202
|
-
balloonTop = editableElementRect.bottom - balloonRect.height / 2;
|
|
203
|
-
}
|
|
204
|
-
balloonTop -= config.verticalOffset;
|
|
205
|
-
const balloonLeft = getBalloonLeft(editableElementRect, balloonRect);
|
|
206
|
-
// Clone the editable element rect and place it where the balloon would be placed.
|
|
207
|
-
// This will allow getVisible() to work from editable element's perspective (rect source).
|
|
208
|
-
// and yield a result as if the balloon was on the same (scrollable) layer as the editable element.
|
|
209
|
-
const newBalloonPositionRect = visibleEditableElementRect
|
|
210
|
-
.clone()
|
|
211
|
-
.moveTo(balloonLeft, balloonTop)
|
|
212
|
-
.getIntersection(balloonRect.clone().moveTo(balloonLeft, balloonTop));
|
|
213
|
-
const newBalloonPositionVisibleRect = newBalloonPositionRect.getVisible();
|
|
214
|
-
if (!newBalloonPositionVisibleRect || newBalloonPositionVisibleRect.getArea() < balloonRect.getArea()) {
|
|
215
|
-
return null;
|
|
216
|
-
}
|
|
217
|
-
return {
|
|
218
|
-
top: balloonTop,
|
|
219
|
-
left: balloonLeft,
|
|
220
|
-
name: `position_${config.position}-side_${config.side}`,
|
|
221
|
-
config: {
|
|
222
|
-
withArrow: false
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
};
|
|
226
|
-
}
|
|
@@ -1,107 +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
|
-
* A helper that adds a keyboard navigation support (arrow up/down/left/right) for grids.
|
|
7
|
-
*
|
|
8
|
-
* @param options Configuration options.
|
|
9
|
-
* @param options.keystrokeHandler Keystroke handler to register navigation with arrow keys.
|
|
10
|
-
* @param options.focusTracker A focus tracker for grid elements.
|
|
11
|
-
* @param options.gridItems A collection of grid items.
|
|
12
|
-
* @param options.numberOfColumns Number of columns in the grid. Can be specified as a function that returns
|
|
13
|
-
* the number (e.g. for responsive grids).
|
|
14
|
-
* @param options.uiLanguageDirection String of ui language direction.
|
|
15
|
-
*/
|
|
16
|
-
export function addKeyboardHandlingForGrid({ keystrokeHandler, focusTracker, gridItems, numberOfColumns, uiLanguageDirection }) {
|
|
17
|
-
const getNumberOfColumns = typeof numberOfColumns === 'number' ? () => numberOfColumns : numberOfColumns;
|
|
18
|
-
keystrokeHandler.set('arrowright', getGridItemFocuser((focusedElementIndex, gridItems) => {
|
|
19
|
-
return uiLanguageDirection === 'rtl' ?
|
|
20
|
-
getLeftElementIndex(focusedElementIndex, gridItems.length) :
|
|
21
|
-
getRightElementIndex(focusedElementIndex, gridItems.length);
|
|
22
|
-
}));
|
|
23
|
-
keystrokeHandler.set('arrowleft', getGridItemFocuser((focusedElementIndex, gridItems) => {
|
|
24
|
-
return uiLanguageDirection === 'rtl' ?
|
|
25
|
-
getRightElementIndex(focusedElementIndex, gridItems.length) :
|
|
26
|
-
getLeftElementIndex(focusedElementIndex, gridItems.length);
|
|
27
|
-
}));
|
|
28
|
-
keystrokeHandler.set('arrowup', getGridItemFocuser((focusedElementIndex, gridItems) => {
|
|
29
|
-
let nextIndex = focusedElementIndex - getNumberOfColumns();
|
|
30
|
-
if (nextIndex < 0) {
|
|
31
|
-
nextIndex = focusedElementIndex + getNumberOfColumns() * Math.floor(gridItems.length / getNumberOfColumns());
|
|
32
|
-
if (nextIndex > gridItems.length - 1) {
|
|
33
|
-
nextIndex -= getNumberOfColumns();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return nextIndex;
|
|
37
|
-
}));
|
|
38
|
-
keystrokeHandler.set('arrowdown', getGridItemFocuser((focusedElementIndex, gridItems) => {
|
|
39
|
-
let nextIndex = focusedElementIndex + getNumberOfColumns();
|
|
40
|
-
if (nextIndex > gridItems.length - 1) {
|
|
41
|
-
nextIndex = focusedElementIndex % getNumberOfColumns();
|
|
42
|
-
}
|
|
43
|
-
return nextIndex;
|
|
44
|
-
}));
|
|
45
|
-
function getGridItemFocuser(getIndexToFocus) {
|
|
46
|
-
return (evt) => {
|
|
47
|
-
const focusedElement = gridItems.find(item => item.element === focusTracker.focusedElement);
|
|
48
|
-
const focusedElementIndex = gridItems.getIndex(focusedElement);
|
|
49
|
-
const nextIndexToFocus = getIndexToFocus(focusedElementIndex, gridItems);
|
|
50
|
-
gridItems.get(nextIndexToFocus).focus();
|
|
51
|
-
evt.stopPropagation();
|
|
52
|
-
evt.preventDefault();
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Function returning the next index.
|
|
57
|
-
*
|
|
58
|
-
* ```
|
|
59
|
-
* before: [ ][x][ ] after: [ ][ ][x]
|
|
60
|
-
* index = 1 index = 2
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* If current index is last, function returns first index.
|
|
64
|
-
*
|
|
65
|
-
* ```
|
|
66
|
-
* before: [ ][ ][x] after: [x][ ][ ]
|
|
67
|
-
* index = 2 index = 0
|
|
68
|
-
* ```
|
|
69
|
-
*
|
|
70
|
-
* @param elementIndex Number of current index.
|
|
71
|
-
* @param collectionLength A count of collection items.
|
|
72
|
-
*/
|
|
73
|
-
function getRightElementIndex(elementIndex, collectionLength) {
|
|
74
|
-
if (elementIndex === collectionLength - 1) {
|
|
75
|
-
return 0;
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
return elementIndex + 1;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Function returning the previous index.
|
|
83
|
-
*
|
|
84
|
-
* ```
|
|
85
|
-
* before: [ ][x][ ] after: [x][ ][ ]
|
|
86
|
-
* index = 1 index = 0
|
|
87
|
-
* ```
|
|
88
|
-
*
|
|
89
|
-
* If current index is first, function returns last index.
|
|
90
|
-
*
|
|
91
|
-
* ```
|
|
92
|
-
* before: [x][ ][ ] after: [ ][ ][x]
|
|
93
|
-
* index = 0 index = 2
|
|
94
|
-
* ```
|
|
95
|
-
*
|
|
96
|
-
* @param elementIndex Number of current index.
|
|
97
|
-
* @param collectionLength A count of collection items.
|
|
98
|
-
*/
|
|
99
|
-
function getLeftElementIndex(elementIndex, collectionLength) {
|
|
100
|
-
if (elementIndex === 0) {
|
|
101
|
-
return collectionLength - 1;
|
|
102
|
-
}
|
|
103
|
-
else {
|
|
104
|
-
return elementIndex - 1;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,36 +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
|
-
* Handles clicking **outside** of a specified set of elements, then fires an action.
|
|
7
|
-
*
|
|
8
|
-
* **Note**: Actually, the action is executed upon `mousedown`, not `click`. It prevents
|
|
9
|
-
* certain issues when the user keeps holding the mouse button and the UI cannot react
|
|
10
|
-
* properly.
|
|
11
|
-
*
|
|
12
|
-
* @param options Configuration options.
|
|
13
|
-
* @param options.emitter The emitter to which this behavior should be added.
|
|
14
|
-
* @param options.activator Function returning a `Boolean`, to determine whether the handler is active.
|
|
15
|
-
* @param options.contextElements Array of HTML elements or a callback returning an array of HTML elements
|
|
16
|
-
* that determine the scope of the handler. Clicking any of them or their descendants will **not** fire the callback.
|
|
17
|
-
* @param options.callback An action executed by the handler.
|
|
18
|
-
* @param options.listenerOptions Additional options for the listener (like priority).
|
|
19
|
-
*/
|
|
20
|
-
export function clickOutsideHandler({ emitter, activator, callback, contextElements, listenerOptions }) {
|
|
21
|
-
emitter.listenTo(document, 'mousedown', (evt, domEvt) => {
|
|
22
|
-
if (!activator()) {
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
// Check if `composedPath` is `undefined` in case the browser does not support native shadow DOM.
|
|
26
|
-
// Can be removed when all supported browsers support native shadow DOM.
|
|
27
|
-
const path = typeof domEvt.composedPath == 'function' ? domEvt.composedPath() : [];
|
|
28
|
-
const contextElementsList = typeof contextElements == 'function' ? contextElements() : contextElements;
|
|
29
|
-
for (const contextElement of contextElementsList) {
|
|
30
|
-
if (contextElement.contains(domEvt.target) || path.includes(contextElement)) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
callback();
|
|
35
|
-
}, listenerOptions);
|
|
36
|
-
}
|
|
@@ -1,58 +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
|
-
* A mixin that brings the possibility to temporarily disable CSS transitions using
|
|
7
|
-
* {@link module:ui/view~View} methods. It is helpful when, for instance, the transitions should not happen
|
|
8
|
-
* when the view is first displayed but they should work normal in other cases.
|
|
9
|
-
*
|
|
10
|
-
* The methods to control the CSS transitions are:
|
|
11
|
-
* * `disableCssTransitions()` – Adds the `.ck-transitions-disabled` class to the
|
|
12
|
-
* {@link module:ui/view~View#element view element}.
|
|
13
|
-
* * `enableCssTransitions()` – Removes the `.ck-transitions-disabled` class from the
|
|
14
|
-
* {@link module:ui/view~View#element view element}.
|
|
15
|
-
*
|
|
16
|
-
* The usage comes down to:
|
|
17
|
-
*
|
|
18
|
-
* ```ts
|
|
19
|
-
* const MyViewWithCssTransitionDisabler = CssTransitionDisablerMixin( MyView );
|
|
20
|
-
* const view = new MyViewWithCssTransitionDisabler();
|
|
21
|
-
*
|
|
22
|
-
* // ...
|
|
23
|
-
*
|
|
24
|
-
* view.disableCssTransitions();
|
|
25
|
-
* view.show();
|
|
26
|
-
* view.enableCssTransitions();
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @param view View instance that should get this functionality.
|
|
30
|
-
*/
|
|
31
|
-
export function CssTransitionDisablerMixin(view) {
|
|
32
|
-
class Mixin extends view {
|
|
33
|
-
disableCssTransitions() {
|
|
34
|
-
this._isCssTransitionsDisabled = true;
|
|
35
|
-
}
|
|
36
|
-
enableCssTransitions() {
|
|
37
|
-
this._isCssTransitionsDisabled = false;
|
|
38
|
-
}
|
|
39
|
-
constructor(...args) {
|
|
40
|
-
super(...args);
|
|
41
|
-
this.set('_isCssTransitionsDisabled', false);
|
|
42
|
-
this.initializeCssTransitionDisablerMixin();
|
|
43
|
-
}
|
|
44
|
-
initializeCssTransitionDisablerMixin() {
|
|
45
|
-
if (this.template) {
|
|
46
|
-
this.extendTemplate({
|
|
47
|
-
attributes: {
|
|
48
|
-
class: [
|
|
49
|
-
this.bindTemplate.if('_isCssTransitionsDisabled', 'ck-transitions-disabled')
|
|
50
|
-
]
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return Mixin;
|
|
57
|
-
}
|
|
58
|
-
;
|