@ckeditor/ckeditor5-ui 41.3.1 → 41.4.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/dist/index-content.css +4 -0
- package/dist/index-editor.css +497 -0
- package/dist/index.css +942 -0
- package/dist/index.css.map +1 -0
- package/dist/index.js +14343 -0
- package/dist/index.js.map +1 -0
- package/dist/translations/af.d.ts +8 -0
- package/dist/translations/af.js +5 -0
- package/dist/translations/af.umd.js +11 -0
- package/dist/translations/ar.d.ts +8 -0
- package/dist/translations/ar.js +5 -0
- package/dist/translations/ar.umd.js +11 -0
- package/dist/translations/ast.d.ts +8 -0
- package/dist/translations/ast.js +5 -0
- package/dist/translations/ast.umd.js +11 -0
- package/dist/translations/az.d.ts +8 -0
- package/dist/translations/az.js +5 -0
- package/dist/translations/az.umd.js +11 -0
- package/dist/translations/bg.d.ts +8 -0
- package/dist/translations/bg.js +5 -0
- package/dist/translations/bg.umd.js +11 -0
- package/dist/translations/bn.d.ts +8 -0
- package/dist/translations/bn.js +5 -0
- package/dist/translations/bn.umd.js +11 -0
- package/dist/translations/bs.d.ts +8 -0
- package/dist/translations/bs.js +5 -0
- package/dist/translations/bs.umd.js +11 -0
- package/dist/translations/ca.d.ts +8 -0
- package/dist/translations/ca.js +5 -0
- package/dist/translations/ca.umd.js +11 -0
- package/dist/translations/cs.d.ts +8 -0
- package/dist/translations/cs.js +5 -0
- package/dist/translations/cs.umd.js +11 -0
- package/dist/translations/da.d.ts +8 -0
- package/dist/translations/da.js +5 -0
- package/dist/translations/da.umd.js +11 -0
- package/dist/translations/de-ch.d.ts +8 -0
- package/dist/translations/de-ch.js +5 -0
- package/dist/translations/de-ch.umd.js +11 -0
- package/dist/translations/de.d.ts +8 -0
- package/dist/translations/de.js +5 -0
- package/dist/translations/de.umd.js +11 -0
- package/dist/translations/el.d.ts +8 -0
- package/dist/translations/el.js +5 -0
- package/dist/translations/el.umd.js +11 -0
- package/dist/translations/en-au.d.ts +8 -0
- package/dist/translations/en-au.js +5 -0
- package/dist/translations/en-au.umd.js +11 -0
- package/dist/translations/en-gb.d.ts +8 -0
- package/dist/translations/en-gb.js +5 -0
- package/dist/translations/en-gb.umd.js +11 -0
- package/dist/translations/en.d.ts +8 -0
- package/dist/translations/en.js +5 -0
- package/dist/translations/en.umd.js +11 -0
- package/dist/translations/eo.d.ts +8 -0
- package/dist/translations/eo.js +5 -0
- package/dist/translations/eo.umd.js +11 -0
- package/dist/translations/es-co.d.ts +8 -0
- package/dist/translations/es-co.js +5 -0
- package/dist/translations/es-co.umd.js +11 -0
- package/dist/translations/es.d.ts +8 -0
- package/dist/translations/es.js +5 -0
- package/dist/translations/es.umd.js +11 -0
- package/dist/translations/et.d.ts +8 -0
- package/dist/translations/et.js +5 -0
- package/dist/translations/et.umd.js +11 -0
- package/dist/translations/eu.d.ts +8 -0
- package/dist/translations/eu.js +5 -0
- package/dist/translations/eu.umd.js +11 -0
- package/dist/translations/fa.d.ts +8 -0
- package/dist/translations/fa.js +5 -0
- package/dist/translations/fa.umd.js +11 -0
- package/dist/translations/fi.d.ts +8 -0
- package/dist/translations/fi.js +5 -0
- package/dist/translations/fi.umd.js +11 -0
- package/dist/translations/fr.d.ts +8 -0
- package/dist/translations/fr.js +5 -0
- package/dist/translations/fr.umd.js +11 -0
- package/dist/translations/gl.d.ts +8 -0
- package/dist/translations/gl.js +5 -0
- package/dist/translations/gl.umd.js +11 -0
- package/dist/translations/he.d.ts +8 -0
- package/dist/translations/he.js +5 -0
- package/dist/translations/he.umd.js +11 -0
- package/dist/translations/hi.d.ts +8 -0
- package/dist/translations/hi.js +5 -0
- package/dist/translations/hi.umd.js +11 -0
- package/dist/translations/hr.d.ts +8 -0
- package/dist/translations/hr.js +5 -0
- package/dist/translations/hr.umd.js +11 -0
- package/dist/translations/hu.d.ts +8 -0
- package/dist/translations/hu.js +5 -0
- package/dist/translations/hu.umd.js +11 -0
- package/dist/translations/id.d.ts +8 -0
- package/dist/translations/id.js +5 -0
- package/dist/translations/id.umd.js +11 -0
- package/dist/translations/it.d.ts +8 -0
- package/dist/translations/it.js +5 -0
- package/dist/translations/it.umd.js +11 -0
- package/dist/translations/ja.d.ts +8 -0
- package/dist/translations/ja.js +5 -0
- package/dist/translations/ja.umd.js +11 -0
- package/dist/translations/jv.d.ts +8 -0
- package/dist/translations/jv.js +5 -0
- package/dist/translations/jv.umd.js +11 -0
- package/dist/translations/km.d.ts +8 -0
- package/dist/translations/km.js +5 -0
- package/dist/translations/km.umd.js +11 -0
- package/dist/translations/kn.d.ts +8 -0
- package/dist/translations/kn.js +5 -0
- package/dist/translations/kn.umd.js +11 -0
- package/dist/translations/ko.d.ts +8 -0
- package/dist/translations/ko.js +5 -0
- package/dist/translations/ko.umd.js +11 -0
- package/dist/translations/ku.d.ts +8 -0
- package/dist/translations/ku.js +5 -0
- package/dist/translations/ku.umd.js +11 -0
- package/dist/translations/lt.d.ts +8 -0
- package/dist/translations/lt.js +5 -0
- package/dist/translations/lt.umd.js +11 -0
- package/dist/translations/lv.d.ts +8 -0
- package/dist/translations/lv.js +5 -0
- package/dist/translations/lv.umd.js +11 -0
- package/dist/translations/ms.d.ts +8 -0
- package/dist/translations/ms.js +5 -0
- package/dist/translations/ms.umd.js +11 -0
- package/dist/translations/nb.d.ts +8 -0
- package/dist/translations/nb.js +5 -0
- package/dist/translations/nb.umd.js +11 -0
- package/dist/translations/ne.d.ts +8 -0
- package/dist/translations/ne.js +5 -0
- package/dist/translations/ne.umd.js +11 -0
- package/dist/translations/nl.d.ts +8 -0
- package/dist/translations/nl.js +5 -0
- package/dist/translations/nl.umd.js +11 -0
- package/dist/translations/no.d.ts +8 -0
- package/dist/translations/no.js +5 -0
- package/dist/translations/no.umd.js +11 -0
- package/dist/translations/pl.d.ts +8 -0
- package/dist/translations/pl.js +5 -0
- package/dist/translations/pl.umd.js +11 -0
- package/dist/translations/pt-br.d.ts +8 -0
- package/dist/translations/pt-br.js +5 -0
- package/dist/translations/pt-br.umd.js +11 -0
- package/dist/translations/pt.d.ts +8 -0
- package/dist/translations/pt.js +5 -0
- package/dist/translations/pt.umd.js +11 -0
- package/dist/translations/ro.d.ts +8 -0
- package/dist/translations/ro.js +5 -0
- package/dist/translations/ro.umd.js +11 -0
- package/dist/translations/ru.d.ts +8 -0
- package/dist/translations/ru.js +5 -0
- package/dist/translations/ru.umd.js +11 -0
- package/dist/translations/sk.d.ts +8 -0
- package/dist/translations/sk.js +5 -0
- package/dist/translations/sk.umd.js +11 -0
- package/dist/translations/sl.d.ts +8 -0
- package/dist/translations/sl.js +5 -0
- package/dist/translations/sl.umd.js +11 -0
- package/dist/translations/sq.d.ts +8 -0
- package/dist/translations/sq.js +5 -0
- package/dist/translations/sq.umd.js +11 -0
- package/dist/translations/sr-latn.d.ts +8 -0
- package/dist/translations/sr-latn.js +5 -0
- package/dist/translations/sr-latn.umd.js +11 -0
- package/dist/translations/sr.d.ts +8 -0
- package/dist/translations/sr.js +5 -0
- package/dist/translations/sr.umd.js +11 -0
- package/dist/translations/sv.d.ts +8 -0
- package/dist/translations/sv.js +5 -0
- package/dist/translations/sv.umd.js +11 -0
- package/dist/translations/th.d.ts +8 -0
- package/dist/translations/th.js +5 -0
- package/dist/translations/th.umd.js +11 -0
- package/dist/translations/ti.d.ts +8 -0
- package/dist/translations/ti.js +5 -0
- package/dist/translations/ti.umd.js +11 -0
- package/dist/translations/tk.d.ts +8 -0
- package/dist/translations/tk.js +5 -0
- package/dist/translations/tk.umd.js +11 -0
- package/dist/translations/tr.d.ts +8 -0
- package/dist/translations/tr.js +5 -0
- package/dist/translations/tr.umd.js +11 -0
- package/dist/translations/tt.d.ts +8 -0
- package/dist/translations/tt.js +5 -0
- package/dist/translations/tt.umd.js +11 -0
- package/dist/translations/ug.d.ts +8 -0
- package/dist/translations/ug.js +5 -0
- package/dist/translations/ug.umd.js +11 -0
- package/dist/translations/uk.d.ts +8 -0
- package/dist/translations/uk.js +5 -0
- package/dist/translations/uk.umd.js +11 -0
- package/dist/translations/ur.d.ts +8 -0
- package/dist/translations/ur.js +5 -0
- package/dist/translations/ur.umd.js +11 -0
- package/dist/translations/uz.d.ts +8 -0
- package/dist/translations/uz.js +5 -0
- package/dist/translations/uz.umd.js +11 -0
- package/dist/translations/vi.d.ts +8 -0
- package/dist/translations/vi.js +5 -0
- package/dist/translations/vi.umd.js +11 -0
- package/dist/translations/zh-cn.d.ts +8 -0
- package/dist/translations/zh-cn.js +5 -0
- package/dist/translations/zh-cn.umd.js +11 -0
- package/dist/translations/zh.d.ts +8 -0
- package/dist/translations/zh.js +5 -0
- package/dist/translations/zh.umd.js +11 -0
- package/dist/types/arialiveannouncer.d.ts +113 -0
- package/dist/types/augmentation.d.ts +92 -0
- package/dist/types/autocomplete/autocompleteview.d.ts +85 -0
- package/dist/types/bindings/addkeyboardhandlingforgrid.d.ts +31 -0
- package/dist/types/bindings/clickoutsidehandler.d.ts +32 -0
- package/dist/types/bindings/csstransitiondisablermixin.d.ts +44 -0
- package/dist/types/bindings/draggableviewmixin.d.ts +50 -0
- package/dist/types/bindings/injectcsstransitiondisabler.d.ts +63 -0
- package/dist/types/bindings/preventdefault.d.ts +37 -0
- package/dist/types/bindings/submithandler.d.ts +61 -0
- package/dist/types/button/button.d.ts +185 -0
- package/dist/types/button/buttonlabel.d.ts +38 -0
- package/dist/types/button/buttonlabelview.d.ts +35 -0
- package/dist/types/button/buttonview.d.ts +189 -0
- package/dist/types/button/filedialogbuttonview.d.ts +84 -0
- package/dist/types/button/switchbuttonview.d.ts +49 -0
- package/dist/types/collapsible/collapsibleview.d.ts +74 -0
- package/dist/types/colorgrid/colorgridview.d.ts +136 -0
- package/dist/types/colorgrid/colortileview.d.ts +32 -0
- package/dist/types/colorgrid/utils.d.ts +51 -0
- package/dist/types/colorpicker/colorpickerview.d.ts +177 -0
- package/dist/types/colorpicker/utils.d.ts +52 -0
- package/dist/types/colorselector/colorgridsfragmentview.d.ts +199 -0
- package/dist/types/colorselector/colorpickerfragmentview.d.ts +137 -0
- package/dist/types/colorselector/colorselectorview.d.ts +246 -0
- package/dist/types/colorselector/documentcolorcollection.d.ts +74 -0
- package/dist/types/componentfactory.d.ts +85 -0
- package/dist/types/dialog/dialog.d.ts +277 -0
- package/dist/types/dialog/dialogactionsview.d.ts +73 -0
- package/dist/types/dialog/dialogcontentview.d.ts +31 -0
- package/dist/types/dialog/dialogview.d.ts +260 -0
- package/dist/types/dropdown/button/dropdownbutton.d.ts +29 -0
- package/dist/types/dropdown/button/dropdownbuttonview.d.ts +52 -0
- package/dist/types/dropdown/button/splitbuttonview.d.ts +166 -0
- package/dist/types/dropdown/dropdownpanelfocusable.d.ts +25 -0
- package/dist/types/dropdown/dropdownpanelview.d.ts +66 -0
- package/dist/types/dropdown/dropdownview.d.ts +319 -0
- package/dist/types/dropdown/utils.d.ts +239 -0
- package/dist/types/editableui/editableuiview.d.ts +76 -0
- package/dist/types/editableui/inline/inlineeditableuiview.d.ts +44 -0
- package/dist/types/editorui/accessibilityhelp/accessibilityhelp.d.ts +55 -0
- package/dist/types/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +39 -0
- package/dist/types/editorui/bodycollection.d.ts +59 -0
- package/dist/types/editorui/boxed/boxededitoruiview.d.ts +44 -0
- package/dist/types/editorui/editorui.d.ts +292 -0
- package/dist/types/editorui/editoruiview.d.ts +43 -0
- package/dist/types/editorui/poweredby.d.ts +75 -0
- package/dist/types/focuscycler.d.ts +249 -0
- package/dist/types/formheader/formheaderview.d.ts +63 -0
- package/dist/types/highlightedtext/highlightedtextview.d.ts +42 -0
- package/dist/types/icon/iconview.d.ts +92 -0
- package/dist/types/iframe/iframeview.d.ts +54 -0
- package/dist/types/index.d.ts +87 -0
- package/dist/types/input/inputbase.d.ts +123 -0
- package/dist/types/input/inputview.d.ts +40 -0
- package/dist/types/inputnumber/inputnumberview.d.ts +53 -0
- package/dist/types/inputtext/inputtextview.d.ts +22 -0
- package/dist/types/label/labelview.d.ts +40 -0
- package/dist/types/labeledfield/labeledfieldview.d.ts +191 -0
- package/dist/types/labeledfield/utils.d.ts +127 -0
- package/dist/types/labeledinput/labeledinputview.d.ts +129 -0
- package/dist/types/list/listitemgroupview.d.ts +63 -0
- package/dist/types/list/listitemview.d.ts +40 -0
- package/dist/types/list/listseparatorview.d.ts +22 -0
- package/dist/types/list/listview.d.ts +128 -0
- package/dist/types/menubar/menubarmenubuttonview.d.ts +39 -0
- package/dist/types/menubar/menubarmenulistitembuttonview.d.ts +25 -0
- package/dist/types/menubar/menubarmenulistitemfiledialogbuttonview.d.ts +27 -0
- package/dist/types/menubar/menubarmenulistitemview.d.ts +29 -0
- package/dist/types/menubar/menubarmenulistview.d.ts +28 -0
- package/dist/types/menubar/menubarmenupanelview.d.ts +57 -0
- package/dist/types/menubar/menubarmenuview.d.ts +113 -0
- package/dist/types/menubar/menubarview.d.ts +168 -0
- package/dist/types/menubar/utils.d.ts +443 -0
- package/dist/types/model.d.ts +26 -0
- package/dist/types/notification/notification.d.ts +215 -0
- package/dist/types/panel/balloon/balloonpanelview.d.ts +689 -0
- package/dist/types/panel/balloon/contextualballoon.d.ts +303 -0
- package/dist/types/panel/sticky/stickypanelview.d.ts +160 -0
- package/dist/types/search/filteredview.d.ts +35 -0
- package/dist/types/search/searchinfoview.d.ts +49 -0
- package/dist/types/search/searchresultsview.d.ts +58 -0
- package/dist/types/search/text/searchtextqueryview.d.ts +80 -0
- package/dist/types/search/text/searchtextview.d.ts +223 -0
- package/dist/types/spinner/spinnerview.d.ts +29 -0
- package/dist/types/template.d.ts +946 -0
- package/dist/types/textarea/textareaview.d.ts +108 -0
- package/dist/types/toolbar/balloon/balloontoolbar.d.ts +121 -0
- package/dist/types/toolbar/block/blockbuttonview.d.ts +39 -0
- package/dist/types/toolbar/block/blocktoolbar.d.ts +157 -0
- package/dist/types/toolbar/normalizetoolbarconfig.d.ts +44 -0
- package/dist/types/toolbar/toolbarlinebreakview.d.ts +22 -0
- package/dist/types/toolbar/toolbarseparatorview.d.ts +22 -0
- package/dist/types/toolbar/toolbarview.d.ts +271 -0
- package/dist/types/tooltipmanager.d.ts +199 -0
- package/dist/types/view.d.ts +426 -0
- package/dist/types/viewcollection.d.ts +143 -0
- package/lang/contexts.json +2 -1
- package/lang/translations/af.po +4 -0
- package/lang/translations/ar.po +4 -0
- package/lang/translations/ast.po +4 -0
- package/lang/translations/az.po +4 -0
- package/lang/translations/bg.po +4 -0
- package/lang/translations/bn.po +4 -0
- package/lang/translations/bs.po +4 -0
- package/lang/translations/ca.po +4 -0
- package/lang/translations/cs.po +4 -0
- package/lang/translations/da.po +4 -0
- package/lang/translations/de-ch.po +4 -0
- package/lang/translations/de.po +4 -0
- package/lang/translations/el.po +4 -0
- package/lang/translations/en-au.po +4 -0
- package/lang/translations/en-gb.po +4 -0
- package/lang/translations/en.po +4 -0
- package/lang/translations/eo.po +4 -0
- package/lang/translations/es-co.po +4 -0
- package/lang/translations/es.po +4 -0
- package/lang/translations/et.po +4 -0
- package/lang/translations/eu.po +4 -0
- package/lang/translations/fa.po +4 -0
- package/lang/translations/fi.po +4 -0
- package/lang/translations/fr.po +4 -0
- package/lang/translations/gl.po +4 -0
- package/lang/translations/he.po +4 -0
- package/lang/translations/hi.po +4 -0
- package/lang/translations/hr.po +4 -0
- package/lang/translations/hu.po +4 -0
- package/lang/translations/id.po +4 -0
- package/lang/translations/it.po +4 -0
- package/lang/translations/ja.po +4 -0
- package/lang/translations/jv.po +4 -0
- package/lang/translations/km.po +4 -0
- package/lang/translations/kn.po +4 -0
- package/lang/translations/ko.po +4 -0
- package/lang/translations/ku.po +4 -0
- package/lang/translations/lt.po +4 -0
- package/lang/translations/lv.po +4 -0
- package/lang/translations/ms.po +4 -0
- package/lang/translations/nb.po +4 -0
- package/lang/translations/ne.po +4 -0
- package/lang/translations/nl.po +4 -0
- package/lang/translations/no.po +4 -0
- package/lang/translations/pl.po +4 -0
- package/lang/translations/pt-br.po +4 -0
- package/lang/translations/pt.po +4 -0
- package/lang/translations/ro.po +4 -0
- package/lang/translations/ru.po +4 -0
- package/lang/translations/sk.po +4 -0
- package/lang/translations/sl.po +4 -0
- package/lang/translations/sq.po +4 -0
- package/lang/translations/sr-latn.po +4 -0
- package/lang/translations/sr.po +4 -0
- package/lang/translations/sv.po +4 -0
- package/lang/translations/th.po +4 -0
- package/lang/translations/ti.po +214 -0
- package/lang/translations/tk.po +4 -0
- package/lang/translations/tr.po +4 -0
- package/lang/translations/tt.po +4 -0
- package/lang/translations/ug.po +4 -0
- package/lang/translations/uk.po +4 -0
- package/lang/translations/ur.po +4 -0
- package/lang/translations/uz.po +4 -0
- package/lang/translations/vi.po +4 -0
- package/lang/translations/zh-cn.po +4 -0
- package/lang/translations/zh.po +4 -0
- package/package.json +4 -3
- package/src/arialiveannouncer.d.ts +34 -23
- package/src/arialiveannouncer.js +80 -30
- package/src/colorgrid/colortileview.d.ts +1 -1
- package/src/colorgrid/colortileview.js +3 -1
- package/src/colorpicker/colorpickerview.d.ts +32 -1
- package/src/colorpicker/colorpickerview.js +62 -13
- package/src/colorselector/colorpickerfragmentview.d.ts +4 -0
- package/src/colorselector/colorpickerfragmentview.js +13 -5
- package/src/colorselector/colorselectorview.js +1 -0
- package/src/index.d.ts +4 -4
- package/src/index.js +3 -2
- package/src/menubar/utils.d.ts +8 -1
- package/src/menubar/utils.js +26 -2
- package/src/toolbar/toolbarview.js +2 -3
- package/theme/components/arialiveannouncer/arialiveannouncer.css +4 -0
- package/theme/components/tooltip/tooltip.css +4 -0
- package/theme/globals/globals.css +0 -1
- package/theme/mixins/_mediacolors.css +20 -0
- package/theme/globals/_reset.css +0 -13
package/lang/translations/tt.po
CHANGED
|
@@ -208,3 +208,7 @@ msgstr ""
|
|
|
208
208
|
msgctxt "The accessible label of the editor menu bar used by assistive technologies."
|
|
209
209
|
msgid "Editor menu bar"
|
|
210
210
|
msgstr ""
|
|
211
|
+
|
|
212
|
+
msgctxt "An error text displayed when user attempted to enter an color that is not in HEX format."
|
|
213
|
+
msgid "Please enter a valid color (e.g. \"ff0000\")."
|
|
214
|
+
msgstr ""
|
package/lang/translations/ug.po
CHANGED
|
@@ -208,3 +208,7 @@ msgstr ""
|
|
|
208
208
|
msgctxt "The accessible label of the editor menu bar used by assistive technologies."
|
|
209
209
|
msgid "Editor menu bar"
|
|
210
210
|
msgstr ""
|
|
211
|
+
|
|
212
|
+
msgctxt "An error text displayed when user attempted to enter an color that is not in HEX format."
|
|
213
|
+
msgid "Please enter a valid color (e.g. \"ff0000\")."
|
|
214
|
+
msgstr ""
|
package/lang/translations/uk.po
CHANGED
|
@@ -208,3 +208,7 @@ msgstr "Шрифт"
|
|
|
208
208
|
msgctxt "The accessible label of the editor menu bar used by assistive technologies."
|
|
209
209
|
msgid "Editor menu bar"
|
|
210
210
|
msgstr "Рядок меню редагування"
|
|
211
|
+
|
|
212
|
+
msgctxt "An error text displayed when user attempted to enter an color that is not in HEX format."
|
|
213
|
+
msgid "Please enter a valid color (e.g. \"ff0000\")."
|
|
214
|
+
msgstr "Будь ласка, введіть дійсний колір (напр. \"ff0000\")."
|
package/lang/translations/ur.po
CHANGED
|
@@ -208,3 +208,7 @@ msgstr ""
|
|
|
208
208
|
msgctxt "The accessible label of the editor menu bar used by assistive technologies."
|
|
209
209
|
msgid "Editor menu bar"
|
|
210
210
|
msgstr ""
|
|
211
|
+
|
|
212
|
+
msgctxt "An error text displayed when user attempted to enter an color that is not in HEX format."
|
|
213
|
+
msgid "Please enter a valid color (e.g. \"ff0000\")."
|
|
214
|
+
msgstr ""
|
package/lang/translations/uz.po
CHANGED
|
@@ -208,3 +208,7 @@ msgstr ""
|
|
|
208
208
|
msgctxt "The accessible label of the editor menu bar used by assistive technologies."
|
|
209
209
|
msgid "Editor menu bar"
|
|
210
210
|
msgstr ""
|
|
211
|
+
|
|
212
|
+
msgctxt "An error text displayed when user attempted to enter an color that is not in HEX format."
|
|
213
|
+
msgid "Please enter a valid color (e.g. \"ff0000\")."
|
|
214
|
+
msgstr ""
|
package/lang/translations/vi.po
CHANGED
|
@@ -208,3 +208,7 @@ msgstr "Phông chữ"
|
|
|
208
208
|
msgctxt "The accessible label of the editor menu bar used by assistive technologies."
|
|
209
209
|
msgid "Editor menu bar"
|
|
210
210
|
msgstr "Thanh menu Trình soạn thảo"
|
|
211
|
+
|
|
212
|
+
msgctxt "An error text displayed when user attempted to enter an color that is not in HEX format."
|
|
213
|
+
msgid "Please enter a valid color (e.g. \"ff0000\")."
|
|
214
|
+
msgstr "Vui lòng nhập một màu sắc hợp lệ (ví dụ: \"ff0000\")."
|
|
@@ -208,3 +208,7 @@ msgstr "字体"
|
|
|
208
208
|
msgctxt "The accessible label of the editor menu bar used by assistive technologies."
|
|
209
209
|
msgid "Editor menu bar"
|
|
210
210
|
msgstr "编辑器菜单栏"
|
|
211
|
+
|
|
212
|
+
msgctxt "An error text displayed when user attempted to enter an color that is not in HEX format."
|
|
213
|
+
msgid "Please enter a valid color (e.g. \"ff0000\")."
|
|
214
|
+
msgstr "请输入有效的颜色(例如“ff0000”)。"
|
package/lang/translations/zh.po
CHANGED
|
@@ -208,3 +208,7 @@ msgstr "字型"
|
|
|
208
208
|
msgctxt "The accessible label of the editor menu bar used by assistive technologies."
|
|
209
209
|
msgid "Editor menu bar"
|
|
210
210
|
msgstr "編輯器選單列"
|
|
211
|
+
|
|
212
|
+
msgctxt "An error text displayed when user attempted to enter an color that is not in HEX format."
|
|
213
|
+
msgid "Please enter a valid color (e.g. \"ff0000\")."
|
|
214
|
+
msgstr "請輸入有效的顏色(例如「ff0000」)。"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ckeditor/ckeditor5-ui",
|
|
3
|
-
"version": "41.
|
|
3
|
+
"version": "41.4.0",
|
|
4
4
|
"description": "The UI framework and standard UI library of CKEditor 5.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ckeditor",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"type": "module",
|
|
13
13
|
"main": "src/index.js",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@ckeditor/ckeditor5-core": "41.
|
|
16
|
-
"@ckeditor/ckeditor5-utils": "41.
|
|
15
|
+
"@ckeditor/ckeditor5-core": "41.4.0",
|
|
16
|
+
"@ckeditor/ckeditor5-utils": "41.4.0",
|
|
17
17
|
"color-convert": "2.0.1",
|
|
18
18
|
"color-parse": "1.4.2",
|
|
19
19
|
"lodash-es": "4.17.21",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
"directory": "packages/ckeditor5-ui"
|
|
30
30
|
},
|
|
31
31
|
"files": [
|
|
32
|
+
"dist",
|
|
32
33
|
"lang",
|
|
33
34
|
"src/**/*.js",
|
|
34
35
|
"src/**/*.d.ts",
|
|
@@ -2,9 +2,6 @@
|
|
|
2
2
|
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
3
|
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
6
|
-
* @module ui/arialiveannouncer
|
|
7
|
-
*/
|
|
8
5
|
import type { Editor } from '@ckeditor/ckeditor5-core';
|
|
9
6
|
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
7
|
import type ViewCollection from './viewcollection.js';
|
|
@@ -30,9 +27,10 @@ export declare const AriaLiveAnnouncerPoliteness: {
|
|
|
30
27
|
* These announcements are consumed and propagated by screen readers and give users a better understanding of the current
|
|
31
28
|
* state of the editor.
|
|
32
29
|
*
|
|
33
|
-
* To announce a state change to an editor
|
|
30
|
+
* To announce a state change to an editor use the {@link #announce} method:
|
|
31
|
+
*
|
|
34
32
|
* ```ts
|
|
35
|
-
* editor.ui.ariaLiveAnnouncer.announce( '
|
|
33
|
+
* editor.ui.ariaLiveAnnouncer.announce( 'Text of an announcement.' );
|
|
36
34
|
* ```
|
|
37
35
|
*/
|
|
38
36
|
export default class AriaLiveAnnouncer {
|
|
@@ -49,24 +47,19 @@ export default class AriaLiveAnnouncer {
|
|
|
49
47
|
*/
|
|
50
48
|
constructor(editor: Editor);
|
|
51
49
|
/**
|
|
52
|
-
* Sets an announcement text to an aria region
|
|
53
|
-
* announced by a screen reader to the user.
|
|
54
|
-
*
|
|
55
|
-
* If the aria region of a given name does not exist, it will be created and can be re-used later. The name of the region
|
|
56
|
-
* groups announcements originating from a specific editor feature and does not get announced by a screen reader.
|
|
50
|
+
* Sets an announcement text to an aria region that is then announced by a screen reader to the user.
|
|
57
51
|
*
|
|
58
|
-
*
|
|
59
|
-
* are captured by a screen reader and read out in the order they were emitted.
|
|
52
|
+
* If the aria region of a specified politeness does not exist, it will be created and can be re-used later.
|
|
60
53
|
*
|
|
61
54
|
* The default announcement politeness level is `'polite'`.
|
|
62
55
|
*
|
|
63
56
|
* ```ts
|
|
64
57
|
* // Most screen readers will queue announcements from multiple aria-live regions and read them out in the order they were emitted.
|
|
65
|
-
* editor.ui.ariaLiveAnnouncer.announce( '
|
|
66
|
-
* editor.ui.ariaLiveAnnouncer.announce( '
|
|
58
|
+
* editor.ui.ariaLiveAnnouncer.announce( 'Image uploaded.' );
|
|
59
|
+
* editor.ui.ariaLiveAnnouncer.announce( 'Connection lost. Reconnecting.' );
|
|
67
60
|
* ```
|
|
68
61
|
*/
|
|
69
|
-
announce(
|
|
62
|
+
announce(announcement: string, attributes?: AriaLiveAnnouncerPolitenessValue | AriaLiveAnnounceConfig): void;
|
|
70
63
|
}
|
|
71
64
|
/**
|
|
72
65
|
* The view that aggregates all `aria-live` regions.
|
|
@@ -79,20 +72,38 @@ export declare class AriaLiveAnnouncerView extends View {
|
|
|
79
72
|
constructor(locale: Locale);
|
|
80
73
|
}
|
|
81
74
|
/**
|
|
82
|
-
* The view that represents a single `aria-live
|
|
75
|
+
* The view that represents a single `aria-live`.
|
|
83
76
|
*/
|
|
84
77
|
export declare class AriaLiveAnnouncerRegionView extends View {
|
|
85
78
|
/**
|
|
86
|
-
* Current
|
|
79
|
+
* Current politeness level of the region.
|
|
87
80
|
*/
|
|
88
|
-
|
|
81
|
+
readonly politeness: AriaLiveAnnouncerPolitenessValue;
|
|
89
82
|
/**
|
|
90
|
-
*
|
|
83
|
+
* DOM converter used to sanitize unsafe HTML passed to {@link #announce} method.
|
|
91
84
|
*/
|
|
92
|
-
|
|
85
|
+
private _domConverter;
|
|
93
86
|
/**
|
|
94
|
-
*
|
|
87
|
+
* Interval used to remove additions. It prevents accumulation of added nodes in region.
|
|
95
88
|
*/
|
|
96
|
-
|
|
97
|
-
constructor(
|
|
89
|
+
private _pruneAnnouncementsInterval;
|
|
90
|
+
constructor(editor: Editor, politeness: AriaLiveAnnouncerPolitenessValue);
|
|
91
|
+
/**
|
|
92
|
+
* Appends new announcement to region.
|
|
93
|
+
*/
|
|
94
|
+
announce({ announcement, isUnsafeHTML }: AriaLiveAppendContentAttributes): void;
|
|
95
|
+
/**
|
|
96
|
+
* Return current announcements list HTML element.
|
|
97
|
+
*/
|
|
98
|
+
private get _listElement();
|
|
98
99
|
}
|
|
100
|
+
type AriaLiveAnnouncerPolitenessValue = typeof AriaLiveAnnouncerPoliteness[keyof typeof AriaLiveAnnouncerPoliteness];
|
|
101
|
+
type AriaLiveAppendContentAttributes = {
|
|
102
|
+
announcement: string;
|
|
103
|
+
isUnsafeHTML?: boolean;
|
|
104
|
+
};
|
|
105
|
+
type AriaLiveAnnounceConfig = {
|
|
106
|
+
politeness: AriaLiveAnnouncerPolitenessValue;
|
|
107
|
+
isUnsafeHTML?: boolean;
|
|
108
|
+
};
|
|
109
|
+
export {};
|
package/src/arialiveannouncer.js
CHANGED
|
@@ -24,9 +24,10 @@ export const AriaLiveAnnouncerPoliteness = {
|
|
|
24
24
|
* These announcements are consumed and propagated by screen readers and give users a better understanding of the current
|
|
25
25
|
* state of the editor.
|
|
26
26
|
*
|
|
27
|
-
* To announce a state change to an editor
|
|
27
|
+
* To announce a state change to an editor use the {@link #announce} method:
|
|
28
|
+
*
|
|
28
29
|
* ```ts
|
|
29
|
-
* editor.ui.ariaLiveAnnouncer.announce( '
|
|
30
|
+
* editor.ui.ariaLiveAnnouncer.announce( 'Text of an announcement.' );
|
|
30
31
|
* ```
|
|
31
32
|
*/
|
|
32
33
|
export default class AriaLiveAnnouncer {
|
|
@@ -35,40 +36,50 @@ export default class AriaLiveAnnouncer {
|
|
|
35
36
|
*/
|
|
36
37
|
constructor(editor) {
|
|
37
38
|
this.editor = editor;
|
|
39
|
+
/**
|
|
40
|
+
* Some screen readers only look at changes in the aria-live region.
|
|
41
|
+
* They might not read a region that already has content when it is added.
|
|
42
|
+
* To stop this problem, make sure to set up regions for all politeness settings when the editor starts.
|
|
43
|
+
*/
|
|
44
|
+
editor.once('ready', () => {
|
|
45
|
+
for (const politeness of Object.values(AriaLiveAnnouncerPoliteness)) {
|
|
46
|
+
this.announce('', politeness);
|
|
47
|
+
}
|
|
48
|
+
});
|
|
38
49
|
}
|
|
39
50
|
/**
|
|
40
|
-
* Sets an announcement text to an aria region
|
|
41
|
-
* announced by a screen reader to the user.
|
|
51
|
+
* Sets an announcement text to an aria region that is then announced by a screen reader to the user.
|
|
42
52
|
*
|
|
43
|
-
* If the aria region of a
|
|
44
|
-
* groups announcements originating from a specific editor feature and does not get announced by a screen reader.
|
|
45
|
-
*
|
|
46
|
-
* Using multiple regions allows for many announcements to be emitted in a short period of time. Changes to ARIA-live announcements
|
|
47
|
-
* are captured by a screen reader and read out in the order they were emitted.
|
|
53
|
+
* If the aria region of a specified politeness does not exist, it will be created and can be re-used later.
|
|
48
54
|
*
|
|
49
55
|
* The default announcement politeness level is `'polite'`.
|
|
50
56
|
*
|
|
51
57
|
* ```ts
|
|
52
58
|
* // Most screen readers will queue announcements from multiple aria-live regions and read them out in the order they were emitted.
|
|
53
|
-
* editor.ui.ariaLiveAnnouncer.announce( '
|
|
54
|
-
* editor.ui.ariaLiveAnnouncer.announce( '
|
|
59
|
+
* editor.ui.ariaLiveAnnouncer.announce( 'Image uploaded.' );
|
|
60
|
+
* editor.ui.ariaLiveAnnouncer.announce( 'Connection lost. Reconnecting.' );
|
|
55
61
|
* ```
|
|
56
62
|
*/
|
|
57
|
-
announce(
|
|
63
|
+
announce(announcement, attributes = AriaLiveAnnouncerPoliteness.POLITE) {
|
|
58
64
|
const editor = this.editor;
|
|
65
|
+
if (!editor.ui.view) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
59
68
|
if (!this.view) {
|
|
60
69
|
this.view = new AriaLiveAnnouncerView(editor.locale);
|
|
61
70
|
editor.ui.view.body.add(this.view);
|
|
62
71
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
const { politeness, isUnsafeHTML } = typeof attributes === 'string' ? {
|
|
73
|
+
politeness: attributes
|
|
74
|
+
} : attributes;
|
|
75
|
+
let politenessRegionView = this.view.regionViews.find(view => view.politeness === politeness);
|
|
76
|
+
if (!politenessRegionView) {
|
|
77
|
+
politenessRegionView = new AriaLiveAnnouncerRegionView(editor, politeness);
|
|
78
|
+
this.view.regionViews.add(politenessRegionView);
|
|
67
79
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
politeness
|
|
80
|
+
politenessRegionView.announce({
|
|
81
|
+
announcement,
|
|
82
|
+
isUnsafeHTML
|
|
72
83
|
});
|
|
73
84
|
}
|
|
74
85
|
}
|
|
@@ -92,25 +103,64 @@ export class AriaLiveAnnouncerView extends View {
|
|
|
92
103
|
}
|
|
93
104
|
}
|
|
94
105
|
/**
|
|
95
|
-
* The view that represents a single `aria-live
|
|
106
|
+
* The view that represents a single `aria-live`.
|
|
96
107
|
*/
|
|
97
108
|
export class AriaLiveAnnouncerRegionView extends View {
|
|
98
|
-
constructor(
|
|
99
|
-
super(locale);
|
|
100
|
-
const bind = this.bindTemplate;
|
|
101
|
-
this.set('regionName', '');
|
|
102
|
-
this.set('text', '');
|
|
103
|
-
this.set('politeness', AriaLiveAnnouncerPoliteness.POLITE);
|
|
109
|
+
constructor(editor, politeness) {
|
|
110
|
+
super(editor.locale);
|
|
104
111
|
this.setTemplate({
|
|
105
112
|
tag: 'div',
|
|
106
113
|
attributes: {
|
|
107
114
|
role: 'region',
|
|
108
|
-
'
|
|
109
|
-
'aria-
|
|
115
|
+
'aria-live': politeness,
|
|
116
|
+
'aria-relevant': 'additions'
|
|
110
117
|
},
|
|
111
118
|
children: [
|
|
112
|
-
{
|
|
119
|
+
{
|
|
120
|
+
tag: 'ul',
|
|
121
|
+
attributes: {
|
|
122
|
+
class: [
|
|
123
|
+
'ck',
|
|
124
|
+
'ck-aria-live-region-list'
|
|
125
|
+
]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
113
128
|
]
|
|
114
129
|
});
|
|
130
|
+
editor.on('destroy', () => {
|
|
131
|
+
if (this._pruneAnnouncementsInterval !== null) {
|
|
132
|
+
clearInterval(this._pruneAnnouncementsInterval);
|
|
133
|
+
this._pruneAnnouncementsInterval = null;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
this.politeness = politeness;
|
|
137
|
+
this._domConverter = editor.data.htmlProcessor.domConverter;
|
|
138
|
+
this._pruneAnnouncementsInterval = setInterval(() => {
|
|
139
|
+
if (this.element && this._listElement.firstChild) {
|
|
140
|
+
this._listElement.firstChild.remove();
|
|
141
|
+
}
|
|
142
|
+
}, 5000);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Appends new announcement to region.
|
|
146
|
+
*/
|
|
147
|
+
announce({ announcement, isUnsafeHTML }) {
|
|
148
|
+
if (!announcement.trim().length) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
const messageListItem = document.createElement('li');
|
|
152
|
+
if (isUnsafeHTML) {
|
|
153
|
+
this._domConverter.setContentOf(messageListItem, announcement);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
messageListItem.innerText = announcement;
|
|
157
|
+
}
|
|
158
|
+
this._listElement.appendChild(messageListItem);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Return current announcements list HTML element.
|
|
162
|
+
*/
|
|
163
|
+
get _listElement() {
|
|
164
|
+
return this.element.querySelector('ul');
|
|
115
165
|
}
|
|
116
166
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* @module ui/colorgrid/colortileview
|
|
7
7
|
*/
|
|
8
8
|
import ButtonView from '../button/buttonview.js';
|
|
9
|
-
import type
|
|
9
|
+
import { type Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
/**
|
|
11
11
|
* This class represents a single color tile in the {@link module:ui/colorgrid/colorgridview~ColorGridView}.
|
|
12
12
|
*/
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* @module ui/colorgrid/colortileview
|
|
7
7
|
*/
|
|
8
8
|
import ButtonView from '../button/buttonview.js';
|
|
9
|
+
import { env } from '@ckeditor/ckeditor5-utils';
|
|
9
10
|
import checkIcon from '../../theme/icons/color-tile-check.svg';
|
|
10
11
|
/**
|
|
11
12
|
* This class represents a single color tile in the {@link module:ui/colorgrid/colorgridview~ColorGridView}.
|
|
@@ -20,7 +21,8 @@ export default class ColorTileView extends ButtonView {
|
|
|
20
21
|
this.extendTemplate({
|
|
21
22
|
attributes: {
|
|
22
23
|
style: {
|
|
23
|
-
|
|
24
|
+
// https://github.com/ckeditor/ckeditor5/issues/14907
|
|
25
|
+
backgroundColor: bind.to('color', color => env.isMediaForcedColors ? null : color)
|
|
24
26
|
},
|
|
25
27
|
class: [
|
|
26
28
|
'ck',
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
* @module ui/colorpicker/colorpickerview
|
|
7
7
|
*/
|
|
8
8
|
import { type ColorPickerViewConfig } from './utils.js';
|
|
9
|
+
import type { HexColor } from '@ckeditor/ckeditor5-core';
|
|
9
10
|
import { type Locale } from '@ckeditor/ckeditor5-utils';
|
|
10
11
|
import View from '../view.js';
|
|
12
|
+
import type InputTextView from '../inputtext/inputtextview.js';
|
|
11
13
|
import type ViewCollection from '../viewcollection.js';
|
|
14
|
+
import LabeledFieldView from '../labeledfield/labeledfieldview.js';
|
|
12
15
|
import { HexBase } from 'vanilla-colorful/lib/entrypoints/hex';
|
|
13
16
|
import '../../theme/components/colorpicker/colorpicker.css';
|
|
14
17
|
declare global {
|
|
@@ -98,6 +101,17 @@ export default class ColorPickerView extends View {
|
|
|
98
101
|
* @private
|
|
99
102
|
*/
|
|
100
103
|
private _createColorInput;
|
|
104
|
+
/**
|
|
105
|
+
* Validates the view and returns `false` when some fields are invalid.
|
|
106
|
+
*/
|
|
107
|
+
isValid(): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Cleans up the supplementary error and information text of input inside the {@link #hexInputRow}
|
|
110
|
+
* bringing them back to the state when the form has been displayed for the first time.
|
|
111
|
+
*
|
|
112
|
+
* See {@link #isValid}.
|
|
113
|
+
*/
|
|
114
|
+
resetValidationStatus(): void;
|
|
101
115
|
}
|
|
102
116
|
declare class SliderView extends View {
|
|
103
117
|
/**
|
|
@@ -114,12 +128,21 @@ declare class ColorPickerInputRowView extends View {
|
|
|
114
128
|
* A collection of row items (buttons, dropdowns, etc.).
|
|
115
129
|
*/
|
|
116
130
|
readonly children: ViewCollection;
|
|
131
|
+
/**
|
|
132
|
+
* Hex input view element.
|
|
133
|
+
*/
|
|
134
|
+
readonly inputView: LabeledFieldView<InputTextView>;
|
|
117
135
|
/**
|
|
118
136
|
* Creates an instance of the form row class.
|
|
119
137
|
*
|
|
120
138
|
* @param locale The locale instance.
|
|
139
|
+
* @param inputView Hex color input element.
|
|
140
|
+
*/
|
|
141
|
+
constructor(locale: Locale, inputView: LabeledFieldView<InputTextView>);
|
|
142
|
+
/**
|
|
143
|
+
* Returns false if color input value is not in hex format.
|
|
121
144
|
*/
|
|
122
|
-
|
|
145
|
+
getParsedColor(): HexColor | null;
|
|
123
146
|
}
|
|
124
147
|
/**
|
|
125
148
|
* An event fired whenever the color was selected through the color picker palette
|
|
@@ -139,4 +162,12 @@ export type ColorPickerColorSelectedEvent = {
|
|
|
139
162
|
}
|
|
140
163
|
];
|
|
141
164
|
};
|
|
165
|
+
/**
|
|
166
|
+
* Trim spaces from provided color and check if hex is valid.
|
|
167
|
+
*
|
|
168
|
+
* @param color Unsafe color string.
|
|
169
|
+
* @returns Null if provided color is not hex value.
|
|
170
|
+
* @export
|
|
171
|
+
*/
|
|
172
|
+
export declare function tryParseHexColor<S extends string>(color: S | null | undefined): HexColor<S> | null;
|
|
142
173
|
export {};
|
|
@@ -150,9 +150,8 @@ export default class ColorPickerView extends View {
|
|
|
150
150
|
* @private
|
|
151
151
|
*/
|
|
152
152
|
_createInputRow() {
|
|
153
|
-
const hashView = new HashView();
|
|
154
153
|
const colorInput = this._createColorInput();
|
|
155
|
-
return new ColorPickerInputRowView(this.locale,
|
|
154
|
+
return new ColorPickerInputRowView(this.locale, colorInput);
|
|
156
155
|
}
|
|
157
156
|
/**
|
|
158
157
|
* Creates the input where user can type or paste the color in hex format.
|
|
@@ -180,22 +179,39 @@ export default class ColorPickerView extends View {
|
|
|
180
179
|
labeledInput.fieldView.on('input', () => {
|
|
181
180
|
const inputValue = labeledInput.fieldView.element.value;
|
|
182
181
|
if (inputValue) {
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
// Drop the `#` from the beginning if present.
|
|
186
|
-
const hashlessInput = trimmedValue.startsWith('#') ? trimmedValue.substring(1) : trimmedValue;
|
|
187
|
-
// Check if it's a hex color (3,4,6 or 8 chars long and with proper characters).
|
|
188
|
-
const isValidHexColor = [3, 4, 6, 8].includes(hashlessInput.length) &&
|
|
189
|
-
/(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})/.test(hashlessInput);
|
|
190
|
-
if (isValidHexColor) {
|
|
182
|
+
const maybeHexColor = tryParseHexColor(inputValue);
|
|
183
|
+
if (maybeHexColor) {
|
|
191
184
|
// If so, set the color.
|
|
192
185
|
// Otherwise, do nothing.
|
|
193
|
-
this._debounceColorPickerEvent(
|
|
186
|
+
this._debounceColorPickerEvent(maybeHexColor);
|
|
194
187
|
}
|
|
195
188
|
}
|
|
196
189
|
});
|
|
197
190
|
return labeledInput;
|
|
198
191
|
}
|
|
192
|
+
/**
|
|
193
|
+
* Validates the view and returns `false` when some fields are invalid.
|
|
194
|
+
*/
|
|
195
|
+
isValid() {
|
|
196
|
+
const { t } = this.locale;
|
|
197
|
+
this.resetValidationStatus();
|
|
198
|
+
// One error per field is enough.
|
|
199
|
+
if (!this.hexInputRow.getParsedColor()) {
|
|
200
|
+
// Apply updated error.
|
|
201
|
+
this.hexInputRow.inputView.errorText = t('Please enter a valid color (e.g. "ff0000").');
|
|
202
|
+
return false;
|
|
203
|
+
}
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Cleans up the supplementary error and information text of input inside the {@link #hexInputRow}
|
|
208
|
+
* bringing them back to the state when the form has been displayed for the first time.
|
|
209
|
+
*
|
|
210
|
+
* See {@link #isValid}.
|
|
211
|
+
*/
|
|
212
|
+
resetValidationStatus() {
|
|
213
|
+
this.hexInputRow.inputView.errorText = null;
|
|
214
|
+
}
|
|
199
215
|
}
|
|
200
216
|
// Converts any color format to a unified hex format.
|
|
201
217
|
//
|
|
@@ -254,10 +270,15 @@ class ColorPickerInputRowView extends View {
|
|
|
254
270
|
* Creates an instance of the form row class.
|
|
255
271
|
*
|
|
256
272
|
* @param locale The locale instance.
|
|
273
|
+
* @param inputView Hex color input element.
|
|
257
274
|
*/
|
|
258
|
-
constructor(locale,
|
|
275
|
+
constructor(locale, inputView) {
|
|
259
276
|
super(locale);
|
|
260
|
-
this.
|
|
277
|
+
this.inputView = inputView;
|
|
278
|
+
this.children = this.createCollection([
|
|
279
|
+
new HashView(),
|
|
280
|
+
this.inputView
|
|
281
|
+
]);
|
|
261
282
|
this.setTemplate({
|
|
262
283
|
tag: 'div',
|
|
263
284
|
attributes: {
|
|
@@ -269,4 +290,32 @@ class ColorPickerInputRowView extends View {
|
|
|
269
290
|
children: this.children
|
|
270
291
|
});
|
|
271
292
|
}
|
|
293
|
+
/**
|
|
294
|
+
* Returns false if color input value is not in hex format.
|
|
295
|
+
*/
|
|
296
|
+
getParsedColor() {
|
|
297
|
+
return tryParseHexColor(this.inputView.fieldView.element.value);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Trim spaces from provided color and check if hex is valid.
|
|
302
|
+
*
|
|
303
|
+
* @param color Unsafe color string.
|
|
304
|
+
* @returns Null if provided color is not hex value.
|
|
305
|
+
* @export
|
|
306
|
+
*/
|
|
307
|
+
export function tryParseHexColor(color) {
|
|
308
|
+
if (!color) {
|
|
309
|
+
return null;
|
|
310
|
+
}
|
|
311
|
+
const hashLessColor = color.trim().replace(/^#/, '');
|
|
312
|
+
// Incorrect length.
|
|
313
|
+
if (![3, 4, 6, 8].includes(hashLessColor.length)) {
|
|
314
|
+
return null;
|
|
315
|
+
}
|
|
316
|
+
// Incorrect characters.
|
|
317
|
+
if (!/^(([0-9a-fA-F]{2}){3,4}|([0-9a-fA-F]){3,4})$/.test(hashLessColor)) {
|
|
318
|
+
return null;
|
|
319
|
+
}
|
|
320
|
+
return `#${hashLessColor}`;
|
|
272
321
|
}
|
|
@@ -101,6 +101,10 @@ export default class ColorPickerFragmentView extends View {
|
|
|
101
101
|
* Focuses the color picker.
|
|
102
102
|
*/
|
|
103
103
|
focus(): void;
|
|
104
|
+
/**
|
|
105
|
+
* Reset validation messages.
|
|
106
|
+
*/
|
|
107
|
+
resetValidationStatus(): void;
|
|
104
108
|
/**
|
|
105
109
|
* When color picker is focused and "enter" is pressed it executes command.
|
|
106
110
|
*/
|
|
@@ -91,12 +91,18 @@ export default class ColorPickerFragmentView extends View {
|
|
|
91
91
|
focus() {
|
|
92
92
|
this.colorPickerView.focus();
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Reset validation messages.
|
|
96
|
+
*/
|
|
97
|
+
resetValidationStatus() {
|
|
98
|
+
this.colorPickerView.resetValidationStatus();
|
|
99
|
+
}
|
|
94
100
|
/**
|
|
95
101
|
* When color picker is focused and "enter" is pressed it executes command.
|
|
96
102
|
*/
|
|
97
103
|
_executeOnEnterPress() {
|
|
98
104
|
this.keystrokes.set('enter', evt => {
|
|
99
|
-
if (this.isVisible && this.focusTracker.focusedElement !== this.cancelButtonView.element) {
|
|
105
|
+
if (this.isVisible && this.focusTracker.focusedElement !== this.cancelButtonView.element && this.colorPickerView.isValid()) {
|
|
100
106
|
this.fire('execute', {
|
|
101
107
|
value: this.selectedColor
|
|
102
108
|
});
|
|
@@ -176,10 +182,12 @@ export default class ColorPickerFragmentView extends View {
|
|
|
176
182
|
label: t('Cancel')
|
|
177
183
|
});
|
|
178
184
|
saveButtonView.on('execute', () => {
|
|
179
|
-
this.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
if (this.colorPickerView.isValid()) {
|
|
186
|
+
this.fire('execute', {
|
|
187
|
+
source: 'colorPickerSaveButton',
|
|
188
|
+
value: this.selectedColor
|
|
189
|
+
});
|
|
190
|
+
}
|
|
183
191
|
});
|
|
184
192
|
cancelButtonView.on('execute', () => {
|
|
185
193
|
this.fire('colorPicker:cancel');
|
|
@@ -176,6 +176,7 @@ export default class ColorSelectorView extends View {
|
|
|
176
176
|
}
|
|
177
177
|
this._isColorPickerFragmentVisible = true;
|
|
178
178
|
this.colorPickerFragmentView.focus();
|
|
179
|
+
this.colorPickerFragmentView.resetValidationStatus();
|
|
179
180
|
this._isColorGridsFragmentVisible = false;
|
|
180
181
|
}
|
|
181
182
|
/**
|