@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,144 +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 { global } from '@ckeditor/ckeditor5-utils';
|
|
6
|
-
/**
|
|
7
|
-
* A mixin that brings the possibility to observe dragging of the view element.
|
|
8
|
-
* The view has to implement the {@link ~DraggableView} interface to use it:
|
|
9
|
-
*
|
|
10
|
-
* ```js
|
|
11
|
-
* export class MyDraggableView extends DraggableViewMixin( View ) implements DraggableView {
|
|
12
|
-
* // ...
|
|
13
|
-
* }
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* Creating a class extending it attaches a set of mouse and touch listeners allowing to observe dragging of the view element:
|
|
17
|
-
* * `mousedown` and `touchstart` on the view element - starting the dragging.
|
|
18
|
-
* * `mousemove` and `touchmove` on the document - updating the view coordinates.
|
|
19
|
-
* * `mouseup` and `touchend` on the document - stopping the dragging.
|
|
20
|
-
*
|
|
21
|
-
* The mixin itself does not provide a visual feedback (that is, the dragged element does not change its position) -
|
|
22
|
-
* it is up to the developer to implement it.
|
|
23
|
-
*/
|
|
24
|
-
export function DraggableViewMixin(view) {
|
|
25
|
-
class DraggableMixin extends view {
|
|
26
|
-
/**
|
|
27
|
-
* A bound version of {@link #_onDrag}.
|
|
28
|
-
*/
|
|
29
|
-
_onDragBound = this._onDrag.bind(this);
|
|
30
|
-
/**
|
|
31
|
-
* A bound version of {@link #_onDragEnd}.
|
|
32
|
-
*/
|
|
33
|
-
_onDragEndBound = this._onDragEnd.bind(this);
|
|
34
|
-
/**
|
|
35
|
-
* The last coordinates of the view. It is updated on every mouse move.
|
|
36
|
-
*/
|
|
37
|
-
_lastDraggingCoordinates = { x: 0, y: 0 };
|
|
38
|
-
/**
|
|
39
|
-
* @inheritDoc
|
|
40
|
-
*/
|
|
41
|
-
constructor(...args) {
|
|
42
|
-
super(...args);
|
|
43
|
-
this.on('render', () => {
|
|
44
|
-
this._attachListeners();
|
|
45
|
-
});
|
|
46
|
-
this.set('isDragging', false);
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Attaches the listeners for the drag start.
|
|
50
|
-
*/
|
|
51
|
-
_attachListeners() {
|
|
52
|
-
this.listenTo(this.element, 'mousedown', this._onDragStart.bind(this));
|
|
53
|
-
this.listenTo(this.element, 'touchstart', this._onDragStart.bind(this));
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* Attaches the listeners for the dragging and drag end.
|
|
57
|
-
*/
|
|
58
|
-
_attachDragListeners() {
|
|
59
|
-
this.listenTo(global.document, 'mouseup', this._onDragEndBound);
|
|
60
|
-
this.listenTo(global.document, 'touchend', this._onDragEndBound);
|
|
61
|
-
this.listenTo(global.document, 'mousemove', this._onDragBound);
|
|
62
|
-
this.listenTo(global.document, 'touchmove', this._onDragBound);
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Detaches the listeners after the drag end.
|
|
66
|
-
*/
|
|
67
|
-
_detachDragListeners() {
|
|
68
|
-
this.stopListening(global.document, 'mouseup', this._onDragEndBound);
|
|
69
|
-
this.stopListening(global.document, 'touchend', this._onDragEndBound);
|
|
70
|
-
this.stopListening(global.document, 'mousemove', this._onDragBound);
|
|
71
|
-
this.stopListening(global.document, 'touchmove', this._onDragBound);
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Starts the dragging listeners and sets the initial view coordinates.
|
|
75
|
-
*/
|
|
76
|
-
_onDragStart(evt, domEvt) {
|
|
77
|
-
if (!this._isHandleElementPressed(domEvt)) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
this._attachDragListeners();
|
|
81
|
-
let x = 0;
|
|
82
|
-
let y = 0;
|
|
83
|
-
// If dragging is performed with a mouse, there is only one set of coordinates available.
|
|
84
|
-
// But when using a touch device, there may be many of them, so use the coordinates from the first touch.
|
|
85
|
-
if (domEvt instanceof MouseEvent) {
|
|
86
|
-
x = domEvt.clientX;
|
|
87
|
-
y = domEvt.clientY;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
x = domEvt.touches[0].clientX;
|
|
91
|
-
y = domEvt.touches[0].clientY;
|
|
92
|
-
}
|
|
93
|
-
this._lastDraggingCoordinates = { x, y };
|
|
94
|
-
this.isDragging = true;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Updates the view coordinates and fires the `drag` event.
|
|
98
|
-
*/
|
|
99
|
-
_onDrag(evt, domEvt) {
|
|
100
|
-
// If dragging was stopped by some external intervention, stop listening.
|
|
101
|
-
if (!this.isDragging) {
|
|
102
|
-
this._detachDragListeners();
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
let newX = 0;
|
|
106
|
-
let newY = 0;
|
|
107
|
-
// If dragging is performed with a mouse, there is only one set of coordinates available.
|
|
108
|
-
// But when using a touch device, there may be many of them, so use the coordinates from the first touch.
|
|
109
|
-
if (domEvt instanceof MouseEvent) {
|
|
110
|
-
newX = domEvt.clientX;
|
|
111
|
-
newY = domEvt.clientY;
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
newX = domEvt.touches[0].clientX;
|
|
115
|
-
newY = domEvt.touches[0].clientY;
|
|
116
|
-
}
|
|
117
|
-
// Prevents selection of text while dragging on Safari.
|
|
118
|
-
domEvt.preventDefault();
|
|
119
|
-
this.fire('drag', {
|
|
120
|
-
deltaX: Math.round(newX - this._lastDraggingCoordinates.x),
|
|
121
|
-
deltaY: Math.round(newY - this._lastDraggingCoordinates.y)
|
|
122
|
-
});
|
|
123
|
-
this._lastDraggingCoordinates = { x: newX, y: newY };
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* Stops the dragging and detaches the listeners.
|
|
127
|
-
*/
|
|
128
|
-
_onDragEnd() {
|
|
129
|
-
this._detachDragListeners();
|
|
130
|
-
this.isDragging = false;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Checks if the drag handle element was pressed.
|
|
134
|
-
*/
|
|
135
|
-
_isHandleElementPressed(domEvt) {
|
|
136
|
-
if (!this.dragHandleElement) {
|
|
137
|
-
return false;
|
|
138
|
-
}
|
|
139
|
-
return this.dragHandleElement === domEvt.target ||
|
|
140
|
-
(domEvt.target instanceof HTMLElement && this.dragHandleElement.contains(domEvt.target));
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
return DraggableMixin;
|
|
144
|
-
}
|
|
@@ -1,35 +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 which executes a native `Event.preventDefault()` if the target of an event equals the
|
|
7
|
-
* {@link module:ui/view~View#element element of the view}. It shortens the definition of a
|
|
8
|
-
* {@link module:ui/view~View#template template}.
|
|
9
|
-
*
|
|
10
|
-
* ```ts
|
|
11
|
-
* // In a class extending View.
|
|
12
|
-
* import { preventDefault } from '@ckeditor/ckeditor5-ui/src/bindings/preventdefault';
|
|
13
|
-
*
|
|
14
|
-
* // ...
|
|
15
|
-
*
|
|
16
|
-
* this.setTemplate( {
|
|
17
|
-
* tag: 'div',
|
|
18
|
-
*
|
|
19
|
-
* on: {
|
|
20
|
-
* // Prevent the default mousedown action on this view.
|
|
21
|
-
* mousedown: preventDefault( this )
|
|
22
|
-
* }
|
|
23
|
-
* } );
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @param view View instance that defines the template.
|
|
27
|
-
* @internal
|
|
28
|
-
*/
|
|
29
|
-
export function preventDefault(view) {
|
|
30
|
-
return view.bindTemplate.to(evt => {
|
|
31
|
-
if (evt.target === view.element) {
|
|
32
|
-
evt.preventDefault();
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}
|
|
@@ -1,47 +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 handler useful for {@link module:ui/view~View views} working as HTML forms. It intercepts a native DOM
|
|
7
|
-
* `submit` event, prevents the default web browser behavior (navigation and page reload) and
|
|
8
|
-
* fires the `submit` event on a view instead. Such a custom event can be then used by any
|
|
9
|
-
* {@link module:utils/dom/emittermixin~DomEmitter emitter}, e.g. to serialize the form data.
|
|
10
|
-
*
|
|
11
|
-
* ```ts
|
|
12
|
-
* import { submitHandler } from '@ckeditor/ckeditor5-ui/src/bindings/submithandler';
|
|
13
|
-
*
|
|
14
|
-
* // ...
|
|
15
|
-
*
|
|
16
|
-
* class AnyFormView extends View {
|
|
17
|
-
* constructor() {
|
|
18
|
-
* super();
|
|
19
|
-
*
|
|
20
|
-
* // ...
|
|
21
|
-
*
|
|
22
|
-
* submitHandler( {
|
|
23
|
-
* view: this
|
|
24
|
-
* } );
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
*
|
|
28
|
-
* // ...
|
|
29
|
-
*
|
|
30
|
-
* const view = new AnyFormView();
|
|
31
|
-
*
|
|
32
|
-
* // A sample listener attached by an emitter working with the view.
|
|
33
|
-
* this.listenTo( view, 'submit', () => {
|
|
34
|
-
* saveTheFormData();
|
|
35
|
-
* hideTheForm();
|
|
36
|
-
* } );
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @param options Configuration options.
|
|
40
|
-
* @param options.view The view which DOM `submit` events should be handled.
|
|
41
|
-
*/
|
|
42
|
-
export function submitHandler({ view }) {
|
|
43
|
-
view.listenTo(view.element, 'submit', (evt, domEvt) => {
|
|
44
|
-
domEvt.preventDefault();
|
|
45
|
-
view.fire('submit');
|
|
46
|
-
}, { useCapture: true });
|
|
47
|
-
}
|
package/src/button/button.js
DELETED
|
@@ -1,42 +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/button/buttonlabelview
|
|
7
|
-
*/
|
|
8
|
-
import { View } from '../view.js';
|
|
9
|
-
/**
|
|
10
|
-
* A default implementation of the button view's label. It comes with a dynamic text support
|
|
11
|
-
* via {@link module:ui/button/buttonlabelview~ButtonLabelView#text} property.
|
|
12
|
-
*/
|
|
13
|
-
export class ButtonLabelView extends View {
|
|
14
|
-
/**
|
|
15
|
-
* @inheritDoc
|
|
16
|
-
*/
|
|
17
|
-
constructor() {
|
|
18
|
-
super();
|
|
19
|
-
this.set({
|
|
20
|
-
style: undefined,
|
|
21
|
-
text: undefined,
|
|
22
|
-
id: undefined
|
|
23
|
-
});
|
|
24
|
-
const bind = this.bindTemplate;
|
|
25
|
-
this.setTemplate({
|
|
26
|
-
tag: 'span',
|
|
27
|
-
attributes: {
|
|
28
|
-
class: [
|
|
29
|
-
'ck',
|
|
30
|
-
'ck-button__label'
|
|
31
|
-
],
|
|
32
|
-
style: bind.to('style'),
|
|
33
|
-
id: bind.to('id')
|
|
34
|
-
},
|
|
35
|
-
children: [
|
|
36
|
-
{
|
|
37
|
-
text: bind.to('text')
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
}
|
package/src/button/buttonview.js
DELETED
|
@@ -1,278 +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/button/buttonview
|
|
7
|
-
*/
|
|
8
|
-
import { View } from '../view.js';
|
|
9
|
-
import { IconView } from '../icon/iconview.js';
|
|
10
|
-
import { ButtonLabelView } from './buttonlabelview.js';
|
|
11
|
-
import { env, getEnvKeystrokeText, uid, delay } from '@ckeditor/ckeditor5-utils';
|
|
12
|
-
import '../../theme/components/button/button.css';
|
|
13
|
-
/**
|
|
14
|
-
* The button view class.
|
|
15
|
-
*
|
|
16
|
-
* ```ts
|
|
17
|
-
* const view = new ButtonView();
|
|
18
|
-
*
|
|
19
|
-
* view.set( {
|
|
20
|
-
* label: 'A button',
|
|
21
|
-
* keystroke: 'Ctrl+B',
|
|
22
|
-
* tooltip: true,
|
|
23
|
-
* withText: true
|
|
24
|
-
* } );
|
|
25
|
-
*
|
|
26
|
-
* view.render();
|
|
27
|
-
*
|
|
28
|
-
* document.body.append( view.element );
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
export class ButtonView extends View {
|
|
32
|
-
/**
|
|
33
|
-
* Collection of the child views inside of the button {@link #element}.
|
|
34
|
-
*/
|
|
35
|
-
children;
|
|
36
|
-
/**
|
|
37
|
-
* Label of the button view. Its text is configurable using the {@link #label label attribute}.
|
|
38
|
-
*
|
|
39
|
-
* If not configured otherwise in the `constructor()`, by default the label is an instance
|
|
40
|
-
* of {@link module:ui/button/buttonlabelview~ButtonLabelView}.
|
|
41
|
-
*/
|
|
42
|
-
labelView;
|
|
43
|
-
/**
|
|
44
|
-
* The icon view of the button. Will be added to {@link #children} when the
|
|
45
|
-
* {@link #icon icon attribute} is defined.
|
|
46
|
-
*/
|
|
47
|
-
iconView;
|
|
48
|
-
/**
|
|
49
|
-
* A view displaying the keystroke of the button next to the {@link #labelView label}.
|
|
50
|
-
* Added to {@link #children} when the {@link #withKeystroke `withKeystroke` attribute}
|
|
51
|
-
* is defined.
|
|
52
|
-
*/
|
|
53
|
-
keystrokeView;
|
|
54
|
-
/**
|
|
55
|
-
* Delayed focus function for focus handling in Safari.
|
|
56
|
-
*/
|
|
57
|
-
_focusDelayed = null;
|
|
58
|
-
/**
|
|
59
|
-
* Creates an instance of the button view class.
|
|
60
|
-
*
|
|
61
|
-
* @param locale The {@link module:core/editor/editor~Editor#locale} instance.
|
|
62
|
-
* @param labelView The instance of the button's label. If not provided, an instance of
|
|
63
|
-
* {@link module:ui/button/buttonlabelview~ButtonLabelView} is used.
|
|
64
|
-
*/
|
|
65
|
-
constructor(locale, labelView = new ButtonLabelView()) {
|
|
66
|
-
super(locale);
|
|
67
|
-
const bind = this.bindTemplate;
|
|
68
|
-
const ariaLabelUid = uid();
|
|
69
|
-
// Implement the Button interface.
|
|
70
|
-
this.set('_ariaPressed', false);
|
|
71
|
-
this.set('_ariaChecked', false);
|
|
72
|
-
this.set('ariaLabel', undefined);
|
|
73
|
-
this.set('ariaLabelledBy', `ck-editor__aria-label_${ariaLabelUid}`);
|
|
74
|
-
this.set('class', undefined);
|
|
75
|
-
this.set('labelStyle', undefined);
|
|
76
|
-
this.set('icon', undefined);
|
|
77
|
-
this.set('isEnabled', true);
|
|
78
|
-
this.set('isOn', false);
|
|
79
|
-
this.set('isVisible', true);
|
|
80
|
-
this.set('isToggleable', false);
|
|
81
|
-
this.set('keystroke', undefined);
|
|
82
|
-
this.set('label', undefined);
|
|
83
|
-
this.set('role', undefined);
|
|
84
|
-
this.set('tabindex', -1);
|
|
85
|
-
this.set('tooltip', false);
|
|
86
|
-
this.set('tooltipPosition', 's');
|
|
87
|
-
this.set('type', 'button');
|
|
88
|
-
this.set('withText', false);
|
|
89
|
-
this.set('withKeystroke', false);
|
|
90
|
-
this.children = this.createCollection();
|
|
91
|
-
this.labelView = this._setupLabelView(labelView);
|
|
92
|
-
this.iconView = new IconView();
|
|
93
|
-
this.iconView.extendTemplate({
|
|
94
|
-
attributes: {
|
|
95
|
-
class: 'ck-button__icon'
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
this.iconView.bind('content').to(this, 'icon');
|
|
99
|
-
this.keystrokeView = this._createKeystrokeView();
|
|
100
|
-
this.bind('_tooltipString').to(this, 'tooltip', this, 'label', this, 'keystroke', this._getTooltipString.bind(this));
|
|
101
|
-
const template = {
|
|
102
|
-
tag: 'button',
|
|
103
|
-
attributes: {
|
|
104
|
-
class: [
|
|
105
|
-
'ck',
|
|
106
|
-
'ck-button',
|
|
107
|
-
bind.to('class'),
|
|
108
|
-
bind.if('isEnabled', 'ck-disabled', value => !value),
|
|
109
|
-
bind.if('isVisible', 'ck-hidden', value => !value),
|
|
110
|
-
bind.to('isOn', value => value ? 'ck-on' : 'ck-off'),
|
|
111
|
-
bind.if('withText', 'ck-button_with-text'),
|
|
112
|
-
bind.if('withKeystroke', 'ck-button_with-keystroke')
|
|
113
|
-
],
|
|
114
|
-
role: bind.to('role'),
|
|
115
|
-
type: bind.to('type', value => value ? value : 'button'),
|
|
116
|
-
tabindex: bind.to('tabindex'),
|
|
117
|
-
'aria-checked': bind.to('_ariaChecked'),
|
|
118
|
-
'aria-pressed': bind.to('_ariaPressed'),
|
|
119
|
-
'aria-label': bind.to('ariaLabel'),
|
|
120
|
-
'aria-labelledby': bind.to('ariaLabelledBy'),
|
|
121
|
-
'aria-disabled': bind.if('isEnabled', true, value => !value),
|
|
122
|
-
'data-cke-tooltip-text': bind.to('_tooltipString'),
|
|
123
|
-
'data-cke-tooltip-position': bind.to('tooltipPosition')
|
|
124
|
-
},
|
|
125
|
-
children: this.children,
|
|
126
|
-
on: {
|
|
127
|
-
click: bind.to(evt => {
|
|
128
|
-
// We can't make the button disabled using the disabled attribute, because it won't be focusable.
|
|
129
|
-
// Though, shouldn't this condition be moved to the button controller?
|
|
130
|
-
if (this.isEnabled) {
|
|
131
|
-
this.fire('execute');
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
// Prevent the default when button is disabled, to block e.g.
|
|
135
|
-
// automatic form submitting. See ckeditor/ckeditor5-link#74.
|
|
136
|
-
evt.preventDefault();
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
this.bind('_ariaPressed').to(this, 'isOn', this, 'isToggleable', this, 'role', (isOn, isToggleable, role) => {
|
|
142
|
-
if (!isToggleable || isCheckableRole(role)) {
|
|
143
|
-
return false;
|
|
144
|
-
}
|
|
145
|
-
return String(!!isOn);
|
|
146
|
-
});
|
|
147
|
-
this.bind('_ariaChecked').to(this, 'isOn', this, 'isToggleable', this, 'role', (isOn, isToggleable, role) => {
|
|
148
|
-
if (!isToggleable || !isCheckableRole(role)) {
|
|
149
|
-
return false;
|
|
150
|
-
}
|
|
151
|
-
return String(!!isOn);
|
|
152
|
-
});
|
|
153
|
-
// On Safari we have to force the focus on a button on click as it's the only browser
|
|
154
|
-
// that doesn't do that automatically. See #12115.
|
|
155
|
-
if (env.isSafari) {
|
|
156
|
-
if (!this._focusDelayed) {
|
|
157
|
-
this._focusDelayed = delay(() => this.focus(), 0);
|
|
158
|
-
}
|
|
159
|
-
template.on.mousedown = bind.to(() => {
|
|
160
|
-
this._focusDelayed();
|
|
161
|
-
});
|
|
162
|
-
template.on.mouseup = bind.to(() => {
|
|
163
|
-
this._focusDelayed.cancel();
|
|
164
|
-
});
|
|
165
|
-
}
|
|
166
|
-
this.setTemplate(template);
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* @inheritDoc
|
|
170
|
-
*/
|
|
171
|
-
render() {
|
|
172
|
-
super.render();
|
|
173
|
-
if (this.icon) {
|
|
174
|
-
this.children.add(this.iconView);
|
|
175
|
-
}
|
|
176
|
-
this.on('change:icon', (evt, prop, newIcon, oldIcon) => {
|
|
177
|
-
if (newIcon && !oldIcon) {
|
|
178
|
-
this.children.add(this.iconView, 0);
|
|
179
|
-
}
|
|
180
|
-
else if (!newIcon && oldIcon) {
|
|
181
|
-
this.children.remove(this.iconView);
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
this.children.add(this.labelView);
|
|
185
|
-
if (this.withKeystroke && this.keystroke) {
|
|
186
|
-
this.children.add(this.keystrokeView);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Focuses the {@link #element} of the button.
|
|
191
|
-
*/
|
|
192
|
-
focus() {
|
|
193
|
-
this.element.focus();
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* @inheritDoc
|
|
197
|
-
*/
|
|
198
|
-
destroy() {
|
|
199
|
-
if (this._focusDelayed) {
|
|
200
|
-
this._focusDelayed.cancel();
|
|
201
|
-
}
|
|
202
|
-
super.destroy();
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Binds the label view instance it with button attributes.
|
|
206
|
-
*/
|
|
207
|
-
_setupLabelView(labelView) {
|
|
208
|
-
labelView.bind('text', 'style', 'id').to(this, 'label', 'labelStyle', 'ariaLabelledBy');
|
|
209
|
-
return labelView;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Creates a view that displays a keystroke next to a {@link #labelView label }
|
|
213
|
-
* and binds it with button attributes.
|
|
214
|
-
*/
|
|
215
|
-
_createKeystrokeView() {
|
|
216
|
-
const keystrokeView = new View();
|
|
217
|
-
keystrokeView.setTemplate({
|
|
218
|
-
tag: 'span',
|
|
219
|
-
attributes: {
|
|
220
|
-
class: [
|
|
221
|
-
'ck',
|
|
222
|
-
'ck-button__keystroke'
|
|
223
|
-
]
|
|
224
|
-
},
|
|
225
|
-
children: [
|
|
226
|
-
{
|
|
227
|
-
text: this.bindTemplate.to('keystroke', text => getEnvKeystrokeText(text))
|
|
228
|
-
}
|
|
229
|
-
]
|
|
230
|
-
});
|
|
231
|
-
return keystrokeView;
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Gets the text for the tooltip from the combination of
|
|
235
|
-
* {@link #tooltip}, {@link #label} and {@link #keystroke} attributes.
|
|
236
|
-
*
|
|
237
|
-
* @see #tooltip
|
|
238
|
-
* @see #_tooltipString
|
|
239
|
-
* @param tooltip Button tooltip.
|
|
240
|
-
* @param label Button label.
|
|
241
|
-
* @param keystroke Button keystroke.
|
|
242
|
-
*/
|
|
243
|
-
_getTooltipString(tooltip, label, keystroke) {
|
|
244
|
-
if (tooltip) {
|
|
245
|
-
if (typeof tooltip == 'string') {
|
|
246
|
-
return tooltip;
|
|
247
|
-
}
|
|
248
|
-
else {
|
|
249
|
-
if (keystroke) {
|
|
250
|
-
keystroke = getEnvKeystrokeText(keystroke);
|
|
251
|
-
}
|
|
252
|
-
if (tooltip instanceof Function) {
|
|
253
|
-
return tooltip(label, keystroke);
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
return `${label}${keystroke ? ` (${keystroke})` : ''}`;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return '';
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Checks if `aria-checkbox` can be used with specified role.
|
|
265
|
-
*/
|
|
266
|
-
function isCheckableRole(role) {
|
|
267
|
-
switch (role) {
|
|
268
|
-
case 'radio':
|
|
269
|
-
case 'checkbox':
|
|
270
|
-
case 'option':
|
|
271
|
-
case 'switch':
|
|
272
|
-
case 'menuitemcheckbox':
|
|
273
|
-
case 'menuitemradio':
|
|
274
|
-
return true;
|
|
275
|
-
default:
|
|
276
|
-
return false;
|
|
277
|
-
}
|
|
278
|
-
}
|