@ckeditor/ckeditor5-ui 47.6.1 → 48.0.0-alpha.1
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,368 +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/colorselector/colorgridsfragmentview
|
|
7
|
-
*/
|
|
8
|
-
import { View } from '../view.js';
|
|
9
|
-
import { ButtonView } from '../button/buttonview.js';
|
|
10
|
-
import { ColorGridView } from '../colorgrid/colorgridview.js';
|
|
11
|
-
import { ColorTileView } from '../colorgrid/colortileview.js';
|
|
12
|
-
import { Template } from '../template.js';
|
|
13
|
-
import { DocumentColorCollection } from './documentcolorcollection.js';
|
|
14
|
-
import { IconEraser, IconColorPalette } from '@ckeditor/ckeditor5-icons';
|
|
15
|
-
/**
|
|
16
|
-
* One of the fragments of {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.
|
|
17
|
-
*
|
|
18
|
-
* It provides a UI that allows users to select colors from the a predefined set and from existing document colors.
|
|
19
|
-
*
|
|
20
|
-
* It consists of the following sub–components:
|
|
21
|
-
*
|
|
22
|
-
* * A "Remove color" button,
|
|
23
|
-
* * A static {@link module:ui/colorgrid/colorgridview~ColorGridView} of colors defined in the configuration,
|
|
24
|
-
* * A dynamic {@link module:ui/colorgrid/colorgridview~ColorGridView} of colors used in the document.
|
|
25
|
-
* * If color picker is configured, the "Color Picker" button is visible too.
|
|
26
|
-
*/
|
|
27
|
-
export class ColorGridsFragmentView extends View {
|
|
28
|
-
/**
|
|
29
|
-
* A collection of the children of the table.
|
|
30
|
-
*/
|
|
31
|
-
items;
|
|
32
|
-
/**
|
|
33
|
-
* An array with objects representing colors to be displayed in the grid.
|
|
34
|
-
*/
|
|
35
|
-
colorDefinitions;
|
|
36
|
-
/**
|
|
37
|
-
* Tracks information about the DOM focus in the list.
|
|
38
|
-
*/
|
|
39
|
-
focusTracker;
|
|
40
|
-
/**
|
|
41
|
-
* The number of columns in the color grid.
|
|
42
|
-
*/
|
|
43
|
-
columns;
|
|
44
|
-
/**
|
|
45
|
-
* Preserves the reference to {@link module:ui/colorselector/documentcolorcollection~DocumentColorCollection} used to collect
|
|
46
|
-
* definitions that store the document colors.
|
|
47
|
-
*
|
|
48
|
-
* @readonly
|
|
49
|
-
*/
|
|
50
|
-
documentColors;
|
|
51
|
-
/**
|
|
52
|
-
* The maximum number of colors in the document colors section.
|
|
53
|
-
* If it equals 0, the document colors section is not added.
|
|
54
|
-
*
|
|
55
|
-
* @readonly
|
|
56
|
-
*/
|
|
57
|
-
documentColorsCount;
|
|
58
|
-
/**
|
|
59
|
-
* Preserves the reference to {@link module:ui/colorgrid/colorgridview~ColorGridView} used to create
|
|
60
|
-
* the default (static) color set.
|
|
61
|
-
*
|
|
62
|
-
* The property is loaded once the the parent dropdown is opened the first time.
|
|
63
|
-
*
|
|
64
|
-
* @readonly
|
|
65
|
-
*/
|
|
66
|
-
staticColorsGrid;
|
|
67
|
-
/**
|
|
68
|
-
* Preserves the reference to {@link module:ui/colorgrid/colorgridview~ColorGridView} used to create
|
|
69
|
-
* the document colors. It remains undefined if the document colors feature is disabled.
|
|
70
|
-
*
|
|
71
|
-
* The property is loaded once the the parent dropdown is opened the first time.
|
|
72
|
-
*
|
|
73
|
-
* @readonly
|
|
74
|
-
*/
|
|
75
|
-
documentColorsGrid;
|
|
76
|
-
/**
|
|
77
|
-
* The "Color picker" button view.
|
|
78
|
-
*/
|
|
79
|
-
colorPickerButtonView;
|
|
80
|
-
/**
|
|
81
|
-
* The "Remove color" button view.
|
|
82
|
-
*/
|
|
83
|
-
removeColorButtonView;
|
|
84
|
-
/**
|
|
85
|
-
* A collection of views that can be focused in the view.
|
|
86
|
-
*
|
|
87
|
-
* @readonly
|
|
88
|
-
*/
|
|
89
|
-
_focusables;
|
|
90
|
-
/**
|
|
91
|
-
* Document color section's label.
|
|
92
|
-
*
|
|
93
|
-
* @readonly
|
|
94
|
-
*/
|
|
95
|
-
_documentColorsLabel;
|
|
96
|
-
/**
|
|
97
|
-
* The label of the button responsible for removing color attributes.
|
|
98
|
-
*/
|
|
99
|
-
_removeButtonLabel;
|
|
100
|
-
/**
|
|
101
|
-
* The label of the button responsible for switching to the color picker component.
|
|
102
|
-
*/
|
|
103
|
-
_colorPickerLabel;
|
|
104
|
-
/**
|
|
105
|
-
* Creates an instance of the view.
|
|
106
|
-
*
|
|
107
|
-
* @param locale The localization services instance.
|
|
108
|
-
* @param options Constructor options.
|
|
109
|
-
* @param options.colors An array with definitions of colors to be displayed in the table.
|
|
110
|
-
* @param options.columns The number of columns in the color grid.
|
|
111
|
-
* @param options.removeButtonLabel The label of the button responsible for removing the color.
|
|
112
|
-
* @param options.colorPickerLabel The label of the button responsible for color picker appearing.
|
|
113
|
-
* @param options.documentColorsLabel The label for the section with the document colors.
|
|
114
|
-
* @param options.documentColorsCount The number of colors in the document colors section inside the color dropdown.
|
|
115
|
-
* @param options.focusTracker Tracks information about the DOM focus in the list.
|
|
116
|
-
* @param options.focusables A collection of views that can be focused in the view.
|
|
117
|
-
*/
|
|
118
|
-
constructor(locale, { colors, columns, removeButtonLabel, documentColorsLabel, documentColorsCount, colorPickerLabel, focusTracker, focusables }) {
|
|
119
|
-
super(locale);
|
|
120
|
-
const bind = this.bindTemplate;
|
|
121
|
-
this.set('isVisible', true);
|
|
122
|
-
this.focusTracker = focusTracker;
|
|
123
|
-
this.items = this.createCollection();
|
|
124
|
-
this.colorDefinitions = colors;
|
|
125
|
-
this.columns = columns;
|
|
126
|
-
this.documentColors = new DocumentColorCollection();
|
|
127
|
-
this.documentColorsCount = documentColorsCount;
|
|
128
|
-
this._focusables = focusables;
|
|
129
|
-
this._removeButtonLabel = removeButtonLabel;
|
|
130
|
-
this._colorPickerLabel = colorPickerLabel;
|
|
131
|
-
this._documentColorsLabel = documentColorsLabel;
|
|
132
|
-
this.setTemplate({
|
|
133
|
-
tag: 'div',
|
|
134
|
-
attributes: {
|
|
135
|
-
class: [
|
|
136
|
-
'ck-color-grids-fragment',
|
|
137
|
-
bind.if('isVisible', 'ck-hidden', value => !value)
|
|
138
|
-
]
|
|
139
|
-
},
|
|
140
|
-
children: this.items
|
|
141
|
-
});
|
|
142
|
-
this.removeColorButtonView = this._createRemoveColorButton();
|
|
143
|
-
this.items.add(this.removeColorButtonView);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Scans through the editor model and searches for text node attributes with the given attribute name.
|
|
147
|
-
* Found entries are set as document colors.
|
|
148
|
-
*
|
|
149
|
-
* All the previously stored document colors will be lost in the process.
|
|
150
|
-
*
|
|
151
|
-
* @param model The model used as a source to obtain the document colors.
|
|
152
|
-
* @param attributeName Determines the name of the related model's attribute for a given dropdown.
|
|
153
|
-
*/
|
|
154
|
-
updateDocumentColors(model, attributeName) {
|
|
155
|
-
const document = model.document;
|
|
156
|
-
const maxCount = this.documentColorsCount;
|
|
157
|
-
this.documentColors.clear();
|
|
158
|
-
for (const root of document.getRoots()) {
|
|
159
|
-
const range = model.createRangeIn(root);
|
|
160
|
-
for (const node of range.getItems()) {
|
|
161
|
-
if (node.is('$textProxy') && node.hasAttribute(attributeName)) {
|
|
162
|
-
this._addColorToDocumentColors(node.getAttribute(attributeName));
|
|
163
|
-
if (this.documentColors.length >= maxCount) {
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* Refreshes the state of the selected color in one or both {@link module:ui/colorgrid/colorgridview~ColorGridView}s
|
|
172
|
-
* available in the {@link module:ui/colorselector/colorselectorview~ColorSelectorView}. It guarantees that the selection will
|
|
173
|
-
* occur only in one of them.
|
|
174
|
-
*/
|
|
175
|
-
updateSelectedColors() {
|
|
176
|
-
const documentColorsGrid = this.documentColorsGrid;
|
|
177
|
-
const staticColorsGrid = this.staticColorsGrid;
|
|
178
|
-
const selectedColor = this.selectedColor;
|
|
179
|
-
staticColorsGrid.selectedColor = selectedColor;
|
|
180
|
-
if (documentColorsGrid) {
|
|
181
|
-
documentColorsGrid.selectedColor = selectedColor;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* @inheritDoc
|
|
186
|
-
*/
|
|
187
|
-
render() {
|
|
188
|
-
super.render();
|
|
189
|
-
this.staticColorsGrid = this._createStaticColorsGrid();
|
|
190
|
-
this.items.add(this.staticColorsGrid);
|
|
191
|
-
if (this.documentColorsCount) {
|
|
192
|
-
// Create a label for document colors.
|
|
193
|
-
const bind = Template.bind(this.documentColors, this.documentColors);
|
|
194
|
-
const label = new View(this.locale);
|
|
195
|
-
label.setTemplate({
|
|
196
|
-
tag: 'span',
|
|
197
|
-
attributes: {
|
|
198
|
-
class: [
|
|
199
|
-
'ck',
|
|
200
|
-
'ck-color-grid__label',
|
|
201
|
-
bind.if('isEmpty', 'ck-hidden')
|
|
202
|
-
]
|
|
203
|
-
},
|
|
204
|
-
children: [
|
|
205
|
-
{
|
|
206
|
-
text: this._documentColorsLabel
|
|
207
|
-
}
|
|
208
|
-
]
|
|
209
|
-
});
|
|
210
|
-
this.items.add(label);
|
|
211
|
-
this.documentColorsGrid = this._createDocumentColorsGrid();
|
|
212
|
-
this.items.add(this.documentColorsGrid);
|
|
213
|
-
}
|
|
214
|
-
this._createColorPickerButton();
|
|
215
|
-
this._addColorSelectorElementsToFocusTracker();
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Focuses the component.
|
|
219
|
-
*/
|
|
220
|
-
focus() {
|
|
221
|
-
this.removeColorButtonView.focus();
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* @inheritDoc
|
|
225
|
-
*/
|
|
226
|
-
destroy() {
|
|
227
|
-
super.destroy();
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Handles displaying the color picker button (if it was previously created) and making it focusable.
|
|
231
|
-
*/
|
|
232
|
-
addColorPickerButton() {
|
|
233
|
-
if (this.colorPickerButtonView) {
|
|
234
|
-
this.items.add(this.colorPickerButtonView);
|
|
235
|
-
this.focusTracker.add(this.colorPickerButtonView.element);
|
|
236
|
-
this._focusables.add(this.colorPickerButtonView);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
/**
|
|
240
|
-
* Adds color selector elements to focus tracker.
|
|
241
|
-
*/
|
|
242
|
-
_addColorSelectorElementsToFocusTracker() {
|
|
243
|
-
this.focusTracker.add(this.removeColorButtonView.element);
|
|
244
|
-
this._focusables.add(this.removeColorButtonView);
|
|
245
|
-
if (this.staticColorsGrid) {
|
|
246
|
-
this.focusTracker.add(this.staticColorsGrid.element);
|
|
247
|
-
this._focusables.add(this.staticColorsGrid);
|
|
248
|
-
}
|
|
249
|
-
if (this.documentColorsGrid) {
|
|
250
|
-
this.focusTracker.add(this.documentColorsGrid.element);
|
|
251
|
-
this._focusables.add(this.documentColorsGrid);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
/**
|
|
255
|
-
* Creates the button responsible for displaying the color picker component.
|
|
256
|
-
*/
|
|
257
|
-
_createColorPickerButton() {
|
|
258
|
-
this.colorPickerButtonView = new ButtonView();
|
|
259
|
-
this.colorPickerButtonView.set({
|
|
260
|
-
label: this._colorPickerLabel,
|
|
261
|
-
withText: true,
|
|
262
|
-
icon: IconColorPalette,
|
|
263
|
-
class: 'ck-color-selector__color-picker'
|
|
264
|
-
});
|
|
265
|
-
this.colorPickerButtonView.on('execute', () => {
|
|
266
|
-
this.fire('colorPicker:show');
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
/**
|
|
270
|
-
* Adds the remove color button as a child of the current view.
|
|
271
|
-
*/
|
|
272
|
-
_createRemoveColorButton() {
|
|
273
|
-
const buttonView = new ButtonView();
|
|
274
|
-
buttonView.set({
|
|
275
|
-
withText: true,
|
|
276
|
-
icon: IconEraser,
|
|
277
|
-
label: this._removeButtonLabel
|
|
278
|
-
});
|
|
279
|
-
buttonView.class = 'ck-color-selector__remove-color';
|
|
280
|
-
buttonView.on('execute', () => {
|
|
281
|
-
this.fire('execute', {
|
|
282
|
-
value: null,
|
|
283
|
-
source: 'removeColorButton'
|
|
284
|
-
});
|
|
285
|
-
});
|
|
286
|
-
buttonView.render();
|
|
287
|
-
return buttonView;
|
|
288
|
-
}
|
|
289
|
-
/**
|
|
290
|
-
* Creates a static color grid based on the editor configuration.
|
|
291
|
-
*/
|
|
292
|
-
_createStaticColorsGrid() {
|
|
293
|
-
const colorGrid = new ColorGridView(this.locale, {
|
|
294
|
-
colorDefinitions: this.colorDefinitions,
|
|
295
|
-
columns: this.columns
|
|
296
|
-
});
|
|
297
|
-
colorGrid.on('execute', (evt, data) => {
|
|
298
|
-
this.fire('execute', {
|
|
299
|
-
value: data.value,
|
|
300
|
-
source: 'staticColorsGrid'
|
|
301
|
-
});
|
|
302
|
-
});
|
|
303
|
-
return colorGrid;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Creates the document colors section view and binds it to {@link #documentColors}.
|
|
307
|
-
*/
|
|
308
|
-
_createDocumentColorsGrid() {
|
|
309
|
-
const bind = Template.bind(this.documentColors, this.documentColors);
|
|
310
|
-
const documentColorsGrid = new ColorGridView(this.locale, {
|
|
311
|
-
columns: this.columns
|
|
312
|
-
});
|
|
313
|
-
documentColorsGrid.extendTemplate({
|
|
314
|
-
attributes: {
|
|
315
|
-
class: bind.if('isEmpty', 'ck-hidden')
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
documentColorsGrid.items.bindTo(this.documentColors).using(colorObj => {
|
|
319
|
-
const colorTile = new ColorTileView();
|
|
320
|
-
colorTile.set({
|
|
321
|
-
color: colorObj.color,
|
|
322
|
-
hasBorder: colorObj.options?.hasBorder
|
|
323
|
-
});
|
|
324
|
-
if (colorObj.label) {
|
|
325
|
-
colorTile.set({
|
|
326
|
-
label: colorObj.label,
|
|
327
|
-
tooltip: true
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
colorTile.on('execute', () => {
|
|
331
|
-
this.fire('execute', {
|
|
332
|
-
value: colorObj.color,
|
|
333
|
-
source: 'documentColorsGrid'
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
return colorTile;
|
|
337
|
-
});
|
|
338
|
-
// Selected color should be cleared when document colors became empty.
|
|
339
|
-
this.documentColors.on('change:isEmpty', (evt, name, val) => {
|
|
340
|
-
if (val) {
|
|
341
|
-
documentColorsGrid.selectedColor = null;
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
return documentColorsGrid;
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Adds a given color to the document colors list. If possible, the method will attempt to use
|
|
348
|
-
* data from the {@link #colorDefinitions} (label, color options).
|
|
349
|
-
*
|
|
350
|
-
* @param color A string that stores the value of the recently applied color.
|
|
351
|
-
*/
|
|
352
|
-
_addColorToDocumentColors(color) {
|
|
353
|
-
const predefinedColor = this.colorDefinitions
|
|
354
|
-
.find(definition => definition.color === color);
|
|
355
|
-
if (!predefinedColor) {
|
|
356
|
-
this.documentColors.add({
|
|
357
|
-
color,
|
|
358
|
-
label: color,
|
|
359
|
-
options: {
|
|
360
|
-
hasBorder: false
|
|
361
|
-
}
|
|
362
|
-
});
|
|
363
|
-
}
|
|
364
|
-
else {
|
|
365
|
-
this.documentColors.add(Object.assign({}, predefinedColor));
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
@@ -1,254 +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/colorselector/colorpickerfragmentview
|
|
7
|
-
*/
|
|
8
|
-
import { View } from '../view.js';
|
|
9
|
-
import { ButtonView } from '../button/buttonview.js';
|
|
10
|
-
import { ColorPickerView } from '../colorpicker/colorpickerview.js';
|
|
11
|
-
import { IconCancel, IconCheck } from '@ckeditor/ckeditor5-icons';
|
|
12
|
-
/**
|
|
13
|
-
* One of the fragments of {@link module:ui/colorselector/colorselectorview~ColorSelectorView}.
|
|
14
|
-
*
|
|
15
|
-
* It allows users to select a color from a color picker.
|
|
16
|
-
*
|
|
17
|
-
* It consists of the following sub–components:
|
|
18
|
-
*
|
|
19
|
-
* * A color picker saturation and hue sliders,
|
|
20
|
-
* * A text input accepting colors in HEX format,
|
|
21
|
-
* * "Save" and "Cancel" action buttons.
|
|
22
|
-
*/
|
|
23
|
-
export class ColorPickerFragmentView extends View {
|
|
24
|
-
/**
|
|
25
|
-
* A collection of component's children.
|
|
26
|
-
*/
|
|
27
|
-
items;
|
|
28
|
-
/**
|
|
29
|
-
* A view with saturation and hue sliders and color input.
|
|
30
|
-
*/
|
|
31
|
-
colorPickerView;
|
|
32
|
-
/**
|
|
33
|
-
* The "Save" button view.
|
|
34
|
-
*/
|
|
35
|
-
saveButtonView;
|
|
36
|
-
/**
|
|
37
|
-
* The "Cancel" button view.
|
|
38
|
-
*/
|
|
39
|
-
cancelButtonView;
|
|
40
|
-
/**
|
|
41
|
-
* The action bar where are "Save" button and "Cancel" button.
|
|
42
|
-
*/
|
|
43
|
-
actionBarView;
|
|
44
|
-
/**
|
|
45
|
-
* Tracks information about the DOM focus in the list.
|
|
46
|
-
*/
|
|
47
|
-
focusTracker;
|
|
48
|
-
/**
|
|
49
|
-
* An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
50
|
-
*/
|
|
51
|
-
keystrokes;
|
|
52
|
-
/**
|
|
53
|
-
* A collection of views that can be focused in the view.
|
|
54
|
-
*
|
|
55
|
-
* @readonly
|
|
56
|
-
*/
|
|
57
|
-
_focusables;
|
|
58
|
-
/**
|
|
59
|
-
* A reference to the configuration of {@link #colorPickerView}. `false` when the view was
|
|
60
|
-
* configured without a color picker.
|
|
61
|
-
*
|
|
62
|
-
* @readonly
|
|
63
|
-
*/
|
|
64
|
-
_colorPickerViewConfig;
|
|
65
|
-
/**
|
|
66
|
-
* Creates an instance of the view.
|
|
67
|
-
*
|
|
68
|
-
* @param locale The localization services instance.
|
|
69
|
-
* @param options Constructor options.
|
|
70
|
-
* @param options.focusTracker Tracks information about the DOM focus in the list.
|
|
71
|
-
* @param options.focusables A collection of views that can be focused in the view.
|
|
72
|
-
* @param options.keystrokes An instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}.
|
|
73
|
-
* @param options.colorPickerViewConfig The configuration of color picker feature. If set to `false`, the color picker
|
|
74
|
-
* will not be rendered.
|
|
75
|
-
*/
|
|
76
|
-
constructor(locale, { focusTracker, focusables, keystrokes, colorPickerViewConfig }) {
|
|
77
|
-
super(locale);
|
|
78
|
-
this.items = this.createCollection();
|
|
79
|
-
this.focusTracker = focusTracker;
|
|
80
|
-
this.keystrokes = keystrokes;
|
|
81
|
-
this.set('isVisible', false);
|
|
82
|
-
this.set('selectedColor', undefined);
|
|
83
|
-
this._focusables = focusables;
|
|
84
|
-
this._colorPickerViewConfig = colorPickerViewConfig;
|
|
85
|
-
const bind = this.bindTemplate;
|
|
86
|
-
const { saveButtonView, cancelButtonView } = this._createActionButtons();
|
|
87
|
-
this.saveButtonView = saveButtonView;
|
|
88
|
-
this.cancelButtonView = cancelButtonView;
|
|
89
|
-
this.actionBarView = this._createActionBarView({ saveButtonView, cancelButtonView });
|
|
90
|
-
this.setTemplate({
|
|
91
|
-
tag: 'div',
|
|
92
|
-
attributes: {
|
|
93
|
-
class: [
|
|
94
|
-
'ck-color-picker-fragment',
|
|
95
|
-
bind.if('isVisible', 'ck-hidden', value => !value)
|
|
96
|
-
]
|
|
97
|
-
},
|
|
98
|
-
children: this.items
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* @inheritDoc
|
|
103
|
-
*/
|
|
104
|
-
render() {
|
|
105
|
-
super.render();
|
|
106
|
-
const colorPickerView = new ColorPickerView(this.locale, {
|
|
107
|
-
...this._colorPickerViewConfig
|
|
108
|
-
});
|
|
109
|
-
this.colorPickerView = colorPickerView;
|
|
110
|
-
this.colorPickerView.render();
|
|
111
|
-
if (this.selectedColor) {
|
|
112
|
-
colorPickerView.color = this.selectedColor;
|
|
113
|
-
}
|
|
114
|
-
this.listenTo(this, 'change:selectedColor', (evt, name, value) => {
|
|
115
|
-
colorPickerView.color = value;
|
|
116
|
-
});
|
|
117
|
-
this.items.add(this.colorPickerView);
|
|
118
|
-
this.items.add(this.actionBarView);
|
|
119
|
-
this._addColorPickersElementsToFocusTracker();
|
|
120
|
-
this._stopPropagationOnArrowsKeys();
|
|
121
|
-
this._executeOnEnterPress();
|
|
122
|
-
this._executeUponColorChange();
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* @inheritDoc
|
|
126
|
-
*/
|
|
127
|
-
destroy() {
|
|
128
|
-
super.destroy();
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Focuses the color picker.
|
|
132
|
-
*/
|
|
133
|
-
focus() {
|
|
134
|
-
this.colorPickerView.focus();
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Reset validation messages.
|
|
138
|
-
*/
|
|
139
|
-
resetValidationStatus() {
|
|
140
|
-
this.colorPickerView.resetValidationStatus();
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* When color picker is focused and "enter" is pressed it executes command.
|
|
144
|
-
*/
|
|
145
|
-
_executeOnEnterPress() {
|
|
146
|
-
this.keystrokes.set('enter', evt => {
|
|
147
|
-
if (this.isVisible && this.focusTracker.focusedElement !== this.cancelButtonView.element && this.colorPickerView.isValid()) {
|
|
148
|
-
this.fire('execute', {
|
|
149
|
-
value: this.selectedColor
|
|
150
|
-
});
|
|
151
|
-
evt.stopPropagation();
|
|
152
|
-
evt.preventDefault();
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* Removes default behavior of arrow keys in dropdown.
|
|
158
|
-
*/
|
|
159
|
-
_stopPropagationOnArrowsKeys() {
|
|
160
|
-
const stopPropagation = (data) => data.stopPropagation();
|
|
161
|
-
this.keystrokes.set('arrowright', stopPropagation);
|
|
162
|
-
this.keystrokes.set('arrowleft', stopPropagation);
|
|
163
|
-
this.keystrokes.set('arrowup', stopPropagation);
|
|
164
|
-
this.keystrokes.set('arrowdown', stopPropagation);
|
|
165
|
-
}
|
|
166
|
-
/**
|
|
167
|
-
* Adds color picker elements to focus tracker.
|
|
168
|
-
*/
|
|
169
|
-
_addColorPickersElementsToFocusTracker() {
|
|
170
|
-
for (const slider of this.colorPickerView.slidersView) {
|
|
171
|
-
this.focusTracker.add(slider.element);
|
|
172
|
-
this._focusables.add(slider);
|
|
173
|
-
}
|
|
174
|
-
const input = this.colorPickerView.hexInputRow.children.get(1);
|
|
175
|
-
if (input.element) {
|
|
176
|
-
this.focusTracker.add(input.element);
|
|
177
|
-
this._focusables.add(input);
|
|
178
|
-
}
|
|
179
|
-
this.focusTracker.add(this.saveButtonView.element);
|
|
180
|
-
this._focusables.add(this.saveButtonView);
|
|
181
|
-
this.focusTracker.add(this.cancelButtonView.element);
|
|
182
|
-
this._focusables.add(this.cancelButtonView);
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Creates bar containing "Save" and "Cancel" buttons.
|
|
186
|
-
*/
|
|
187
|
-
_createActionBarView({ saveButtonView, cancelButtonView }) {
|
|
188
|
-
const actionBarRow = new View();
|
|
189
|
-
const children = this.createCollection();
|
|
190
|
-
children.add(saveButtonView);
|
|
191
|
-
children.add(cancelButtonView);
|
|
192
|
-
actionBarRow.setTemplate({
|
|
193
|
-
tag: 'div',
|
|
194
|
-
attributes: {
|
|
195
|
-
class: [
|
|
196
|
-
'ck',
|
|
197
|
-
'ck-color-selector_action-bar'
|
|
198
|
-
]
|
|
199
|
-
},
|
|
200
|
-
children
|
|
201
|
-
});
|
|
202
|
-
return actionBarRow;
|
|
203
|
-
}
|
|
204
|
-
/**
|
|
205
|
-
* Creates "Save" and "Cancel" buttons.
|
|
206
|
-
*/
|
|
207
|
-
_createActionButtons() {
|
|
208
|
-
const locale = this.locale;
|
|
209
|
-
const t = locale.t;
|
|
210
|
-
const saveButtonView = new ButtonView(locale);
|
|
211
|
-
const cancelButtonView = new ButtonView(locale);
|
|
212
|
-
saveButtonView.set({
|
|
213
|
-
icon: IconCheck,
|
|
214
|
-
class: 'ck-button-save',
|
|
215
|
-
type: 'button',
|
|
216
|
-
withText: false,
|
|
217
|
-
label: t('Accept')
|
|
218
|
-
});
|
|
219
|
-
cancelButtonView.set({
|
|
220
|
-
icon: IconCancel,
|
|
221
|
-
class: 'ck-button-cancel',
|
|
222
|
-
type: 'button',
|
|
223
|
-
withText: false,
|
|
224
|
-
label: t('Cancel')
|
|
225
|
-
});
|
|
226
|
-
saveButtonView.on('execute', () => {
|
|
227
|
-
if (this.colorPickerView.isValid()) {
|
|
228
|
-
this.fire('execute', {
|
|
229
|
-
source: 'colorPickerSaveButton',
|
|
230
|
-
value: this.selectedColor
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
});
|
|
234
|
-
cancelButtonView.on('execute', () => {
|
|
235
|
-
this.fire('colorPicker:cancel');
|
|
236
|
-
});
|
|
237
|
-
return {
|
|
238
|
-
saveButtonView, cancelButtonView
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Fires the `execute` event if color in color picker has been changed
|
|
243
|
-
* by the user.
|
|
244
|
-
*/
|
|
245
|
-
_executeUponColorChange() {
|
|
246
|
-
this.colorPickerView.on('colorSelected', (evt, data) => {
|
|
247
|
-
this.fire('execute', {
|
|
248
|
-
value: data.color,
|
|
249
|
-
source: 'colorPicker'
|
|
250
|
-
});
|
|
251
|
-
this.set('selectedColor', data.color);
|
|
252
|
-
});
|
|
253
|
-
}
|
|
254
|
-
}
|