@ckeditor/ckeditor5-ui 40.2.0 → 41.1.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/CHANGELOG.md +8 -8
- package/LICENSE.md +1 -1
- package/lang/contexts.json +3 -1
- package/lang/translations/ar.po +9 -1
- package/lang/translations/ast.po +9 -1
- package/lang/translations/az.po +9 -1
- package/lang/translations/bg.po +9 -1
- package/lang/translations/bn.po +9 -1
- package/lang/translations/ca.po +9 -1
- package/lang/translations/cs.po +9 -1
- package/lang/translations/da.po +9 -1
- package/lang/translations/de-ch.po +9 -1
- package/lang/translations/de.po +9 -1
- package/lang/translations/el.po +9 -1
- package/lang/translations/en-au.po +9 -1
- package/lang/translations/en-gb.po +9 -1
- package/lang/translations/en.po +9 -1
- package/lang/translations/eo.po +9 -1
- package/lang/translations/es.po +14 -6
- package/lang/translations/et.po +9 -1
- package/lang/translations/eu.po +9 -1
- package/lang/translations/fa.po +9 -1
- package/lang/translations/fi.po +9 -1
- package/lang/translations/fr.po +9 -1
- package/lang/translations/gl.po +9 -1
- package/lang/translations/he.po +9 -1
- package/lang/translations/hi.po +9 -1
- package/lang/translations/hr.po +9 -1
- package/lang/translations/hu.po +9 -1
- package/lang/translations/id.po +9 -1
- package/lang/translations/it.po +9 -1
- package/lang/translations/ja.po +9 -1
- package/lang/translations/km.po +9 -1
- package/lang/translations/kn.po +9 -1
- package/lang/translations/ko.po +9 -1
- package/lang/translations/ku.po +9 -1
- package/lang/translations/lt.po +9 -1
- package/lang/translations/lv.po +9 -1
- package/lang/translations/ms.po +9 -1
- package/lang/translations/nb.po +9 -1
- package/lang/translations/ne.po +9 -1
- package/lang/translations/nl.po +9 -1
- package/lang/translations/no.po +9 -1
- package/lang/translations/pl.po +9 -1
- package/lang/translations/pt-br.po +9 -1
- package/lang/translations/pt.po +9 -1
- package/lang/translations/ro.po +9 -1
- package/lang/translations/ru.po +9 -1
- package/lang/translations/sk.po +9 -1
- package/lang/translations/sl.po +9 -1
- package/lang/translations/sq.po +9 -1
- package/lang/translations/sr-latn.po +9 -1
- package/lang/translations/sr.po +9 -1
- package/lang/translations/sv.po +9 -1
- package/lang/translations/th.po +9 -1
- package/lang/translations/tk.po +9 -1
- package/lang/translations/tr.po +9 -1
- package/lang/translations/tt.po +9 -1
- package/lang/translations/ug.po +9 -1
- package/lang/translations/uk.po +9 -1
- package/lang/translations/ur.po +9 -1
- package/lang/translations/uz.po +9 -1
- package/lang/translations/vi.po +9 -1
- package/lang/translations/zh-cn.po +9 -1
- package/lang/translations/zh.po +9 -1
- package/package.json +4 -3
- package/src/arialiveannouncer.d.ts +14 -10
- package/src/arialiveannouncer.js +11 -8
- package/src/augmentation.d.ts +3 -2
- package/src/augmentation.js +1 -1
- package/src/autocomplete/autocompleteview.d.ts +4 -4
- package/src/autocomplete/autocompleteview.js +4 -3
- package/src/bindings/addkeyboardhandlingforgrid.d.ts +2 -2
- package/src/bindings/addkeyboardhandlingforgrid.js +1 -1
- package/src/bindings/clickoutsidehandler.d.ts +1 -1
- package/src/bindings/clickoutsidehandler.js +1 -1
- package/src/bindings/csstransitiondisablermixin.d.ts +2 -2
- package/src/bindings/csstransitiondisablermixin.js +1 -1
- package/src/bindings/draggableviewmixin.d.ts +46 -0
- package/src/bindings/draggableviewmixin.js +144 -0
- package/src/bindings/injectcsstransitiondisabler.d.ts +2 -2
- package/src/bindings/injectcsstransitiondisabler.js +1 -1
- package/src/bindings/preventdefault.d.ts +3 -3
- package/src/bindings/preventdefault.js +1 -1
- package/src/bindings/submithandler.d.ts +2 -2
- package/src/bindings/submithandler.js +1 -1
- package/src/button/button.d.ts +4 -1
- package/src/button/button.js +1 -1
- package/src/button/buttonlabel.d.ts +2 -2
- package/src/button/buttonlabel.js +1 -1
- package/src/button/buttonlabelview.d.ts +3 -3
- package/src/button/buttonlabelview.js +2 -2
- package/src/button/buttonview.d.ts +6 -6
- package/src/button/buttonview.js +4 -4
- package/src/button/switchbuttonview.d.ts +3 -3
- package/src/button/switchbuttonview.js +3 -3
- package/src/collapsible/collapsibleview.d.ts +7 -6
- package/src/collapsible/collapsibleview.js +3 -3
- package/src/colorgrid/colorgridview.d.ts +5 -5
- package/src/colorgrid/colorgridview.js +4 -4
- package/src/colorgrid/colortileview.d.ts +2 -2
- package/src/colorgrid/colortileview.js +2 -2
- package/src/colorgrid/utils.d.ts +1 -1
- package/src/colorgrid/utils.js +1 -1
- package/src/colorpicker/colorpickerview.d.ts +12 -7
- package/src/colorpicker/colorpickerview.js +12 -9
- package/src/colorpicker/utils.d.ts +6 -1
- package/src/colorpicker/utils.js +10 -1
- package/src/colorselector/colorgridsfragmentview.d.ts +9 -8
- package/src/colorselector/colorgridsfragmentview.js +10 -11
- package/src/colorselector/colorpickerfragmentview.d.ts +9 -8
- package/src/colorselector/colorpickerfragmentview.js +7 -8
- package/src/colorselector/colorselectorview.d.ts +9 -9
- package/src/colorselector/colorselectorview.js +6 -6
- package/src/colorselector/documentcolorcollection.d.ts +2 -2
- package/src/colorselector/documentcolorcollection.js +1 -1
- package/src/componentfactory.d.ts +2 -2
- package/src/componentfactory.js +1 -1
- package/src/dialog/dialog.d.ts +273 -0
- package/src/dialog/dialog.js +261 -0
- package/src/dialog/dialogactionsview.d.ts +69 -0
- package/src/dialog/dialogactionsview.js +98 -0
- package/src/dialog/dialogcontentview.d.ts +27 -0
- package/src/dialog/dialogcontentview.js +35 -0
- package/src/dialog/dialogview.d.ts +256 -0
- package/src/dialog/dialogview.js +466 -0
- package/src/dropdown/button/dropdownbutton.d.ts +3 -3
- package/src/dropdown/button/dropdownbutton.js +1 -1
- package/src/dropdown/button/dropdownbuttonview.d.ts +4 -4
- package/src/dropdown/button/dropdownbuttonview.js +3 -3
- package/src/dropdown/button/splitbuttonview.d.ts +7 -7
- package/src/dropdown/button/splitbuttonview.js +3 -3
- package/src/dropdown/dropdownpanelfocusable.d.ts +1 -1
- package/src/dropdown/dropdownpanelfocusable.js +1 -1
- package/src/dropdown/dropdownpanelview.d.ts +4 -4
- package/src/dropdown/dropdownpanelview.js +2 -2
- package/src/dropdown/dropdownview.d.ts +8 -8
- package/src/dropdown/dropdownview.js +5 -4
- package/src/dropdown/utils.d.ts +9 -9
- package/src/dropdown/utils.js +15 -15
- package/src/editableui/editableuiview.d.ts +3 -3
- package/src/editableui/editableuiview.js +2 -2
- package/src/editableui/inline/inlineeditableuiview.d.ts +4 -4
- package/src/editableui/inline/inlineeditableuiview.js +2 -2
- package/src/editorui/bodycollection.d.ts +3 -3
- package/src/editorui/bodycollection.js +3 -3
- package/src/editorui/boxed/boxededitoruiview.d.ts +3 -3
- package/src/editorui/boxed/boxededitoruiview.js +3 -3
- package/src/editorui/editorui.d.ts +7 -7
- package/src/editorui/editorui.js +5 -5
- package/src/editorui/editoruiview.d.ts +4 -4
- package/src/editorui/editoruiview.js +3 -3
- package/src/editorui/poweredby.d.ts +1 -1
- package/src/editorui/poweredby.js +4 -4
- package/src/focuscycler.d.ts +29 -10
- package/src/focuscycler.js +46 -17
- package/src/formheader/formheaderview.d.ts +4 -4
- package/src/formheader/formheaderview.js +3 -3
- package/src/highlightedtext/highlightedtextview.d.ts +2 -2
- package/src/highlightedtext/highlightedtextview.js +2 -2
- package/src/icon/iconview.d.ts +5 -2
- package/src/icon/iconview.js +4 -3
- package/src/iframe/iframeview.d.ts +2 -2
- package/src/iframe/iframeview.js +2 -2
- package/src/index.d.ts +67 -68
- package/src/index.js +63 -65
- package/src/input/inputbase.d.ts +2 -2
- package/src/input/inputbase.js +2 -2
- package/src/input/inputview.d.ts +2 -2
- package/src/input/inputview.js +2 -2
- package/src/inputnumber/inputnumberview.d.ts +2 -2
- package/src/inputnumber/inputnumberview.js +2 -2
- package/src/inputtext/inputtextview.d.ts +2 -2
- package/src/inputtext/inputtextview.js +2 -2
- package/src/label/labelview.d.ts +2 -2
- package/src/label/labelview.js +2 -2
- package/src/labeledfield/labeledfieldview.d.ts +5 -5
- package/src/labeledfield/labeledfieldview.js +3 -3
- package/src/labeledfield/utils.d.ts +14 -14
- package/src/labeledfield/utils.js +13 -13
- package/src/labeledinput/labeledinputview.d.ts +4 -4
- package/src/labeledinput/labeledinputview.js +3 -3
- package/src/list/listitemgroupview.d.ts +5 -5
- package/src/list/listitemgroupview.js +5 -5
- package/src/list/listitemview.d.ts +4 -4
- package/src/list/listitemview.js +2 -2
- package/src/list/listseparatorview.d.ts +2 -2
- package/src/list/listseparatorview.js +2 -2
- package/src/list/listview.d.ts +9 -8
- package/src/list/listview.js +7 -7
- package/src/model.d.ts +1 -1
- package/src/model.js +1 -1
- package/src/notification/notification.d.ts +1 -1
- package/src/notification/notification.js +1 -1
- package/src/panel/balloon/balloonpanelview.d.ts +4 -4
- package/src/panel/balloon/balloonpanelview.js +5 -4
- package/src/panel/balloon/contextualballoon.d.ts +5 -5
- package/src/panel/balloon/contextualballoon.js +7 -9
- package/src/panel/sticky/stickypanelview.d.ts +9 -9
- package/src/panel/sticky/stickypanelview.js +7 -7
- package/src/search/filteredview.d.ts +2 -2
- package/src/search/filteredview.js +1 -1
- package/src/search/searchinfoview.d.ts +3 -3
- package/src/search/searchinfoview.js +2 -2
- package/src/search/searchresultsview.d.ts +5 -5
- package/src/search/searchresultsview.js +3 -3
- package/src/search/text/searchtextqueryview.d.ts +5 -5
- package/src/search/text/searchtextqueryview.js +5 -5
- package/src/search/text/searchtextview.d.ts +12 -12
- package/src/search/text/searchtextview.js +6 -6
- package/src/spinner/spinnerview.d.ts +2 -2
- package/src/spinner/spinnerview.js +2 -2
- package/src/template.d.ts +3 -3
- package/src/template.js +3 -3
- package/src/textarea/textareaview.d.ts +18 -2
- package/src/textarea/textareaview.js +46 -6
- package/src/toolbar/balloon/balloontoolbar.d.ts +3 -3
- package/src/toolbar/balloon/balloontoolbar.js +5 -5
- package/src/toolbar/block/blockbuttonview.d.ts +2 -2
- package/src/toolbar/block/blockbuttonview.js +2 -2
- package/src/toolbar/block/blocktoolbar.d.ts +4 -4
- package/src/toolbar/block/blocktoolbar.js +6 -6
- package/src/toolbar/normalizetoolbarconfig.d.ts +1 -1
- package/src/toolbar/normalizetoolbarconfig.js +1 -1
- package/src/toolbar/toolbarlinebreakview.d.ts +2 -2
- package/src/toolbar/toolbarlinebreakview.js +2 -2
- package/src/toolbar/toolbarseparatorview.d.ts +2 -2
- package/src/toolbar/toolbarseparatorview.js +2 -2
- package/src/toolbar/toolbarview.d.ts +7 -6
- package/src/toolbar/toolbarview.js +17 -15
- package/src/tooltipmanager.d.ts +3 -3
- package/src/tooltipmanager.js +5 -4
- package/src/view.d.ts +3 -3
- package/src/view.js +3 -3
- package/src/viewcollection.d.ts +2 -2
- package/src/viewcollection.js +1 -1
- package/theme/components/arialiveannouncer/arialiveannouncer.css +1 -1
- package/theme/components/autocomplete/autocomplete.css +2 -2
- package/theme/components/button/button.css +1 -1
- package/theme/components/button/switchbutton.css +1 -1
- package/theme/components/collapsible/collapsible.css +1 -1
- package/theme/components/colorgrid/colorgrid.css +1 -1
- package/theme/components/colorpicker/colorpicker.css +1 -1
- package/theme/components/colorselector/colorselector.css +1 -1
- package/theme/components/dialog/dialog.css +39 -0
- package/theme/components/dialog/dialogactions.css +11 -0
- package/theme/components/dropdown/dropdown.css +3 -3
- package/theme/components/dropdown/listdropdown.css +1 -1
- package/theme/components/dropdown/splitbutton.css +1 -1
- package/theme/components/dropdown/toolbardropdown.css +1 -1
- package/theme/components/editorui/editorui.css +1 -1
- package/theme/components/formheader/formheader.css +1 -1
- package/theme/components/highlightedtext/highlightedtext.css +1 -1
- package/theme/components/icon/icon.css +1 -1
- package/theme/components/input/input.css +1 -1
- package/theme/components/label/label.css +1 -1
- package/theme/components/labeledfield/labeledfieldview.css +1 -1
- package/theme/components/labeledinput/labeledinput.css +1 -1
- package/theme/components/list/list.css +1 -1
- package/theme/components/panel/balloonpanel.css +2 -2
- package/theme/components/panel/balloonrotator.css +1 -1
- package/theme/components/panel/fakepanel.css +2 -2
- package/theme/components/panel/stickypanel.css +2 -2
- package/theme/components/responsive-form/responsiveform.css +1 -1
- package/theme/components/search/search.css +1 -1
- package/theme/components/spinner/spinner.css +1 -1
- package/theme/components/textarea/textarea.css +1 -1
- package/theme/components/toolbar/blocktoolbar.css +1 -1
- package/theme/components/toolbar/toolbar.css +1 -1
- package/theme/components/tooltip/tooltip.css +2 -2
- package/theme/globals/_hidden.css +1 -1
- package/theme/globals/_poweredby.css +2 -2
- package/theme/globals/_reset.css +1 -1
- package/theme/globals/_transition.css +1 -1
- package/theme/globals/_zindex.css +3 -2
- package/theme/globals/globals.css +1 -1
- package/theme/mixins/_dir.css +1 -1
- package/theme/mixins/_rwd.css +1 -1
- package/theme/mixins/_unselectable.css +1 -1
- package/theme/icons/color-palette.svg +0 -1
- package/theme/icons/next-arrow.svg +0 -1
- package/theme/icons/previous-arrow.svg +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/dropdown/dropdownview
|
|
7
7
|
*/
|
|
8
|
-
import View from '../view';
|
|
8
|
+
import View from '../view.js';
|
|
9
9
|
import { KeystrokeHandler, FocusTracker, getOptimalPosition } from '@ckeditor/ckeditor5-utils';
|
|
10
10
|
import '../../theme/components/dropdown/dropdown.css';
|
|
11
11
|
/**
|
|
@@ -60,7 +60,7 @@ import '../../theme/components/dropdown/dropdown.css';
|
|
|
60
60
|
* (which should close it) and support for arrow keys inside the panel. Therefore, unless you really know what
|
|
61
61
|
* you do and you really need to do it, it is recommended to use the {@link module:ui/dropdown/utils~createDropdown} helper.
|
|
62
62
|
*/
|
|
63
|
-
|
|
63
|
+
class DropdownView extends View {
|
|
64
64
|
/**
|
|
65
65
|
* Creates an instance of the dropdown.
|
|
66
66
|
*
|
|
@@ -295,7 +295,7 @@ export default class DropdownView extends View {
|
|
|
295
295
|
* [ Button ]
|
|
296
296
|
* ```
|
|
297
297
|
*
|
|
298
|
-
* Positioning functions are compatible with {@link module:utils/dom/position~
|
|
298
|
+
* Positioning functions are compatible with {@link module:utils/dom/position~DomPoint}.
|
|
299
299
|
*
|
|
300
300
|
* The name that position function returns will be reflected in dropdown panel's class that
|
|
301
301
|
* controls its placement. See {@link module:ui/dropdown/dropdownview~DropdownView#panelPosition}
|
|
@@ -377,3 +377,4 @@ DropdownView.defaultPanelPositions = {
|
|
|
377
377
|
* A function used to calculate the optimal position for the dropdown panel.
|
|
378
378
|
*/
|
|
379
379
|
DropdownView._getOptimalPosition = getOptimalPosition;
|
|
380
|
+
export default DropdownView;
|
package/src/dropdown/utils.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
|
-
import DropdownView from './dropdownview';
|
|
6
|
-
import ViewCollection from '../viewcollection';
|
|
7
|
-
import type { default as View } from '../view';
|
|
8
|
-
import type Model from '../model';
|
|
9
|
-
import type DropdownButton from './button/dropdownbutton';
|
|
10
|
-
import type { FocusableView } from '../focuscycler';
|
|
11
|
-
import type { FalsyValue } from '../template';
|
|
5
|
+
import DropdownView from './dropdownview.js';
|
|
6
|
+
import ViewCollection from '../viewcollection.js';
|
|
7
|
+
import type { default as View } from '../view.js';
|
|
8
|
+
import type Model from '../model.js';
|
|
9
|
+
import type DropdownButton from './button/dropdownbutton.js';
|
|
10
|
+
import type { FocusableView } from '../focuscycler.js';
|
|
11
|
+
import type { FalsyValue } from '../template.js';
|
|
12
12
|
import { type Collection, type Locale } from '@ckeditor/ckeditor5-utils';
|
|
13
13
|
import '../../theme/components/dropdown/toolbardropdown.css';
|
|
14
14
|
import '../../theme/components/dropdown/listdropdown.css';
|
|
@@ -137,7 +137,7 @@ export declare function addToolbarToDropdown(dropdownView: DropdownView, buttons
|
|
|
137
137
|
* Adds an instance of {@link module:ui/list/listview~ListView} to a dropdown.
|
|
138
138
|
*
|
|
139
139
|
* ```ts
|
|
140
|
-
* const items = new Collection();
|
|
140
|
+
* const items = new Collection<ListDropdownItemDefinition>();
|
|
141
141
|
*
|
|
142
142
|
* items.add( {
|
|
143
143
|
* type: 'button',
|
package/src/dropdown/utils.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/dropdown/utils
|
|
7
7
|
*/
|
|
8
|
-
import DropdownPanelView from './dropdownpanelview';
|
|
9
|
-
import DropdownView from './dropdownview';
|
|
10
|
-
import DropdownButtonView from './button/dropdownbuttonview';
|
|
11
|
-
import ToolbarView from '../toolbar/toolbarview';
|
|
12
|
-
import ListView from '../list/listview';
|
|
13
|
-
import ListItemView from '../list/listitemview';
|
|
14
|
-
import ListSeparatorView from '../list/listseparatorview';
|
|
15
|
-
import ButtonView from '../button/buttonview';
|
|
16
|
-
import SplitButtonView from './button/splitbuttonview';
|
|
17
|
-
import SwitchButtonView from '../button/switchbuttonview';
|
|
18
|
-
import ViewCollection from '../viewcollection';
|
|
19
|
-
import clickOutsideHandler from '../bindings/clickoutsidehandler';
|
|
8
|
+
import DropdownPanelView from './dropdownpanelview.js';
|
|
9
|
+
import DropdownView from './dropdownview.js';
|
|
10
|
+
import DropdownButtonView from './button/dropdownbuttonview.js';
|
|
11
|
+
import ToolbarView from '../toolbar/toolbarview.js';
|
|
12
|
+
import ListView from '../list/listview.js';
|
|
13
|
+
import ListItemView from '../list/listitemview.js';
|
|
14
|
+
import ListSeparatorView from '../list/listseparatorview.js';
|
|
15
|
+
import ButtonView from '../button/buttonview.js';
|
|
16
|
+
import SplitButtonView from './button/splitbuttonview.js';
|
|
17
|
+
import SwitchButtonView from '../button/switchbuttonview.js';
|
|
18
|
+
import ViewCollection from '../viewcollection.js';
|
|
19
|
+
import clickOutsideHandler from '../bindings/clickoutsidehandler.js';
|
|
20
20
|
import { global, priorities, logWarning } from '@ckeditor/ckeditor5-utils';
|
|
21
21
|
import '../../theme/components/dropdown/toolbardropdown.css';
|
|
22
22
|
import '../../theme/components/dropdown/listdropdown.css';
|
|
23
|
-
import ListItemGroupView from '../list/listitemgroupview';
|
|
23
|
+
import ListItemGroupView from '../list/listitemgroupview.js';
|
|
24
24
|
/**
|
|
25
25
|
* A helper for creating dropdowns. It creates an instance of a {@link module:ui/dropdown/dropdownview~DropdownView dropdown},
|
|
26
26
|
* with a {@link module:ui/dropdown/button/dropdownbutton~DropdownButton button},
|
|
@@ -198,7 +198,7 @@ function addToolbarToOpenDropdown(dropdownView, buttonsOrCallback, options) {
|
|
|
198
198
|
* Adds an instance of {@link module:ui/list/listview~ListView} to a dropdown.
|
|
199
199
|
*
|
|
200
200
|
* ```ts
|
|
201
|
-
* const items = new Collection();
|
|
201
|
+
* const items = new Collection<ListDropdownItemDefinition>();
|
|
202
202
|
*
|
|
203
203
|
* items.add( {
|
|
204
204
|
* type: 'button',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editableui/editableuiview
|
|
7
7
|
*/
|
|
8
|
-
import View from '../view';
|
|
9
|
-
import type {
|
|
8
|
+
import View from '../view.js';
|
|
9
|
+
import type { EditingView } from '@ckeditor/ckeditor5-engine';
|
|
10
10
|
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* The editable UI view class.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editableui/editableuiview
|
|
7
7
|
*/
|
|
8
|
-
import View from '../view';
|
|
8
|
+
import View from '../view.js';
|
|
9
9
|
/**
|
|
10
10
|
* The editable UI view class.
|
|
11
11
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editableui/inline/inlineeditableuiview
|
|
7
7
|
*/
|
|
8
|
-
import EditableUIView from '../editableuiview';
|
|
9
|
-
import type {
|
|
8
|
+
import EditableUIView from '../editableuiview.js';
|
|
9
|
+
import type { EditingView } from '@ckeditor/ckeditor5-engine';
|
|
10
10
|
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* The inline editable UI class implementing an inline {@link module:ui/editableui/editableuiview~EditableUIView}.
|
|
@@ -30,7 +30,7 @@ export default class InlineEditableUIView extends EditableUIView {
|
|
|
30
30
|
* and should return a string that represents the label of the editable for assistive technologies. If not provided,
|
|
31
31
|
* a default label generator is used.
|
|
32
32
|
*/
|
|
33
|
-
constructor(locale: Locale, editingView:
|
|
33
|
+
constructor(locale: Locale, editingView: EditingView, editableElement?: HTMLElement, options?: {
|
|
34
34
|
label?: (view: InlineEditableUIView) => string;
|
|
35
35
|
});
|
|
36
36
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editableui/inline/inlineeditableuiview
|
|
7
7
|
*/
|
|
8
|
-
import EditableUIView from '../editableuiview';
|
|
8
|
+
import EditableUIView from '../editableuiview.js';
|
|
9
9
|
/**
|
|
10
10
|
* The inline editable UI class implementing an inline {@link module:ui/editableui/editableuiview~EditableUIView}.
|
|
11
11
|
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
|
-
import ViewCollection from '../viewcollection';
|
|
6
|
-
import type View from '../view';
|
|
5
|
+
import ViewCollection from '../viewcollection.js';
|
|
6
|
+
import type View from '../view.js';
|
|
7
7
|
import { type Locale } from '@ckeditor/ckeditor5-utils';
|
|
8
8
|
/**
|
|
9
9
|
* This is a special {@link module:ui/viewcollection~ViewCollection} dedicated to elements that are detached
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editorui/bodycollection
|
|
7
7
|
*/
|
|
8
8
|
/* globals document */
|
|
9
|
-
import Template from '../template';
|
|
10
|
-
import ViewCollection from '../viewcollection';
|
|
9
|
+
import Template from '../template.js';
|
|
10
|
+
import ViewCollection from '../viewcollection.js';
|
|
11
11
|
import { createElement } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
/**
|
|
13
13
|
* This is a special {@link module:ui/viewcollection~ViewCollection} dedicated to elements that are detached
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editorui/boxed/boxededitoruiview
|
|
7
7
|
*/
|
|
8
|
-
import EditorUIView from '../editoruiview';
|
|
9
|
-
import type ViewCollection from '../../viewcollection';
|
|
8
|
+
import EditorUIView from '../editoruiview.js';
|
|
9
|
+
import type ViewCollection from '../../viewcollection.js';
|
|
10
10
|
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
11
11
|
/**
|
|
12
12
|
* The boxed editor UI view class. This class represents an editor interface
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editorui/boxed/boxededitoruiview
|
|
7
7
|
*/
|
|
8
|
-
import EditorUIView from '../editoruiview';
|
|
9
|
-
import LabelView from '../../label/labelview';
|
|
8
|
+
import EditorUIView from '../editoruiview.js';
|
|
9
|
+
import LabelView from '../../label/labelview.js';
|
|
10
10
|
/**
|
|
11
11
|
* The boxed editor UI view class. This class represents an editor interface
|
|
12
12
|
* consisting of a toolbar and an editable area, enclosed within a box.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editorui/editorui
|
|
7
7
|
*/
|
|
8
|
-
import ComponentFactory from '../componentfactory';
|
|
9
|
-
import TooltipManager from '../tooltipmanager';
|
|
10
|
-
import PoweredBy from './poweredby';
|
|
11
|
-
import AriaLiveAnnouncer from '../arialiveannouncer';
|
|
12
|
-
import type EditorUIView from './editoruiview';
|
|
13
|
-
import type ToolbarView from '../toolbar/toolbarview';
|
|
8
|
+
import ComponentFactory from '../componentfactory.js';
|
|
9
|
+
import TooltipManager from '../tooltipmanager.js';
|
|
10
|
+
import PoweredBy from './poweredby.js';
|
|
11
|
+
import AriaLiveAnnouncer from '../arialiveannouncer.js';
|
|
12
|
+
import type EditorUIView from './editoruiview.js';
|
|
13
|
+
import type ToolbarView from '../toolbar/toolbarview.js';
|
|
14
14
|
import { FocusTracker } from '@ckeditor/ckeditor5-utils';
|
|
15
15
|
import type { Editor } from '@ckeditor/ckeditor5-core';
|
|
16
16
|
declare const EditorUI_base: {
|
package/src/editorui/editorui.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editorui/editorui
|
|
7
7
|
*/
|
|
8
8
|
/* globals console */
|
|
9
|
-
import ComponentFactory from '../componentfactory';
|
|
10
|
-
import TooltipManager from '../tooltipmanager';
|
|
11
|
-
import PoweredBy from './poweredby';
|
|
12
|
-
import AriaLiveAnnouncer from '../arialiveannouncer';
|
|
9
|
+
import ComponentFactory from '../componentfactory.js';
|
|
10
|
+
import TooltipManager from '../tooltipmanager.js';
|
|
11
|
+
import PoweredBy from './poweredby.js';
|
|
12
|
+
import AriaLiveAnnouncer from '../arialiveannouncer.js';
|
|
13
13
|
import { ObservableMixin, isVisible, FocusTracker } from '@ckeditor/ckeditor5-utils';
|
|
14
14
|
/**
|
|
15
15
|
* A class providing the minimal interface that is required to successfully bootstrap any editor UI.
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editorui/editoruiview
|
|
7
7
|
*/
|
|
8
|
-
import View from '../view';
|
|
9
|
-
import BodyCollection from './bodycollection';
|
|
10
|
-
import type EditableUIView from '../editableui/editableuiview';
|
|
8
|
+
import View from '../view.js';
|
|
9
|
+
import BodyCollection from './bodycollection.js';
|
|
10
|
+
import type EditableUIView from '../editableui/editableuiview.js';
|
|
11
11
|
import type { Locale, LocaleTranslate } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
import '../../theme/components/editorui/editorui.css';
|
|
13
13
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/editorui/editoruiview
|
|
7
7
|
*/
|
|
8
|
-
import View from '../view';
|
|
9
|
-
import BodyCollection from './bodycollection';
|
|
8
|
+
import View from '../view.js';
|
|
9
|
+
import BodyCollection from './bodycollection.js';
|
|
10
10
|
import '../../theme/components/editorui/editorui.css';
|
|
11
11
|
/**
|
|
12
12
|
* The editor UI view class. Base class for the editor main views.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
import { DomEmitterMixin, Rect, verifyLicense } from '@ckeditor/ckeditor5-utils';
|
|
6
|
-
import BalloonPanelView from '../panel/balloon/balloonpanelview';
|
|
7
|
-
import IconView from '../icon/iconview';
|
|
8
|
-
import View from '../view';
|
|
6
|
+
import BalloonPanelView from '../panel/balloon/balloonpanelview.js';
|
|
7
|
+
import IconView from '../icon/iconview.js';
|
|
8
|
+
import View from '../view.js';
|
|
9
9
|
import { throttle } from 'lodash-es';
|
|
10
10
|
import poweredByIcon from '../../theme/icons/project-logo.svg';
|
|
11
11
|
const ICON_WIDTH = 53;
|
package/src/focuscycler.d.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/focuscycler
|
|
7
7
|
*/
|
|
8
8
|
import { type ArrayOrItem, type FocusTracker, type KeystrokeHandler } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import type View from './view';
|
|
10
|
-
import type ViewCollection from './viewcollection';
|
|
9
|
+
import type View from './view.js';
|
|
10
|
+
import type ViewCollection from './viewcollection.js';
|
|
11
11
|
declare const FocusCycler_base: {
|
|
12
12
|
new (): import("@ckeditor/ckeditor5-utils").Emitter;
|
|
13
13
|
prototype: import("@ckeditor/ckeditor5-utils").Emitter;
|
|
14
14
|
};
|
|
15
15
|
/**
|
|
16
|
-
* A utility class that helps cycling over
|
|
16
|
+
* A utility class that helps cycling over {@link module:ui/focuscycler~FocusableView focusable views} in a
|
|
17
17
|
* {@link module:ui/viewcollection~ViewCollection} when the focus is tracked by the
|
|
18
18
|
* {@link module:utils/focustracker~FocusTracker} instance. It helps implementing keyboard
|
|
19
19
|
* navigation in HTML forms, toolbars, lists and the like.
|
|
@@ -25,7 +25,7 @@ declare const FocusCycler_base: {
|
|
|
25
25
|
* A simple cycler setup can look like this:
|
|
26
26
|
*
|
|
27
27
|
* ```ts
|
|
28
|
-
* const focusables = new ViewCollection();
|
|
28
|
+
* const focusables = new ViewCollection<FocusableView>();
|
|
29
29
|
* const focusTracker = new FocusTracker();
|
|
30
30
|
*
|
|
31
31
|
* // Add focusable views to the focus tracker.
|
|
@@ -66,9 +66,9 @@ declare const FocusCycler_base: {
|
|
|
66
66
|
*/
|
|
67
67
|
export default class FocusCycler extends FocusCycler_base {
|
|
68
68
|
/**
|
|
69
|
-
* A {@link module:ui/
|
|
69
|
+
* A {@link module:ui/focuscycler~FocusableView focusable views} collection that the cycler operates on.
|
|
70
70
|
*/
|
|
71
|
-
readonly focusables: ViewCollection
|
|
71
|
+
readonly focusables: ViewCollection<FocusableView>;
|
|
72
72
|
/**
|
|
73
73
|
* A focus tracker instance that the cycler uses to determine the current focus
|
|
74
74
|
* state in {@link #focusables}.
|
|
@@ -102,7 +102,7 @@ export default class FocusCycler extends FocusCycler_base {
|
|
|
102
102
|
* @param options Configuration options.
|
|
103
103
|
*/
|
|
104
104
|
constructor(options: {
|
|
105
|
-
focusables: ViewCollection
|
|
105
|
+
focusables: ViewCollection<FocusableView>;
|
|
106
106
|
focusTracker: FocusTracker;
|
|
107
107
|
keystrokeHandler?: KeystrokeHandler;
|
|
108
108
|
actions?: FocusCyclerActions;
|
|
@@ -178,10 +178,10 @@ export default class FocusCycler extends FocusCycler_base {
|
|
|
178
178
|
*
|
|
179
179
|
* @param step Either `1` for checking forward from {@link #current} or `-1` for checking backwards.
|
|
180
180
|
*/
|
|
181
|
-
private
|
|
181
|
+
private _getDomFocusableItem;
|
|
182
182
|
}
|
|
183
183
|
/**
|
|
184
|
-
* A view that can be focused.
|
|
184
|
+
* A {@link module:ui/view~View} that can be focused (e.g. has `focus()` method).
|
|
185
185
|
*/
|
|
186
186
|
export type FocusableView = View & {
|
|
187
187
|
/**
|
|
@@ -197,6 +197,13 @@ export type FocusableView = View & {
|
|
|
197
197
|
*/
|
|
198
198
|
focus(direction?: 1 | -1): void;
|
|
199
199
|
};
|
|
200
|
+
/**
|
|
201
|
+
* A {@link module:ui/view~View} that hosts one or more of focusable children being managed by a {@link module:ui/focuscycler~FocusCycler}
|
|
202
|
+
* instance exposed under `focusCycler` property.
|
|
203
|
+
*/
|
|
204
|
+
export type ViewWithFocusCycler = FocusableView & {
|
|
205
|
+
focusCycler: FocusCycler;
|
|
206
|
+
};
|
|
200
207
|
export interface FocusCyclerActions {
|
|
201
208
|
focusFirst?: ArrayOrItem<string>;
|
|
202
209
|
focusLast?: ArrayOrItem<string>;
|
|
@@ -223,4 +230,16 @@ export type FocusCyclerBackwardCycleEvent = {
|
|
|
223
230
|
name: 'backwardCycle';
|
|
224
231
|
args: [];
|
|
225
232
|
};
|
|
233
|
+
/**
|
|
234
|
+
* Checks whether a view is {@link ~FocusableView}.
|
|
235
|
+
*
|
|
236
|
+
* @param view A view to be checked.
|
|
237
|
+
*/
|
|
238
|
+
export declare function isFocusable(view: View): view is FocusableView;
|
|
239
|
+
/**
|
|
240
|
+
* Checks whether a view is an instance of {@link ~ViewWithFocusCycler}.
|
|
241
|
+
*
|
|
242
|
+
* @param view A view to be checked.
|
|
243
|
+
*/
|
|
244
|
+
export declare function isViewWithFocusCycler(view: View): view is ViewWithFocusCycler;
|
|
226
245
|
export {};
|
package/src/focuscycler.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { isVisible, EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
9
9
|
/**
|
|
10
|
-
* A utility class that helps cycling over
|
|
10
|
+
* A utility class that helps cycling over {@link module:ui/focuscycler~FocusableView focusable views} in a
|
|
11
11
|
* {@link module:ui/viewcollection~ViewCollection} when the focus is tracked by the
|
|
12
12
|
* {@link module:utils/focustracker~FocusTracker} instance. It helps implementing keyboard
|
|
13
13
|
* navigation in HTML forms, toolbars, lists and the like.
|
|
@@ -19,7 +19,7 @@ import { isVisible, EmitterMixin } from '@ckeditor/ckeditor5-utils';
|
|
|
19
19
|
* A simple cycler setup can look like this:
|
|
20
20
|
*
|
|
21
21
|
* ```ts
|
|
22
|
-
* const focusables = new ViewCollection();
|
|
22
|
+
* const focusables = new ViewCollection<FocusableView>();
|
|
23
23
|
* const focusTracker = new FocusTracker();
|
|
24
24
|
*
|
|
25
25
|
* // Add focusable views to the focus tracker.
|
|
@@ -94,7 +94,7 @@ export default class FocusCycler extends EmitterMixin() {
|
|
|
94
94
|
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
95
95
|
*/
|
|
96
96
|
get first() {
|
|
97
|
-
return (this.focusables.find(
|
|
97
|
+
return (this.focusables.find(isDomFocusable) || null);
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
100
|
* Returns the last focusable view in {@link #focusables}.
|
|
@@ -103,7 +103,7 @@ export default class FocusCycler extends EmitterMixin() {
|
|
|
103
103
|
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
104
104
|
*/
|
|
105
105
|
get last() {
|
|
106
|
-
return (this.focusables.filter(
|
|
106
|
+
return (this.focusables.filter(isDomFocusable).slice(-1)[0] || null);
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
109
109
|
* Returns the next focusable view in {@link #focusables} based on {@link #current}.
|
|
@@ -112,7 +112,7 @@ export default class FocusCycler extends EmitterMixin() {
|
|
|
112
112
|
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
113
113
|
*/
|
|
114
114
|
get next() {
|
|
115
|
-
return this.
|
|
115
|
+
return this._getDomFocusableItem(1);
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* Returns the previous focusable view in {@link #focusables} based on {@link #current}.
|
|
@@ -121,7 +121,7 @@ export default class FocusCycler extends EmitterMixin() {
|
|
|
121
121
|
* **Note**: Hidden views (e.g. with `display: none`) are ignored.
|
|
122
122
|
*/
|
|
123
123
|
get previous() {
|
|
124
|
-
return this.
|
|
124
|
+
return this._getDomFocusableItem(-1);
|
|
125
125
|
}
|
|
126
126
|
/**
|
|
127
127
|
* An index of the view in the {@link #focusables} which is focused according
|
|
@@ -165,7 +165,12 @@ export default class FocusCycler extends EmitterMixin() {
|
|
|
165
165
|
*/
|
|
166
166
|
focusNext() {
|
|
167
167
|
const next = this.next;
|
|
168
|
+
// If there's only one focusable item, we need to let the outside world know
|
|
169
|
+
// that the next cycle is about to happen. This may be useful
|
|
170
|
+
// e.g. if you want to move the focus to the parent focus cycler.
|
|
171
|
+
// Note that the focus is not actually moved in this case.
|
|
168
172
|
if (next && this.focusables.getIndex(next) === this.current) {
|
|
173
|
+
this.fire('forwardCycle');
|
|
169
174
|
return;
|
|
170
175
|
}
|
|
171
176
|
if (next === this.first) {
|
|
@@ -183,6 +188,7 @@ export default class FocusCycler extends EmitterMixin() {
|
|
|
183
188
|
focusPrevious() {
|
|
184
189
|
const previous = this.previous;
|
|
185
190
|
if (previous && this.focusables.getIndex(previous) === this.current) {
|
|
191
|
+
this.fire('backwardCycle');
|
|
186
192
|
return;
|
|
187
193
|
}
|
|
188
194
|
if (previous === this.last) {
|
|
@@ -200,7 +206,11 @@ export default class FocusCycler extends EmitterMixin() {
|
|
|
200
206
|
* @returns
|
|
201
207
|
*/
|
|
202
208
|
_focus(view, direction) {
|
|
203
|
-
if
|
|
209
|
+
// Don't fire focus events if the view is already focused.
|
|
210
|
+
// Such attempt may occur when cycling with only one focusable item:
|
|
211
|
+
// even though `focusNext()` method returns without changing focus,
|
|
212
|
+
// the `forwardCycle` event is fired, triggering the `focusFirst()` method.
|
|
213
|
+
if (view && this.focusTracker.focusedElement !== view.element) {
|
|
204
214
|
view.focus(direction);
|
|
205
215
|
}
|
|
206
216
|
}
|
|
@@ -210,36 +220,55 @@ export default class FocusCycler extends EmitterMixin() {
|
|
|
210
220
|
*
|
|
211
221
|
* @param step Either `1` for checking forward from {@link #current} or `-1` for checking backwards.
|
|
212
222
|
*/
|
|
213
|
-
|
|
223
|
+
_getDomFocusableItem(step) {
|
|
214
224
|
// Cache for speed.
|
|
215
|
-
const current = this.current;
|
|
216
225
|
const collectionLength = this.focusables.length;
|
|
217
226
|
if (!collectionLength) {
|
|
218
227
|
return null;
|
|
219
228
|
}
|
|
229
|
+
const current = this.current;
|
|
220
230
|
// Start from the beginning if no view is focused.
|
|
221
231
|
// https://github.com/ckeditor/ckeditor5-ui/issues/206
|
|
222
232
|
if (current === null) {
|
|
223
233
|
return this[step === 1 ? 'first' : 'last'];
|
|
224
234
|
}
|
|
235
|
+
// Note: If current is the only focusable view, it will also be returned for the given step.
|
|
236
|
+
let focusableItem = this.focusables.get(current);
|
|
225
237
|
// Cycle in both directions.
|
|
226
238
|
let index = (current + collectionLength + step) % collectionLength;
|
|
227
239
|
do {
|
|
228
|
-
const
|
|
229
|
-
if (
|
|
230
|
-
|
|
240
|
+
const focusableItemCandidate = this.focusables.get(index);
|
|
241
|
+
if (isDomFocusable(focusableItemCandidate)) {
|
|
242
|
+
focusableItem = focusableItemCandidate;
|
|
243
|
+
break;
|
|
231
244
|
}
|
|
232
245
|
// Cycle in both directions.
|
|
233
246
|
index = (index + collectionLength + step) % collectionLength;
|
|
234
247
|
} while (index !== current);
|
|
235
|
-
return
|
|
248
|
+
return focusableItem;
|
|
236
249
|
}
|
|
237
250
|
}
|
|
238
251
|
/**
|
|
239
|
-
* Checks whether a view is
|
|
252
|
+
* Checks whether a view can be focused (has `focus()` method and is visible).
|
|
253
|
+
*
|
|
254
|
+
* @param view A view to be checked.
|
|
255
|
+
*/
|
|
256
|
+
function isDomFocusable(view) {
|
|
257
|
+
return isFocusable(view) && isVisible(view.element);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Checks whether a view is {@link ~FocusableView}.
|
|
261
|
+
*
|
|
262
|
+
* @param view A view to be checked.
|
|
263
|
+
*/
|
|
264
|
+
export function isFocusable(view) {
|
|
265
|
+
return !!('focus' in view && typeof view.focus == 'function');
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Checks whether a view is an instance of {@link ~ViewWithFocusCycler}.
|
|
240
269
|
*
|
|
241
270
|
* @param view A view to be checked.
|
|
242
271
|
*/
|
|
243
|
-
function
|
|
244
|
-
return
|
|
272
|
+
export function isViewWithFocusCycler(view) {
|
|
273
|
+
return isFocusable(view) && 'focusCycler' in view && view.focusCycler instanceof FocusCycler;
|
|
245
274
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Copyright (c) 2003-
|
|
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
5
|
/**
|
|
6
6
|
* @module ui/formheader/formheaderview
|
|
7
7
|
*/
|
|
8
|
-
import View from '../view';
|
|
9
|
-
import type ViewCollection from '../viewcollection';
|
|
10
|
-
import IconView from '../icon/iconview';
|
|
8
|
+
import View from '../view.js';
|
|
9
|
+
import type ViewCollection from '../viewcollection.js';
|
|
10
|
+
import IconView from '../icon/iconview.js';
|
|
11
11
|
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
12
12
|
import '../../theme/components/formheader/formheader.css';
|
|
13
13
|
/**
|