@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,438 +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/dropdown/dropdownview
|
|
7
|
-
*/
|
|
8
|
-
import { View } from '../view.js';
|
|
9
|
-
import { KeystrokeHandler, FocusTracker, getOptimalPosition } from '@ckeditor/ckeditor5-utils';
|
|
10
|
-
import '../../theme/components/dropdown/dropdown.css';
|
|
11
|
-
/**
|
|
12
|
-
* The dropdown view class. It manages the dropdown button and dropdown panel.
|
|
13
|
-
*
|
|
14
|
-
* In most cases, the easiest way to create a dropdown is by using the {@link module:ui/dropdown/utils~createDropdown}
|
|
15
|
-
* util:
|
|
16
|
-
*
|
|
17
|
-
* ```ts
|
|
18
|
-
* const dropdown = createDropdown( locale );
|
|
19
|
-
*
|
|
20
|
-
* // Configure dropdown's button properties:
|
|
21
|
-
* dropdown.buttonView.set( {
|
|
22
|
-
* label: 'A dropdown',
|
|
23
|
-
* withText: true
|
|
24
|
-
* } );
|
|
25
|
-
*
|
|
26
|
-
* dropdown.render();
|
|
27
|
-
*
|
|
28
|
-
* dropdown.panelView.element.textContent = 'Content of the panel';
|
|
29
|
-
*
|
|
30
|
-
* // Will render a dropdown with a panel containing a "Content of the panel" text.
|
|
31
|
-
* document.body.appendChild( dropdown.element );
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* If you want to add a richer content to the dropdown panel, you can use the {@link module:ui/dropdown/utils~addListToDropdown}
|
|
35
|
-
* and {@link module:ui/dropdown/utils~addToolbarToDropdown} helpers. See more examples in
|
|
36
|
-
* {@link module:ui/dropdown/utils~createDropdown} documentation.
|
|
37
|
-
*
|
|
38
|
-
* If you want to create a completely custom dropdown, then you can compose it manually:
|
|
39
|
-
*
|
|
40
|
-
* ```ts
|
|
41
|
-
* const button = new DropdownButtonView( locale );
|
|
42
|
-
* const panel = new DropdownPanelView( locale );
|
|
43
|
-
* const dropdown = new DropdownView( locale, button, panel );
|
|
44
|
-
*
|
|
45
|
-
* button.set( {
|
|
46
|
-
* label: 'A dropdown',
|
|
47
|
-
* withText: true
|
|
48
|
-
* } );
|
|
49
|
-
*
|
|
50
|
-
* dropdown.render();
|
|
51
|
-
*
|
|
52
|
-
* panel.element.textContent = 'Content of the panel';
|
|
53
|
-
*
|
|
54
|
-
* // Will render a dropdown with a panel containing a "Content of the panel" text.
|
|
55
|
-
* document.body.appendChild( dropdown.element );
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
58
|
-
* However, dropdown created this way will contain little behavior. You will need to implement handlers for actions
|
|
59
|
-
* such as {@link module:ui/bindings/clickoutsidehandler~clickOutsideHandler clicking outside an open dropdown}
|
|
60
|
-
* (which should close it) and support for arrow keys inside the panel. Therefore, unless you really know what
|
|
61
|
-
* you do and you really need to do it, it is recommended to use the {@link module:ui/dropdown/utils~createDropdown} helper.
|
|
62
|
-
*/
|
|
63
|
-
export class DropdownView extends View {
|
|
64
|
-
/**
|
|
65
|
-
* Button of the dropdown view. Clicking the button opens the {@link #panelView}.
|
|
66
|
-
*/
|
|
67
|
-
buttonView;
|
|
68
|
-
/**
|
|
69
|
-
* Panel of the dropdown. It opens when the {@link #buttonView} is
|
|
70
|
-
* {@link module:ui/button/button~Button#event:execute executed} (i.e. clicked).
|
|
71
|
-
*
|
|
72
|
-
* Child views can be added to the panel's `children` collection:
|
|
73
|
-
*
|
|
74
|
-
* ```ts
|
|
75
|
-
* dropdown.panelView.children.add( childView );
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* See {@link module:ui/dropdown/dropdownpanelview~DropdownPanelView#children} and
|
|
79
|
-
* {@link module:ui/viewcollection~ViewCollection#add}.
|
|
80
|
-
*/
|
|
81
|
-
panelView;
|
|
82
|
-
/**
|
|
83
|
-
* Tracks information about the DOM focus in the dropdown.
|
|
84
|
-
*/
|
|
85
|
-
focusTracker;
|
|
86
|
-
/**
|
|
87
|
-
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
|
|
88
|
-
* keystrokes of the dropdown:
|
|
89
|
-
*
|
|
90
|
-
* * <kbd>▼</kbd> opens the dropdown,
|
|
91
|
-
* * <kbd>◀</kbd> and <kbd>Esc</kbd> closes the dropdown.
|
|
92
|
-
*/
|
|
93
|
-
keystrokes;
|
|
94
|
-
/**
|
|
95
|
-
* A child {@link module:ui/list/listview~ListView list view} of the dropdown located
|
|
96
|
-
* in its {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.
|
|
97
|
-
*
|
|
98
|
-
* **Note**: Only supported when dropdown has list view added using {@link module:ui/dropdown/utils~addListToDropdown}.
|
|
99
|
-
*/
|
|
100
|
-
listView;
|
|
101
|
-
/**
|
|
102
|
-
* A child toolbar of the dropdown located in the
|
|
103
|
-
* {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.
|
|
104
|
-
*
|
|
105
|
-
* **Note**: Only supported when dropdown has a toolbar added using {@link module:ui/dropdown/utils~addToolbarToDropdown}.
|
|
106
|
-
*/
|
|
107
|
-
toolbarView;
|
|
108
|
-
/**
|
|
109
|
-
* A child menu component of the dropdown located
|
|
110
|
-
* in its {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel}.
|
|
111
|
-
*
|
|
112
|
-
* **Note**: Only supported when dropdown has a menu added using {@link module:ui/dropdown/utils~addMenuToDropdown}.
|
|
113
|
-
*/
|
|
114
|
-
menuView;
|
|
115
|
-
/**
|
|
116
|
-
* Creates an instance of the dropdown.
|
|
117
|
-
*
|
|
118
|
-
* Also see {@link #render}.
|
|
119
|
-
*
|
|
120
|
-
* @param locale The localization services instance.
|
|
121
|
-
*/
|
|
122
|
-
constructor(locale, buttonView, panelView) {
|
|
123
|
-
super(locale);
|
|
124
|
-
const bind = this.bindTemplate;
|
|
125
|
-
this.buttonView = buttonView;
|
|
126
|
-
this.panelView = panelView;
|
|
127
|
-
this.set('isOpen', false);
|
|
128
|
-
this.set('isEnabled', true);
|
|
129
|
-
this.set('class', undefined);
|
|
130
|
-
this.set('id', undefined);
|
|
131
|
-
this.set('panelPosition', 'auto');
|
|
132
|
-
// Toggle the visibility of the panel when the dropdown becomes open.
|
|
133
|
-
this.panelView.bind('isVisible').to(this, 'isOpen');
|
|
134
|
-
this.keystrokes = new KeystrokeHandler();
|
|
135
|
-
this.focusTracker = new FocusTracker();
|
|
136
|
-
this.setTemplate({
|
|
137
|
-
tag: 'div',
|
|
138
|
-
attributes: {
|
|
139
|
-
class: [
|
|
140
|
-
'ck',
|
|
141
|
-
'ck-dropdown',
|
|
142
|
-
bind.to('class'),
|
|
143
|
-
bind.if('isEnabled', 'ck-disabled', value => !value)
|
|
144
|
-
],
|
|
145
|
-
id: bind.to('id'),
|
|
146
|
-
'aria-describedby': bind.to('ariaDescribedById')
|
|
147
|
-
},
|
|
148
|
-
children: [
|
|
149
|
-
buttonView,
|
|
150
|
-
panelView
|
|
151
|
-
]
|
|
152
|
-
});
|
|
153
|
-
buttonView.extendTemplate({
|
|
154
|
-
attributes: {
|
|
155
|
-
class: [
|
|
156
|
-
'ck-dropdown__button'
|
|
157
|
-
],
|
|
158
|
-
'data-cke-tooltip-disabled': bind.to('isOpen')
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
/**
|
|
163
|
-
* @inheritDoc
|
|
164
|
-
*/
|
|
165
|
-
render() {
|
|
166
|
-
super.render();
|
|
167
|
-
this.focusTracker.add(this.buttonView.element);
|
|
168
|
-
this.focusTracker.add(this.panelView.element);
|
|
169
|
-
// Toggle the dropdown when its button has been clicked.
|
|
170
|
-
this.listenTo(this.buttonView, 'open', () => {
|
|
171
|
-
this.isOpen = !this.isOpen;
|
|
172
|
-
});
|
|
173
|
-
// Let the dropdown control the position of the panel. The position must
|
|
174
|
-
// be updated every time the dropdown is open.
|
|
175
|
-
this.on('change:isOpen', (evt, name, isOpen) => {
|
|
176
|
-
if (!isOpen) {
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
// If "auto", find the best position of the panel to fit into the viewport.
|
|
180
|
-
// Otherwise, simply assign the static position.
|
|
181
|
-
if (this.panelPosition === 'auto') {
|
|
182
|
-
const optimalPanelPosition = DropdownView._getOptimalPosition({
|
|
183
|
-
element: this.panelView.element,
|
|
184
|
-
target: this.buttonView.element,
|
|
185
|
-
fitInViewport: true,
|
|
186
|
-
positions: this._panelPositions
|
|
187
|
-
});
|
|
188
|
-
this.panelView.position = (optimalPanelPosition ? optimalPanelPosition.name : this._defaultPanelPositionName);
|
|
189
|
-
}
|
|
190
|
-
else {
|
|
191
|
-
this.panelView.position = this.panelPosition;
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
// Listen for keystrokes coming from within #element.
|
|
195
|
-
this.keystrokes.listenTo(this.element);
|
|
196
|
-
const closeDropdown = (data, cancel) => {
|
|
197
|
-
if (this.isOpen) {
|
|
198
|
-
this.isOpen = false;
|
|
199
|
-
cancel();
|
|
200
|
-
}
|
|
201
|
-
};
|
|
202
|
-
// Open the dropdown panel using the arrow down key, just like with return or space.
|
|
203
|
-
this.keystrokes.set('arrowdown', (data, cancel) => {
|
|
204
|
-
// Don't open if the dropdown is disabled or already open.
|
|
205
|
-
if (this.buttonView.isEnabled && !this.isOpen) {
|
|
206
|
-
this.isOpen = true;
|
|
207
|
-
cancel();
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
// Block the right arrow key (until nested dropdowns are implemented).
|
|
211
|
-
this.keystrokes.set('arrowright', (data, cancel) => {
|
|
212
|
-
if (this.isOpen) {
|
|
213
|
-
cancel();
|
|
214
|
-
}
|
|
215
|
-
});
|
|
216
|
-
// Close the dropdown using the arrow left/escape key.
|
|
217
|
-
this.keystrokes.set('arrowleft', closeDropdown);
|
|
218
|
-
this.keystrokes.set('esc', closeDropdown);
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Focuses the {@link #buttonView}.
|
|
222
|
-
*/
|
|
223
|
-
focus() {
|
|
224
|
-
this.buttonView.focus();
|
|
225
|
-
}
|
|
226
|
-
/**
|
|
227
|
-
* Returns {@link #panelView panel} positions to be used by the
|
|
228
|
-
* {@link module:utils/dom/position~getOptimalPosition `getOptimalPosition()`}
|
|
229
|
-
* utility considering the direction of the language the UI of the editor is displayed in.
|
|
230
|
-
*/
|
|
231
|
-
get _panelPositions() {
|
|
232
|
-
const { south, north, southEast, southWest, northEast, northWest, southMiddleEast, southMiddleWest, northMiddleEast, northMiddleWest } = DropdownView.defaultPanelPositions;
|
|
233
|
-
if (this.locale.uiLanguageDirection !== 'rtl') {
|
|
234
|
-
return [
|
|
235
|
-
southEast, southWest, southMiddleEast, southMiddleWest, south,
|
|
236
|
-
northEast, northWest, northMiddleEast, northMiddleWest, north
|
|
237
|
-
];
|
|
238
|
-
}
|
|
239
|
-
else {
|
|
240
|
-
return [
|
|
241
|
-
southWest, southEast, southMiddleWest, southMiddleEast, south,
|
|
242
|
-
northWest, northEast, northMiddleWest, northMiddleEast, north
|
|
243
|
-
];
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
/**
|
|
247
|
-
* Returns the default position of the dropdown panel based on the direction of the UI language.
|
|
248
|
-
* It is used when the {@link #panelPosition} is set to `'auto'` and the panel has not found a
|
|
249
|
-
* suitable position to fit into the viewport.
|
|
250
|
-
*/
|
|
251
|
-
get _defaultPanelPositionName() {
|
|
252
|
-
return this.locale.uiLanguageDirection === 'rtl' ? 'sw' : 'se';
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* A set of positioning functions used by the dropdown view to determine
|
|
256
|
-
* the optimal position (i.e. fitting into the browser viewport) of its
|
|
257
|
-
* {@link module:ui/dropdown/dropdownview~DropdownView#panelView panel} when
|
|
258
|
-
* {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition} is set to 'auto'`.
|
|
259
|
-
*
|
|
260
|
-
* The available positioning functions are as follow:
|
|
261
|
-
*
|
|
262
|
-
* **South**
|
|
263
|
-
*
|
|
264
|
-
* * `south`
|
|
265
|
-
*
|
|
266
|
-
* ```
|
|
267
|
-
* [ Button ]
|
|
268
|
-
* +-----------------+
|
|
269
|
-
* | Panel |
|
|
270
|
-
* +-----------------+
|
|
271
|
-
* ```
|
|
272
|
-
*
|
|
273
|
-
* * `southEast`
|
|
274
|
-
*
|
|
275
|
-
* ```
|
|
276
|
-
* [ Button ]
|
|
277
|
-
* +-----------------+
|
|
278
|
-
* | Panel |
|
|
279
|
-
* +-----------------+
|
|
280
|
-
* ```
|
|
281
|
-
*
|
|
282
|
-
* * `southWest`
|
|
283
|
-
*
|
|
284
|
-
* ```
|
|
285
|
-
* [ Button ]
|
|
286
|
-
* +-----------------+
|
|
287
|
-
* | Panel |
|
|
288
|
-
* +-----------------+
|
|
289
|
-
* ```
|
|
290
|
-
*
|
|
291
|
-
* * `southMiddleEast`
|
|
292
|
-
*
|
|
293
|
-
* ```
|
|
294
|
-
* [ Button ]
|
|
295
|
-
* +-----------------+
|
|
296
|
-
* | Panel |
|
|
297
|
-
* +-----------------+
|
|
298
|
-
* ```
|
|
299
|
-
*
|
|
300
|
-
* * `southMiddleWest`
|
|
301
|
-
*
|
|
302
|
-
* ```
|
|
303
|
-
* [ Button ]
|
|
304
|
-
* +-----------------+
|
|
305
|
-
* | Panel |
|
|
306
|
-
* +-----------------+
|
|
307
|
-
* ```
|
|
308
|
-
*
|
|
309
|
-
* **North**
|
|
310
|
-
*
|
|
311
|
-
* * `north`
|
|
312
|
-
*
|
|
313
|
-
* ```
|
|
314
|
-
* +-----------------+
|
|
315
|
-
* | Panel |
|
|
316
|
-
* +-----------------+
|
|
317
|
-
* [ Button ]
|
|
318
|
-
* ```
|
|
319
|
-
*
|
|
320
|
-
* * `northEast`
|
|
321
|
-
*
|
|
322
|
-
* ```
|
|
323
|
-
* +-----------------+
|
|
324
|
-
* | Panel |
|
|
325
|
-
* +-----------------+
|
|
326
|
-
* [ Button ]
|
|
327
|
-
* ```
|
|
328
|
-
*
|
|
329
|
-
* * `northWest`
|
|
330
|
-
*
|
|
331
|
-
* ```
|
|
332
|
-
* +-----------------+
|
|
333
|
-
* | Panel |
|
|
334
|
-
* +-----------------+
|
|
335
|
-
* [ Button ]
|
|
336
|
-
* ```
|
|
337
|
-
*
|
|
338
|
-
* * `northMiddleEast`
|
|
339
|
-
*
|
|
340
|
-
* ```
|
|
341
|
-
* +-----------------+
|
|
342
|
-
* | Panel |
|
|
343
|
-
* +-----------------+
|
|
344
|
-
* [ Button ]
|
|
345
|
-
* ```
|
|
346
|
-
*
|
|
347
|
-
* * `northMiddleWest`
|
|
348
|
-
*
|
|
349
|
-
* ```
|
|
350
|
-
* +-----------------+
|
|
351
|
-
* | Panel |
|
|
352
|
-
* +-----------------+
|
|
353
|
-
* [ Button ]
|
|
354
|
-
* ```
|
|
355
|
-
*
|
|
356
|
-
* Positioning functions are compatible with {@link module:utils/dom/position~DomPoint}.
|
|
357
|
-
*
|
|
358
|
-
* The name that position function returns will be reflected in dropdown panel's class that
|
|
359
|
-
* controls its placement. See {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition}
|
|
360
|
-
* to learn more.
|
|
361
|
-
*/
|
|
362
|
-
static defaultPanelPositions = {
|
|
363
|
-
south: (buttonRect, panelRect) => {
|
|
364
|
-
return {
|
|
365
|
-
top: buttonRect.bottom,
|
|
366
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) / 2,
|
|
367
|
-
name: 's'
|
|
368
|
-
};
|
|
369
|
-
},
|
|
370
|
-
southEast: buttonRect => {
|
|
371
|
-
return {
|
|
372
|
-
top: buttonRect.bottom,
|
|
373
|
-
left: buttonRect.left,
|
|
374
|
-
name: 'se'
|
|
375
|
-
};
|
|
376
|
-
},
|
|
377
|
-
southWest: (buttonRect, panelRect) => {
|
|
378
|
-
return {
|
|
379
|
-
top: buttonRect.bottom,
|
|
380
|
-
left: buttonRect.left - panelRect.width + buttonRect.width,
|
|
381
|
-
name: 'sw'
|
|
382
|
-
};
|
|
383
|
-
},
|
|
384
|
-
southMiddleEast: (buttonRect, panelRect) => {
|
|
385
|
-
return {
|
|
386
|
-
top: buttonRect.bottom,
|
|
387
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) / 4,
|
|
388
|
-
name: 'sme'
|
|
389
|
-
};
|
|
390
|
-
},
|
|
391
|
-
southMiddleWest: (buttonRect, panelRect) => {
|
|
392
|
-
return {
|
|
393
|
-
top: buttonRect.bottom,
|
|
394
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) * 3 / 4,
|
|
395
|
-
name: 'smw'
|
|
396
|
-
};
|
|
397
|
-
},
|
|
398
|
-
north: (buttonRect, panelRect) => {
|
|
399
|
-
return {
|
|
400
|
-
top: buttonRect.top - panelRect.height,
|
|
401
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) / 2,
|
|
402
|
-
name: 'n'
|
|
403
|
-
};
|
|
404
|
-
},
|
|
405
|
-
northEast: (buttonRect, panelRect) => {
|
|
406
|
-
return {
|
|
407
|
-
top: buttonRect.top - panelRect.height,
|
|
408
|
-
left: buttonRect.left,
|
|
409
|
-
name: 'ne'
|
|
410
|
-
};
|
|
411
|
-
},
|
|
412
|
-
northWest: (buttonRect, panelRect) => {
|
|
413
|
-
return {
|
|
414
|
-
top: buttonRect.top - panelRect.height,
|
|
415
|
-
left: buttonRect.left - panelRect.width + buttonRect.width,
|
|
416
|
-
name: 'nw'
|
|
417
|
-
};
|
|
418
|
-
},
|
|
419
|
-
northMiddleEast: (buttonRect, panelRect) => {
|
|
420
|
-
return {
|
|
421
|
-
top: buttonRect.top - panelRect.height,
|
|
422
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) / 4,
|
|
423
|
-
name: 'nme'
|
|
424
|
-
};
|
|
425
|
-
},
|
|
426
|
-
northMiddleWest: (buttonRect, panelRect) => {
|
|
427
|
-
return {
|
|
428
|
-
top: buttonRect.top - panelRect.height,
|
|
429
|
-
left: buttonRect.left - (panelRect.width - buttonRect.width) * 3 / 4,
|
|
430
|
-
name: 'nmw'
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
/**
|
|
435
|
-
* A function used to calculate the optimal position for the dropdown panel.
|
|
436
|
-
*/
|
|
437
|
-
static _getOptimalPosition = getOptimalPosition;
|
|
438
|
-
}
|
|
@@ -1,125 +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 { DropdownMenuListItemView } from './dropdownmenulistitemview.js';
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export const DropdownRootMenuBehaviors = {
|
|
10
|
-
/**
|
|
11
|
-
* Move focus to a menu item on mouse hover. If it is a button to open a nested menu, open that menu.
|
|
12
|
-
*/
|
|
13
|
-
toggleMenusAndFocusItemsOnHover(rootList) {
|
|
14
|
-
rootList.on('menu:mouseenter', evt => {
|
|
15
|
-
const [pathLeaf] = evt.path;
|
|
16
|
-
evt.source.focus();
|
|
17
|
-
for (const menuView of rootList.menus) {
|
|
18
|
-
const isListItemContainingMenu = pathLeaf instanceof DropdownMenuListItemView && pathLeaf.childView === menuView;
|
|
19
|
-
menuView.isOpen = (evt.path.includes(menuView) || isListItemContainingMenu) && menuView.isEnabled;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
},
|
|
23
|
-
/**
|
|
24
|
-
* Handles the following case:
|
|
25
|
-
*
|
|
26
|
-
* 1. Hover to open a sub-menu (A). The button has focus.
|
|
27
|
-
* 2. Press arrow up/down to move focus to another sub-menu (B) button.
|
|
28
|
-
* 3. Press arrow right to open the sub-menu (B).
|
|
29
|
-
* 4. The sub-menu (A) should close (if not, there are two open menus).
|
|
30
|
-
*/
|
|
31
|
-
closeMenuWhenAnotherOnTheSameLevelOpens(rootList) {
|
|
32
|
-
rootList.on('menu:change:isOpen', (evt, name, isOpen) => {
|
|
33
|
-
if (!isOpen) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const evtMenu = evt.source;
|
|
37
|
-
for (const menuView of rootList.menus) {
|
|
38
|
-
if (evtMenu.parentMenuView === menuView.parentMenuView && evtMenu !== menuView) {
|
|
39
|
-
menuView.isOpen = false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
export const DropdownMenuBehaviors = {
|
|
49
|
-
/**
|
|
50
|
-
* Open the menu on the right arrow key press (left, in RTL mode). This allows for navigating to sub-menus using the keyboard.
|
|
51
|
-
*/
|
|
52
|
-
openOnArrowRightKey(menuView) {
|
|
53
|
-
const keystroke = menuView.locale.uiLanguageDirection === 'rtl' ? 'arrowleft' : 'arrowright';
|
|
54
|
-
menuView.keystrokes.set(keystroke, (data, cancel) => {
|
|
55
|
-
if (menuView.focusTracker.focusedElement !== menuView.buttonView.element || !menuView.isEnabled) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (!menuView.isOpen) {
|
|
59
|
-
menuView.isOpen = true;
|
|
60
|
-
}
|
|
61
|
-
menuView.panelView.focus();
|
|
62
|
-
cancel();
|
|
63
|
-
});
|
|
64
|
-
},
|
|
65
|
-
/**
|
|
66
|
-
* Opens the menu on its button click as well as enter and space keys press (if the button is focused).
|
|
67
|
-
*/
|
|
68
|
-
openOnButtonClick(menuView) {
|
|
69
|
-
menuView.buttonView.on('execute', () => {
|
|
70
|
-
if (menuView.isEnabled) {
|
|
71
|
-
menuView.isOpen = true;
|
|
72
|
-
}
|
|
73
|
-
});
|
|
74
|
-
},
|
|
75
|
-
/**
|
|
76
|
-
* Opens the menu and focuses the panel content upon pressing the Enter key.
|
|
77
|
-
*/
|
|
78
|
-
openAndFocusOnEnterKeyPress(menuView) {
|
|
79
|
-
menuView.keystrokes.set('enter', (data, cancel) => {
|
|
80
|
-
// Engage only for Enter key press when the button is focused. The panel can contain
|
|
81
|
-
// other UI components and features that rely on the Enter key press.
|
|
82
|
-
if (menuView.focusTracker.focusedElement !== menuView.buttonView.element) {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
menuView.isOpen = true;
|
|
86
|
-
menuView.panelView.focus();
|
|
87
|
-
cancel();
|
|
88
|
-
});
|
|
89
|
-
},
|
|
90
|
-
/**
|
|
91
|
-
* Closes the menu on the left key press (right, in RTL mode). This allows for navigating to sub-menus using the keyboard.
|
|
92
|
-
*/
|
|
93
|
-
closeOnArrowLeftKey(menuView) {
|
|
94
|
-
const keystroke = menuView.locale.uiLanguageDirection === 'rtl' ? 'arrowright' : 'arrowleft';
|
|
95
|
-
menuView.keystrokes.set(keystroke, (data, cancel) => {
|
|
96
|
-
if (menuView.isOpen) {
|
|
97
|
-
// Focus first, then close the panel. Otherwise, Safari won't send blur events for detached DOM elements, leading to errors.
|
|
98
|
-
menuView.focus();
|
|
99
|
-
menuView.isOpen = false;
|
|
100
|
-
cancel();
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
},
|
|
104
|
-
closeOnEscKey(menuView) {
|
|
105
|
-
menuView.keystrokes.set('esc', (data, cancel) => {
|
|
106
|
-
if (menuView.isOpen) {
|
|
107
|
-
// Focus first, then close the panel. Otherwise, Safari won't send blur events for detached DOM elements, leading to errors.
|
|
108
|
-
menuView.focus();
|
|
109
|
-
menuView.isOpen = false;
|
|
110
|
-
cancel();
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
},
|
|
114
|
-
/**
|
|
115
|
-
* Closes the menu when its parent menu closes. This prevents from leaving orphaned open menus.
|
|
116
|
-
*/
|
|
117
|
-
closeOnParentClose(menuView, parentMenuView) {
|
|
118
|
-
parentMenuView.on('change:isOpen', (evt, name, isOpen) => {
|
|
119
|
-
// TODO: Remove checking `evt.source` if `change:isOpen` is no longer delegated.
|
|
120
|
-
if (!isOpen && evt.source === parentMenuView) {
|
|
121
|
-
menuView.isOpen = false;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
};
|
|
@@ -1,69 +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/dropdown/menu/dropdownmenubuttonview
|
|
7
|
-
*/
|
|
8
|
-
import { IconDropdownArrow } from '@ckeditor/ckeditor5-icons';
|
|
9
|
-
import { IconView } from '../../icon/iconview.js';
|
|
10
|
-
import { ListItemButtonView } from '../../button/listitembuttonview.js';
|
|
11
|
-
import '../../../theme/components/dropdown/menu/dropdownmenubutton.css';
|
|
12
|
-
/**
|
|
13
|
-
* Represents a view for a dropdown menu button.
|
|
14
|
-
*/
|
|
15
|
-
export class DropdownMenuButtonView extends ListItemButtonView {
|
|
16
|
-
/**
|
|
17
|
-
* An icon that displays an arrow to indicate a direction of the menu.
|
|
18
|
-
*/
|
|
19
|
-
arrowView;
|
|
20
|
-
/**
|
|
21
|
-
* Creates an instance of the dropdown menu button view.
|
|
22
|
-
*
|
|
23
|
-
* @param locale The localization services instance.
|
|
24
|
-
*/
|
|
25
|
-
constructor(locale) {
|
|
26
|
-
super(locale);
|
|
27
|
-
const bind = this.bindTemplate;
|
|
28
|
-
this.set({
|
|
29
|
-
withText: true,
|
|
30
|
-
role: 'menuitem'
|
|
31
|
-
});
|
|
32
|
-
this.arrowView = this._createArrowView();
|
|
33
|
-
this.extendTemplate({
|
|
34
|
-
attributes: {
|
|
35
|
-
class: [
|
|
36
|
-
'ck-dropdown-menu-list__nested-menu__button'
|
|
37
|
-
],
|
|
38
|
-
'aria-haspopup': true,
|
|
39
|
-
'aria-expanded': this.bindTemplate.to('isOn', value => String(value)),
|
|
40
|
-
'data-cke-tooltip-disabled': bind.to('isOn')
|
|
41
|
-
},
|
|
42
|
-
on: {
|
|
43
|
-
'mouseenter': bind.to('mouseenter')
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* @inheritDoc
|
|
49
|
-
*/
|
|
50
|
-
render() {
|
|
51
|
-
super.render();
|
|
52
|
-
this.children.add(this.arrowView);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Creates the arrow view instance.
|
|
56
|
-
*
|
|
57
|
-
* @private
|
|
58
|
-
*/
|
|
59
|
-
_createArrowView() {
|
|
60
|
-
const arrowView = new IconView();
|
|
61
|
-
arrowView.content = IconDropdownArrow;
|
|
62
|
-
arrowView.extendTemplate({
|
|
63
|
-
attributes: {
|
|
64
|
-
class: 'ck-dropdown-menu-list__nested-menu__button__arrow'
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
return arrowView;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
@@ -1,30 +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 { ButtonView } from '../../button/buttonview.js';
|
|
6
|
-
import '../../../theme/components/dropdown/menu/dropdownmenulistitembutton.css';
|
|
7
|
-
/**
|
|
8
|
-
* Represents a view for a button in a dropdown menu list item.
|
|
9
|
-
*/
|
|
10
|
-
export class DropdownMenuListItemButtonView extends ButtonView {
|
|
11
|
-
id;
|
|
12
|
-
constructor(locale, id, label) {
|
|
13
|
-
super(locale);
|
|
14
|
-
this.id = id;
|
|
15
|
-
this.set({
|
|
16
|
-
withText: true,
|
|
17
|
-
withKeystroke: true,
|
|
18
|
-
tooltip: false,
|
|
19
|
-
role: 'menuitem',
|
|
20
|
-
label
|
|
21
|
-
});
|
|
22
|
-
this.extendTemplate({
|
|
23
|
-
attributes: {
|
|
24
|
-
class: [
|
|
25
|
-
'ck-dropdown-menu-list__nested-menu__item__button'
|
|
26
|
-
]
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,38 +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 { ListItemView } from '../../list/listitemview.js';
|
|
6
|
-
import { DropdownMenuListItemButtonView } from './dropdownmenulistitembuttonview.js';
|
|
7
|
-
import '../../../theme/components/dropdown/menu/dropdownmenulistitem.css';
|
|
8
|
-
/**
|
|
9
|
-
* Represents a view for a single item in a dropdown menu list.
|
|
10
|
-
*/
|
|
11
|
-
export class DropdownMenuListItemView extends ListItemView {
|
|
12
|
-
/**
|
|
13
|
-
* The view representing either a flat item or a nested menu in a dropdown menu list item.
|
|
14
|
-
*/
|
|
15
|
-
childView;
|
|
16
|
-
constructor(locale, parentMenuView, childView) {
|
|
17
|
-
super(locale);
|
|
18
|
-
const bind = this.bindTemplate;
|
|
19
|
-
this.childView = childView;
|
|
20
|
-
this.children.add(childView);
|
|
21
|
-
this.extendTemplate({
|
|
22
|
-
attributes: {
|
|
23
|
-
class: [
|
|
24
|
-
'ck-dropdown-menu-list__nested-menu__item'
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
on: {
|
|
28
|
-
'mouseenter': bind.to('mouseenter')
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
if (parentMenuView) {
|
|
32
|
-
this.delegate('mouseenter').to(parentMenuView);
|
|
33
|
-
if (childView instanceof DropdownMenuListItemButtonView) {
|
|
34
|
-
childView.delegate('execute').to(parentMenuView);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|