@ckeditor/ckeditor5-ui 47.6.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,99 +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 { parseBase64EncodedObject } from '@ckeditor/ckeditor5-utils';
|
|
6
|
-
import { View } from '../view.js';
|
|
7
|
-
import { Badge } from '../badge/badge.js';
|
|
8
|
-
/**
|
|
9
|
-
* A helper that enables the "evaluation badge" feature in the editor at the bottom of the editable element
|
|
10
|
-
* (editor root, source editing area, etc.) when the editor is focused.
|
|
11
|
-
*
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
export class EvaluationBadge extends Badge {
|
|
15
|
-
licenseTypeMessage = {
|
|
16
|
-
evaluation: 'For evaluation purposes only',
|
|
17
|
-
trial: 'For evaluation purposes only',
|
|
18
|
-
development: 'For development purposes only'
|
|
19
|
-
};
|
|
20
|
-
constructor(editor) {
|
|
21
|
-
super(editor, { balloonClass: 'ck-evaluation-badge-balloon' });
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Enables "evaluation badge" label.
|
|
25
|
-
*/
|
|
26
|
-
_isEnabled() {
|
|
27
|
-
const editor = this.editor;
|
|
28
|
-
const licenseKey = editor.config.get('licenseKey');
|
|
29
|
-
const licenseType = getLicenseTypeFromLicenseKey(licenseKey);
|
|
30
|
-
return Boolean(licenseType && this.licenseTypeMessage[licenseType]);
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Creates the content of the "evaluation badge".
|
|
34
|
-
*/
|
|
35
|
-
_createBadgeContent() {
|
|
36
|
-
const licenseKey = this.editor.config.get('licenseKey');
|
|
37
|
-
const licenseType = getLicenseTypeFromLicenseKey(licenseKey);
|
|
38
|
-
return new EvaluationBadgeView(this.editor.locale, this.licenseTypeMessage[licenseType]);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Returns the normalized configuration for the "evaluation badge".
|
|
42
|
-
* It takes 'ui.poweredBy' configuration into account to determine the badge position and side.
|
|
43
|
-
*/
|
|
44
|
-
_getNormalizedConfig() {
|
|
45
|
-
const badgeConfig = super._getNormalizedConfig();
|
|
46
|
-
const userConfig = this.editor.config.get('ui.poweredBy') || {};
|
|
47
|
-
const position = userConfig.position || badgeConfig.position;
|
|
48
|
-
const poweredBySide = userConfig.side || badgeConfig.side;
|
|
49
|
-
return {
|
|
50
|
-
position,
|
|
51
|
-
side: poweredBySide === 'left' ? 'right' : 'left',
|
|
52
|
-
verticalOffset: badgeConfig.verticalOffset,
|
|
53
|
-
horizontalOffset: badgeConfig.horizontalOffset
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* A view displaying the "evaluation badge".
|
|
59
|
-
*/
|
|
60
|
-
class EvaluationBadgeView extends View {
|
|
61
|
-
/**
|
|
62
|
-
* Creates an instance of the "evaluation badge" view.
|
|
63
|
-
*
|
|
64
|
-
* @param locale The localization services instance.
|
|
65
|
-
* @param label The label text.
|
|
66
|
-
*/
|
|
67
|
-
constructor(locale, label) {
|
|
68
|
-
super(locale);
|
|
69
|
-
this.setTemplate({
|
|
70
|
-
tag: 'div',
|
|
71
|
-
attributes: {
|
|
72
|
-
class: ['ck', 'ck-evaluation-badge'],
|
|
73
|
-
'aria-hidden': true
|
|
74
|
-
},
|
|
75
|
-
children: [
|
|
76
|
-
{
|
|
77
|
-
tag: 'span',
|
|
78
|
-
attributes: {
|
|
79
|
-
class: ['ck', 'ck-evaluation-badge__label']
|
|
80
|
-
},
|
|
81
|
-
children: [label]
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Returns the license type based on the license key.
|
|
89
|
-
*/
|
|
90
|
-
function getLicenseTypeFromLicenseKey(licenseKey) {
|
|
91
|
-
if (licenseKey == 'GPL') {
|
|
92
|
-
return 'GPL';
|
|
93
|
-
}
|
|
94
|
-
const licenseContent = parseBase64EncodedObject(licenseKey.split('.')[1]);
|
|
95
|
-
if (!licenseContent) {
|
|
96
|
-
return null;
|
|
97
|
-
}
|
|
98
|
-
return licenseContent.licenseType || 'production';
|
|
99
|
-
}
|
|
@@ -1,120 +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/editorui/poweredby
|
|
7
|
-
*/
|
|
8
|
-
import { IconProjectLogo } from '@ckeditor/ckeditor5-icons';
|
|
9
|
-
import { parseBase64EncodedObject } from '@ckeditor/ckeditor5-utils';
|
|
10
|
-
import { View } from '../view.js';
|
|
11
|
-
import { Badge } from '../badge/badge.js';
|
|
12
|
-
import { IconView } from '../icon/iconview.js';
|
|
13
|
-
const DEFAULT_LABEL = 'Powered by';
|
|
14
|
-
/**
|
|
15
|
-
* A helper that enables the "powered by" feature in the editor and renders a link to the project's
|
|
16
|
-
* webpage next to the bottom of the editable element (editor root, source editing area, etc.) when the editor is focused.
|
|
17
|
-
*
|
|
18
|
-
* @private
|
|
19
|
-
*/
|
|
20
|
-
export class PoweredBy extends Badge {
|
|
21
|
-
constructor(editor) {
|
|
22
|
-
super(editor, { balloonClass: 'ck-powered-by-balloon' });
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Enables "powered by" label.
|
|
26
|
-
*/
|
|
27
|
-
_isEnabled() {
|
|
28
|
-
const editor = this.editor;
|
|
29
|
-
const forceVisible = editor.config.get('ui.poweredBy.forceVisible');
|
|
30
|
-
if (forceVisible) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
const licenseKey = editor.config.get('licenseKey');
|
|
34
|
-
if (licenseKey == 'GPL') {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
const licenseContent = parseBase64EncodedObject(licenseKey.split('.')[1]);
|
|
38
|
-
if (!licenseContent) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
return !licenseContent.whiteLabel;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Creates a "powered by" badge content.
|
|
45
|
-
*/
|
|
46
|
-
_createBadgeContent() {
|
|
47
|
-
return new PoweredByView(this.editor.locale, this._getNormalizedConfig().label);
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Returns the normalized configuration for the "powered by" badge.
|
|
51
|
-
* It takes the user configuration into account and falls back to the default one.
|
|
52
|
-
*/
|
|
53
|
-
_getNormalizedConfig() {
|
|
54
|
-
const badgeConfig = super._getNormalizedConfig();
|
|
55
|
-
const userConfig = this.editor.config.get('ui.poweredBy') || {};
|
|
56
|
-
const position = userConfig.position || badgeConfig.position;
|
|
57
|
-
const verticalOffset = position === 'inside' ? 5 : badgeConfig.verticalOffset;
|
|
58
|
-
return {
|
|
59
|
-
position,
|
|
60
|
-
side: userConfig.side || badgeConfig.side,
|
|
61
|
-
label: userConfig.label === undefined ? DEFAULT_LABEL : userConfig.label,
|
|
62
|
-
verticalOffset: userConfig.verticalOffset !== undefined ? userConfig.verticalOffset : verticalOffset,
|
|
63
|
-
horizontalOffset: userConfig.horizontalOffset !== undefined ? userConfig.horizontalOffset : badgeConfig.horizontalOffset,
|
|
64
|
-
forceVisible: !!userConfig.forceVisible
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* A view displaying a "powered by" label and project logo wrapped in a link.
|
|
70
|
-
*/
|
|
71
|
-
class PoweredByView extends View {
|
|
72
|
-
/**
|
|
73
|
-
* Creates an instance of the "powered by" view.
|
|
74
|
-
*
|
|
75
|
-
* @param locale The localization services instance.
|
|
76
|
-
* @param label The label text.
|
|
77
|
-
*/
|
|
78
|
-
constructor(locale, label) {
|
|
79
|
-
super(locale);
|
|
80
|
-
const iconView = new IconView();
|
|
81
|
-
const bind = this.bindTemplate;
|
|
82
|
-
iconView.set({
|
|
83
|
-
content: IconProjectLogo,
|
|
84
|
-
isColorInherited: false
|
|
85
|
-
});
|
|
86
|
-
this.setTemplate({
|
|
87
|
-
tag: 'div',
|
|
88
|
-
attributes: {
|
|
89
|
-
class: ['ck', 'ck-powered-by'],
|
|
90
|
-
'aria-hidden': true
|
|
91
|
-
},
|
|
92
|
-
children: [
|
|
93
|
-
{
|
|
94
|
-
tag: 'a',
|
|
95
|
-
attributes: {
|
|
96
|
-
href: 'https://ckeditor.com/powered-by-ckeditor/?utm_source=ckeditor&' +
|
|
97
|
-
'utm_medium=referral&utm_campaign=701Dn000000hVgmIAE_powered_by_ckeditor_logo',
|
|
98
|
-
target: '_blank',
|
|
99
|
-
tabindex: '-1'
|
|
100
|
-
},
|
|
101
|
-
children: [
|
|
102
|
-
...label ? [
|
|
103
|
-
{
|
|
104
|
-
tag: 'span',
|
|
105
|
-
attributes: {
|
|
106
|
-
class: ['ck', 'ck-powered-by__label']
|
|
107
|
-
},
|
|
108
|
-
children: [label]
|
|
109
|
-
}
|
|
110
|
-
] : [],
|
|
111
|
-
iconView
|
|
112
|
-
],
|
|
113
|
-
on: {
|
|
114
|
-
dragstart: bind.to(evt => evt.preventDefault())
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
]
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
package/src/focuscycler.js
DELETED
|
@@ -1,383 +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/focuscycler
|
|
7
|
-
*/
|
|
8
|
-
import { isVisible, EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
/**
|
|
10
|
-
* A utility class that helps cycling over {@link module:ui/focuscycler~FocusableView focusable views} in a
|
|
11
|
-
* {@link module:ui/viewcollection~ViewCollection} when the focus is tracked by the
|
|
12
|
-
* {@link module:utils/focustracker~FocusTracker} instance. It helps implementing keyboard
|
|
13
|
-
* navigation in HTML forms, toolbars, lists and the like.
|
|
14
|
-
*
|
|
15
|
-
* To work properly it requires:
|
|
16
|
-
* * a collection of focusable (HTML `tabindex` attribute) views that implement the `focus()` method,
|
|
17
|
-
* * an associated focus tracker to determine which view is focused.
|
|
18
|
-
*
|
|
19
|
-
* A simple cycler setup can look like this:
|
|
20
|
-
*
|
|
21
|
-
* ```ts
|
|
22
|
-
* const focusables = new ViewCollection<FocusableView>();
|
|
23
|
-
* const focusTracker = new FocusTracker();
|
|
24
|
-
*
|
|
25
|
-
* // Add focusable views to the focus tracker.
|
|
26
|
-
* focusTracker.add( ... );
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* Then, the cycler can be used manually:
|
|
30
|
-
*
|
|
31
|
-
* ```ts
|
|
32
|
-
* const cycler = new FocusCycler( { focusables, focusTracker } );
|
|
33
|
-
*
|
|
34
|
-
* // Will focus the first focusable view in #focusables.
|
|
35
|
-
* cycler.focusFirst();
|
|
36
|
-
*
|
|
37
|
-
* // Will log the next focusable item in #focusables.
|
|
38
|
-
* console.log( cycler.next );
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
41
|
-
* Alternatively, it can work side by side with the {@link module:utils/keystrokehandler~KeystrokeHandler}:
|
|
42
|
-
*
|
|
43
|
-
* ```ts
|
|
44
|
-
* const keystrokeHandler = new KeystrokeHandler();
|
|
45
|
-
*
|
|
46
|
-
* // Activate the keystroke handler.
|
|
47
|
-
* keystrokeHandler.listenTo( sourceOfEvents );
|
|
48
|
-
*
|
|
49
|
-
* const cycler = new FocusCycler( {
|
|
50
|
-
* focusables, focusTracker, keystrokeHandler,
|
|
51
|
-
* actions: {
|
|
52
|
-
* // When arrowup of arrowleft is detected by the #keystrokeHandler,
|
|
53
|
-
* // focusPrevious() will be called on the cycler.
|
|
54
|
-
* focusPrevious: [ 'arrowup', 'arrowleft' ],
|
|
55
|
-
* }
|
|
56
|
-
* } );
|
|
57
|
-
* ```
|
|
58
|
-
*
|
|
59
|
-
* Check out the {@glink framework/deep-dive/ui/focus-tracking "Deep dive into focus tracking"} guide to learn more.
|
|
60
|
-
*/
|
|
61
|
-
export class FocusCycler extends /* #__PURE__ */ EmitterMixin() {
|
|
62
|
-
/**
|
|
63
|
-
* A {@link module:ui/focuscycler~FocusableView focusable views} collection that the cycler operates on.
|
|
64
|
-
*/
|
|
65
|
-
focusables;
|
|
66
|
-
/**
|
|
67
|
-
* A focus tracker instance that the cycler uses to determine the current focus
|
|
68
|
-
* state in {@link #focusables}.
|
|
69
|
-
*/
|
|
70
|
-
focusTracker;
|
|
71
|
-
/**
|
|
72
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}
|
|
73
|
-
* which can respond to certain keystrokes and cycle the focus.
|
|
74
|
-
*/
|
|
75
|
-
keystrokeHandler;
|
|
76
|
-
/**
|
|
77
|
-
* Actions that the cycler can take when a keystroke is pressed. Requires
|
|
78
|
-
* `options.keystrokeHandler` to be passed and working. When an action is
|
|
79
|
-
* performed, `preventDefault` and `stopPropagation` will be called on the event
|
|
80
|
-
* the keystroke fired in the DOM.
|
|
81
|
-
*
|
|
82
|
-
* ```ts
|
|
83
|
-
* actions: {
|
|
84
|
-
* // Will call #focusPrevious() when arrowleft or arrowup is pressed.
|
|
85
|
-
* focusPrevious: [ 'arrowleft', 'arrowup' ],
|
|
86
|
-
*
|
|
87
|
-
* // Will call #focusNext() when arrowdown is pressed.
|
|
88
|
-
* focusNext: 'arrowdown'
|
|
89
|
-
* }
|
|
90
|
-
* ```
|
|
91
|
-
*/
|
|
92
|
-
actions;
|
|
93
|
-
/**
|
|
94
|
-
* Creates an instance of the focus cycler utility.
|
|
95
|
-
*
|
|
96
|
-
* @param options Configuration options.
|
|
97
|
-
*/
|
|
98
|
-
constructor(options) {
|
|
99
|
-
super();
|
|
100
|
-
this.focusables = options.focusables;
|
|
101
|
-
this.focusTracker = options.focusTracker;
|
|
102
|
-
this.keystrokeHandler = options.keystrokeHandler;
|
|
103
|
-
this.actions = options.actions;
|
|
104
|
-
if (options.actions && options.keystrokeHandler) {
|
|
105
|
-
for (const methodName in options.actions) {
|
|
106
|
-
let actions = options.actions[methodName];
|
|
107
|
-
if (typeof actions == 'string') {
|
|
108
|
-
actions = [actions];
|
|
109
|
-
}
|
|
110
|
-
for (const keystroke of actions) {
|
|
111
|
-
options.keystrokeHandler.set(keystroke, (data, cancel) => {
|
|
112
|
-
this[methodName]();
|
|
113
|
-
cancel();
|
|
114
|
-
}, options.keystrokeHandlerOptions);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
this.on('forwardCycle', () => this.focusFirst(), { priority: 'low' });
|
|
119
|
-
this.on('backwardCycle', () => this.focusLast(), { priority: 'low' });
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Returns the first focusable view in {@link #focusables}.
|
|
123
|
-
* Returns `null` if there is none.
|
|
124
|
-
*
|
|
125
|
-
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
126
|
-
*/
|
|
127
|
-
get first() {
|
|
128
|
-
return (this.focusables.find(isDomFocusable) || null);
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Returns the last focusable view in {@link #focusables}.
|
|
132
|
-
* Returns `null` if there is none.
|
|
133
|
-
*
|
|
134
|
-
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
135
|
-
*/
|
|
136
|
-
get last() {
|
|
137
|
-
return (this.focusables.filter(isDomFocusable).slice(-1)[0] || null);
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Returns the next focusable view in {@link #focusables} based on {@link #current}.
|
|
141
|
-
* Returns `null` if there is none.
|
|
142
|
-
*
|
|
143
|
-
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
144
|
-
*/
|
|
145
|
-
get next() {
|
|
146
|
-
return this._getDomFocusableItem(1);
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Returns the previous focusable view in {@link #focusables} based on {@link #current}.
|
|
150
|
-
* Returns `null` if there is none.
|
|
151
|
-
*
|
|
152
|
-
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
153
|
-
*/
|
|
154
|
-
get previous() {
|
|
155
|
-
return this._getDomFocusableItem(-1);
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* An index of the view in the {@link #focusables} which is focused according
|
|
159
|
-
* to {@link #focusTracker}. Returns `null` when there is no such view.
|
|
160
|
-
*/
|
|
161
|
-
get current() {
|
|
162
|
-
let index = null;
|
|
163
|
-
// There's no focused view in the focusables.
|
|
164
|
-
if (this.focusTracker.focusedElement === null) {
|
|
165
|
-
return null;
|
|
166
|
-
}
|
|
167
|
-
this.focusables.find((view, viewIndex) => {
|
|
168
|
-
const focused = view.element === this.focusTracker.focusedElement;
|
|
169
|
-
if (focused) {
|
|
170
|
-
index = viewIndex;
|
|
171
|
-
}
|
|
172
|
-
return focused;
|
|
173
|
-
});
|
|
174
|
-
return index;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Focuses the {@link #first} item in {@link #focusables}.
|
|
178
|
-
*
|
|
179
|
-
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
180
|
-
*/
|
|
181
|
-
focusFirst() {
|
|
182
|
-
this._focus(this.first, 1);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Focuses the {@link #last} item in {@link #focusables}.
|
|
186
|
-
*
|
|
187
|
-
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
188
|
-
*/
|
|
189
|
-
focusLast() {
|
|
190
|
-
this._focus(this.last, -1);
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Focuses the {@link #next} item in {@link #focusables}.
|
|
194
|
-
*
|
|
195
|
-
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
196
|
-
*/
|
|
197
|
-
focusNext() {
|
|
198
|
-
const next = this.next;
|
|
199
|
-
// If there's only one focusable item, we need to let the outside world know
|
|
200
|
-
// that the next cycle is about to happen. This may be useful
|
|
201
|
-
// e.g. if you want to move the focus to the parent focus cycler.
|
|
202
|
-
// Note that the focus is not actually moved in this case.
|
|
203
|
-
if (next && this.focusables.getIndex(next) === this.current) {
|
|
204
|
-
this.fire('forwardCycle');
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
207
|
-
if (next === this.first) {
|
|
208
|
-
this.fire('forwardCycle');
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
this._focus(next, 1);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* Focuses the {@link #previous} item in {@link #focusables}.
|
|
216
|
-
*
|
|
217
|
-
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
218
|
-
*/
|
|
219
|
-
focusPrevious() {
|
|
220
|
-
const previous = this.previous;
|
|
221
|
-
if (previous && this.focusables.getIndex(previous) === this.current) {
|
|
222
|
-
this.fire('backwardCycle');
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
if (previous === this.last) {
|
|
226
|
-
this.fire('backwardCycle');
|
|
227
|
-
}
|
|
228
|
-
else {
|
|
229
|
-
this._focus(previous, -1);
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Allows for creating continuous focus cycling across multiple focus cyclers and their collections of {@link #focusables}.
|
|
234
|
-
*
|
|
235
|
-
* It starts listening to the {@link module:ui/focuscycler~FocusCyclerForwardCycleEvent} and
|
|
236
|
-
* {@link module:ui/focuscycler~FocusCyclerBackwardCycleEvent} events of the chained focus cycler and engages,
|
|
237
|
-
* whenever the user reaches the last (forwards navigation) or first (backwards navigation) focusable view
|
|
238
|
-
* and would normally start over. Instead, the navigation continues on the higher level (flattens).
|
|
239
|
-
*
|
|
240
|
-
* For instance, for the following nested focus navigation structure, the focus would get stuck the moment
|
|
241
|
-
* the AB gets focused and its focus cycler starts managing it:
|
|
242
|
-
*
|
|
243
|
-
* ┌────────────┐ ┌──────────────────────────────────┐ ┌────────────┐
|
|
244
|
-
* │ AA │ │ AB │ │ AC │
|
|
245
|
-
* │ │ │ │ │ │
|
|
246
|
-
* │ │ │ ┌─────┐ ┌─────┐ ┌─────┐ │ │ │
|
|
247
|
-
* │ │ │ ┌──► ABA ├──► ABB ├──► ABC ├───┐ │ │ │
|
|
248
|
-
* │ ├───► │ └─────┘ └─────┘ └─────┘ │ │ │ │
|
|
249
|
-
* │ │ │ │ │ │ │ │
|
|
250
|
-
* │ │ │ │ │ │ │ │
|
|
251
|
-
* │ │ │ └──────────────────────────────┘ │ │ │
|
|
252
|
-
* │ │ │ │ │ │
|
|
253
|
-
* └────────────┘ └──────────────────────────────────┘ └────────────┘
|
|
254
|
-
*
|
|
255
|
-
* Chaining a focus tracker that manages AA, AB, and AC with the focus tracker that manages ABA, ABB, and ABC
|
|
256
|
-
* creates a seamless navigation experience instead:
|
|
257
|
-
*
|
|
258
|
-
* ┌────────────┐ ┌──────────────────────────────────┐ ┌────────────┐
|
|
259
|
-
* │ AA │ │ AB │ │ AC │
|
|
260
|
-
* │ │ │ │ │ │
|
|
261
|
-
* │ │ │ ┌─────┐ ┌─────┐ ┌─────┐ │ │ │
|
|
262
|
-
* │ │ │ ┌──► ABA ├──► ABB ├──► ABC ├──┐ │ │ │
|
|
263
|
-
* ┌──► ├───┼─┘ └─────┘ └─────┘ └─────┘ └──┼───► ├──┐
|
|
264
|
-
* │ │ │ │ │ │ │ │
|
|
265
|
-
* │ │ │ │ │ │ │ │
|
|
266
|
-
* │ │ │ │ │ │ │ │
|
|
267
|
-
* │ │ │ │ │ │ │ │
|
|
268
|
-
* │ └────────────┘ └──────────────────────────────────┘ └────────────┘ │
|
|
269
|
-
* │ │
|
|
270
|
-
* │ │
|
|
271
|
-
* └──────────────────────────────────────────────────────────────────────────┘
|
|
272
|
-
*
|
|
273
|
-
* See {@link #unchain} to reverse the chaining.
|
|
274
|
-
*/
|
|
275
|
-
chain(chainedFocusCycler) {
|
|
276
|
-
const getCurrentFocusedView = () => {
|
|
277
|
-
// This may happen when one focus cycler does not include focusables of the other (horizontal case).
|
|
278
|
-
if (this.current === null) {
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
return this.focusables.get(this.current);
|
|
282
|
-
};
|
|
283
|
-
this.listenTo(chainedFocusCycler, 'forwardCycle', evt => {
|
|
284
|
-
const oldCurrent = getCurrentFocusedView();
|
|
285
|
-
this.focusNext();
|
|
286
|
-
// Stop the event propagation only if an attempt at focusing the view actually moved the focus.
|
|
287
|
-
// If not, let the otherFocusCycler handle the event.
|
|
288
|
-
if (oldCurrent !== getCurrentFocusedView()) {
|
|
289
|
-
evt.stop();
|
|
290
|
-
}
|
|
291
|
-
// The priority is critical for cycling across multiple chain levels when there's a single view at some of them only.
|
|
292
|
-
}, { priority: 'low' });
|
|
293
|
-
this.listenTo(chainedFocusCycler, 'backwardCycle', evt => {
|
|
294
|
-
const oldCurrent = getCurrentFocusedView();
|
|
295
|
-
this.focusPrevious();
|
|
296
|
-
// Stop the event propagation only if an attempt at focusing the view actually moved the focus.
|
|
297
|
-
// If not, let the otherFocusCycler handle the event.
|
|
298
|
-
if (oldCurrent !== getCurrentFocusedView()) {
|
|
299
|
-
evt.stop();
|
|
300
|
-
}
|
|
301
|
-
// The priority is critical for cycling across multiple chain levels when there's a single view at some of them only.
|
|
302
|
-
}, { priority: 'low' });
|
|
303
|
-
}
|
|
304
|
-
/**
|
|
305
|
-
* Reverses a chaining made by {@link #chain}.
|
|
306
|
-
*/
|
|
307
|
-
unchain(otherFocusCycler) {
|
|
308
|
-
this.stopListening(otherFocusCycler);
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Focuses the given view if it exists.
|
|
312
|
-
*
|
|
313
|
-
* @param view The view to be focused
|
|
314
|
-
* @param direction The direction of the focus if the view has focusable children.
|
|
315
|
-
* @returns
|
|
316
|
-
*/
|
|
317
|
-
_focus(view, direction) {
|
|
318
|
-
// Don't fire focus events if the view is already focused.
|
|
319
|
-
// Such attempt may occur when cycling with only one focusable item:
|
|
320
|
-
// even though `focusNext()` method returns without changing focus,
|
|
321
|
-
// the `forwardCycle` event is fired, triggering the `focusFirst()` method.
|
|
322
|
-
if (view && this.focusTracker.focusedElement !== view.element) {
|
|
323
|
-
view.focus(direction);
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
/**
|
|
327
|
-
* Returns the next or previous focusable view in {@link #focusables} with respect
|
|
328
|
-
* to {@link #current}.
|
|
329
|
-
*
|
|
330
|
-
* @param step Either `1` for checking forward from {@link #current} or `-1` for checking backwards.
|
|
331
|
-
*/
|
|
332
|
-
_getDomFocusableItem(step) {
|
|
333
|
-
// Cache for speed.
|
|
334
|
-
const collectionLength = this.focusables.length;
|
|
335
|
-
if (!collectionLength) {
|
|
336
|
-
return null;
|
|
337
|
-
}
|
|
338
|
-
const current = this.current;
|
|
339
|
-
// Start from the beginning if no view is focused.
|
|
340
|
-
// https://github.com/ckeditor/ckeditor5-ui/issues/206
|
|
341
|
-
if (current === null) {
|
|
342
|
-
return this[step === 1 ? 'first' : 'last'];
|
|
343
|
-
}
|
|
344
|
-
// Note: If current is the only focusable view, it will also be returned for the given step.
|
|
345
|
-
let focusableItem = this.focusables.get(current);
|
|
346
|
-
// Cycle in both directions.
|
|
347
|
-
let index = (current + collectionLength + step) % collectionLength;
|
|
348
|
-
do {
|
|
349
|
-
const focusableItemCandidate = this.focusables.get(index);
|
|
350
|
-
if (isDomFocusable(focusableItemCandidate)) {
|
|
351
|
-
focusableItem = focusableItemCandidate;
|
|
352
|
-
break;
|
|
353
|
-
}
|
|
354
|
-
// Cycle in both directions.
|
|
355
|
-
index = (index + collectionLength + step) % collectionLength;
|
|
356
|
-
} while (index !== current);
|
|
357
|
-
return focusableItem;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* Checks whether a view can be focused (has `focus()` method and is visible).
|
|
362
|
-
*
|
|
363
|
-
* @param view A view to be checked.
|
|
364
|
-
*/
|
|
365
|
-
function isDomFocusable(view) {
|
|
366
|
-
return isFocusable(view) && isVisible(view.element);
|
|
367
|
-
}
|
|
368
|
-
/**
|
|
369
|
-
* Checks whether a view is {@link ~FocusableView}.
|
|
370
|
-
*
|
|
371
|
-
* @param view A view to be checked.
|
|
372
|
-
*/
|
|
373
|
-
export function isFocusable(view) {
|
|
374
|
-
return !!('focus' in view && typeof view.focus == 'function');
|
|
375
|
-
}
|
|
376
|
-
/**
|
|
377
|
-
* Checks whether a view is an instance of {@link ~ViewWithFocusCycler}.
|
|
378
|
-
*
|
|
379
|
-
* @param view A view to be checked.
|
|
380
|
-
*/
|
|
381
|
-
export function isViewWithFocusCycler(view) {
|
|
382
|
-
return isFocusable(view) && 'focusCycler' in view && view.focusCycler instanceof FocusCycler;
|
|
383
|
-
}
|
|
@@ -1,77 +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/formheader/formheaderview
|
|
7
|
-
*/
|
|
8
|
-
import { View } from '../view.js';
|
|
9
|
-
import { IconView } from '../icon/iconview.js';
|
|
10
|
-
import '../../theme/components/formheader/formheader.css';
|
|
11
|
-
/**
|
|
12
|
-
* The class component representing a form header view. It should be used in more advanced forms to
|
|
13
|
-
* describe the main purpose of the form.
|
|
14
|
-
*
|
|
15
|
-
* By default the component contains a bolded label view that has to be set. The label is usually a short (at most 3-word) string.
|
|
16
|
-
* The component can also be extended by any other elements, like: icons, dropdowns, etc.
|
|
17
|
-
*
|
|
18
|
-
* It is used i.a.
|
|
19
|
-
* by {@link module:table/tablecellproperties/ui/tablecellpropertiesview~TableCellPropertiesView}.
|
|
20
|
-
*
|
|
21
|
-
* The latter is an example, where the component has been extended by {@link module:ui/dropdown/dropdownview~DropdownView} view.
|
|
22
|
-
*/
|
|
23
|
-
export class FormHeaderView extends View {
|
|
24
|
-
/**
|
|
25
|
-
* A collection of header items.
|
|
26
|
-
*/
|
|
27
|
-
children;
|
|
28
|
-
/**
|
|
29
|
-
* The icon view instance. Defined only if icon was passed in the constructor's options.
|
|
30
|
-
*/
|
|
31
|
-
iconView;
|
|
32
|
-
/**
|
|
33
|
-
* Creates an instance of the form header class.
|
|
34
|
-
*
|
|
35
|
-
* @param locale The locale instance.
|
|
36
|
-
* @param options.label A label.
|
|
37
|
-
* @param options.class An additional class.
|
|
38
|
-
*/
|
|
39
|
-
constructor(locale, options = {}) {
|
|
40
|
-
super(locale);
|
|
41
|
-
const bind = this.bindTemplate;
|
|
42
|
-
this.set('label', options.label || '');
|
|
43
|
-
this.set('class', options.class || null);
|
|
44
|
-
this.children = this.createCollection();
|
|
45
|
-
this.setTemplate({
|
|
46
|
-
tag: 'div',
|
|
47
|
-
attributes: {
|
|
48
|
-
class: [
|
|
49
|
-
'ck',
|
|
50
|
-
'ck-form__header',
|
|
51
|
-
bind.to('class')
|
|
52
|
-
]
|
|
53
|
-
},
|
|
54
|
-
children: this.children
|
|
55
|
-
});
|
|
56
|
-
if (options.icon) {
|
|
57
|
-
this.iconView = new IconView();
|
|
58
|
-
this.iconView.content = options.icon;
|
|
59
|
-
this.children.add(this.iconView);
|
|
60
|
-
}
|
|
61
|
-
const label = new View(locale);
|
|
62
|
-
label.setTemplate({
|
|
63
|
-
tag: 'h2',
|
|
64
|
-
attributes: {
|
|
65
|
-
class: [
|
|
66
|
-
'ck',
|
|
67
|
-
'ck-form__header__label'
|
|
68
|
-
],
|
|
69
|
-
role: 'presentation'
|
|
70
|
-
},
|
|
71
|
-
children: [
|
|
72
|
-
{ text: bind.to('label') }
|
|
73
|
-
]
|
|
74
|
-
});
|
|
75
|
-
this.children.add(label);
|
|
76
|
-
}
|
|
77
|
-
}
|