@ckeditor/ckeditor5-ui 47.6.1-alpha.1 → 48.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/ckeditor5-metadata.json +3 -3
- package/{src → dist}/colorselector/documentcolorcollection.d.ts +4 -4
- package/{src → dist}/dialog/dialog.d.ts +1 -1
- package/dist/index-editor.css +2728 -587
- package/dist/index.css +2673 -850
- package/dist/index.css.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/{src → dist}/menubar/menubarmenuview.d.ts +4 -0
- package/{src → dist}/view.d.ts +1 -1
- package/package.json +25 -47
- package/lang/contexts.json +0 -51
- package/lang/translations/af.po +0 -208
- package/lang/translations/ar.po +0 -208
- package/lang/translations/ast.po +0 -208
- package/lang/translations/az.po +0 -208
- package/lang/translations/be.po +0 -208
- package/lang/translations/bg.po +0 -208
- package/lang/translations/bn.po +0 -208
- package/lang/translations/bs.po +0 -208
- package/lang/translations/ca.po +0 -208
- package/lang/translations/cs.po +0 -208
- package/lang/translations/da.po +0 -208
- package/lang/translations/de-ch.po +0 -208
- package/lang/translations/de.po +0 -208
- package/lang/translations/el.po +0 -208
- package/lang/translations/en-au.po +0 -208
- package/lang/translations/en-gb.po +0 -208
- package/lang/translations/en.po +0 -208
- package/lang/translations/eo.po +0 -208
- package/lang/translations/es-co.po +0 -208
- package/lang/translations/es.po +0 -208
- package/lang/translations/et.po +0 -208
- package/lang/translations/eu.po +0 -208
- package/lang/translations/fa.po +0 -208
- package/lang/translations/fi.po +0 -208
- package/lang/translations/fr.po +0 -208
- package/lang/translations/gl.po +0 -208
- package/lang/translations/gu.po +0 -208
- package/lang/translations/he.po +0 -208
- package/lang/translations/hi.po +0 -208
- package/lang/translations/hr.po +0 -208
- package/lang/translations/hu.po +0 -208
- package/lang/translations/hy.po +0 -208
- package/lang/translations/id.po +0 -208
- package/lang/translations/it.po +0 -208
- package/lang/translations/ja.po +0 -208
- package/lang/translations/jv.po +0 -208
- package/lang/translations/kk.po +0 -208
- package/lang/translations/km.po +0 -208
- package/lang/translations/kn.po +0 -208
- package/lang/translations/ko.po +0 -208
- package/lang/translations/ku.po +0 -208
- package/lang/translations/lt.po +0 -208
- package/lang/translations/lv.po +0 -208
- package/lang/translations/ms.po +0 -208
- package/lang/translations/nb.po +0 -208
- package/lang/translations/ne.po +0 -208
- package/lang/translations/nl.po +0 -208
- package/lang/translations/no.po +0 -208
- package/lang/translations/oc.po +0 -208
- package/lang/translations/pl.po +0 -208
- package/lang/translations/pt-br.po +0 -208
- package/lang/translations/pt.po +0 -208
- package/lang/translations/ro.po +0 -208
- package/lang/translations/ru.po +0 -208
- package/lang/translations/si.po +0 -208
- package/lang/translations/sk.po +0 -208
- package/lang/translations/sl.po +0 -208
- package/lang/translations/sq.po +0 -208
- package/lang/translations/sr-latn.po +0 -208
- package/lang/translations/sr.po +0 -208
- package/lang/translations/sv.po +0 -208
- package/lang/translations/th.po +0 -208
- package/lang/translations/ti.po +0 -208
- package/lang/translations/tk.po +0 -208
- package/lang/translations/tr.po +0 -208
- package/lang/translations/tt.po +0 -208
- package/lang/translations/ug.po +0 -208
- package/lang/translations/uk.po +0 -208
- package/lang/translations/ur.po +0 -208
- package/lang/translations/uz.po +0 -208
- package/lang/translations/vi.po +0 -208
- package/lang/translations/zh-cn.po +0 -208
- package/lang/translations/zh.po +0 -208
- package/src/arialiveannouncer.js +0 -189
- package/src/augmentation.js +0 -5
- package/src/autocomplete/autocompleteview.js +0 -157
- package/src/badge/badge.js +0 -226
- package/src/bindings/addkeyboardhandlingforgrid.js +0 -107
- package/src/bindings/clickoutsidehandler.js +0 -36
- package/src/bindings/csstransitiondisablermixin.js +0 -58
- package/src/bindings/draggableviewmixin.js +0 -144
- package/src/bindings/preventdefault.js +0 -35
- package/src/bindings/submithandler.js +0 -47
- package/src/button/button.js +0 -5
- package/src/button/buttonlabel.js +0 -5
- package/src/button/buttonlabelview.js +0 -42
- package/src/button/buttonview.js +0 -278
- package/src/button/filedialogbuttonview.js +0 -147
- package/src/button/listitembuttonview.js +0 -136
- package/src/button/switchbuttonview.js +0 -79
- package/src/collapsible/collapsibleview.js +0 -106
- package/src/colorgrid/colorgridview.js +0 -140
- package/src/colorgrid/colortileview.js +0 -42
- package/src/colorgrid/utils.js +0 -84
- package/src/colorpicker/colorpickerview.js +0 -356
- package/src/colorpicker/utils.js +0 -108
- package/src/colorselector/colorgridsfragmentview.js +0 -368
- package/src/colorselector/colorpickerfragmentview.js +0 -254
- package/src/colorselector/colorselectorview.js +0 -294
- package/src/colorselector/documentcolorcollection.js +0 -42
- package/src/componentfactory.js +0 -108
- package/src/dialog/dialog.js +0 -325
- package/src/dialog/dialogactionsview.js +0 -118
- package/src/dialog/dialogcontentview.js +0 -39
- package/src/dialog/dialogview.js +0 -507
- package/src/dropdown/button/dropdownbutton.js +0 -5
- package/src/dropdown/button/dropdownbuttonview.js +0 -70
- package/src/dropdown/button/splitbuttonview.js +0 -178
- package/src/dropdown/dropdownpanelfocusable.js +0 -5
- package/src/dropdown/dropdownpanelview.js +0 -106
- package/src/dropdown/dropdownview.js +0 -438
- package/src/dropdown/menu/dropdownmenubehaviors.js +0 -125
- package/src/dropdown/menu/dropdownmenubuttonview.js +0 -69
- package/src/dropdown/menu/dropdownmenulistitembuttonview.js +0 -30
- package/src/dropdown/menu/dropdownmenulistitemview.js +0 -38
- package/src/dropdown/menu/dropdownmenulistview.js +0 -29
- package/src/dropdown/menu/dropdownmenunestedmenupanelview.js +0 -63
- package/src/dropdown/menu/dropdownmenunestedmenuview.js +0 -214
- package/src/dropdown/menu/dropdownmenurootlistview.js +0 -168
- package/src/dropdown/menu/utils.js +0 -61
- package/src/dropdown/utils.js +0 -654
- package/src/editableui/editableuiview.js +0 -130
- package/src/editableui/inline/inlineeditableuiview.js +0 -75
- package/src/editorui/accessibilityhelp/accessibilityhelp.js +0 -142
- package/src/editorui/accessibilityhelp/accessibilityhelpcontentview.js +0 -112
- package/src/editorui/bodycollection.js +0 -128
- package/src/editorui/boxed/boxededitoruiview.js +0 -95
- package/src/editorui/editorui.js +0 -586
- package/src/editorui/editoruiview.js +0 -60
- package/src/editorui/evaluationbadge.js +0 -99
- package/src/editorui/poweredby.js +0 -120
- package/src/focuscycler.js +0 -383
- package/src/formheader/formheaderview.js +0 -77
- package/src/formrow/formrowview.js +0 -56
- package/src/highlightedtext/buttonlabelwithhighlightview.js +0 -31
- package/src/highlightedtext/highlightedtextview.js +0 -102
- package/src/highlightedtext/labelwithhighlightview.js +0 -37
- package/src/icon/iconview.js +0 -123
- package/src/iframe/iframeview.js +0 -63
- package/src/index.js +0 -132
- package/src/input/inputbase.js +0 -119
- package/src/input/inputview.js +0 -24
- package/src/inputnumber/inputnumberview.js +0 -40
- package/src/inputtext/inputtextview.js +0 -27
- package/src/label/labelview.js +0 -46
- package/src/labeledfield/labeledfieldview.js +0 -177
- package/src/labeledfield/utils.js +0 -176
- package/src/labeledinput/labeledinputview.js +0 -138
- package/src/legacyerrors.js +0 -20
- package/src/list/listitemgroupview.js +0 -82
- package/src/list/listitemview.js +0 -46
- package/src/list/listseparatorview.js +0 -28
- package/src/list/listview.js +0 -210
- package/src/menubar/menubarmenubuttonview.js +0 -68
- package/src/menubar/menubarmenulistitembuttonview.js +0 -30
- package/src/menubar/menubarmenulistitemfiledialogbuttonview.js +0 -32
- package/src/menubar/menubarmenulistitemview.js +0 -34
- package/src/menubar/menubarmenulistview.js +0 -72
- package/src/menubar/menubarmenupanelview.js +0 -64
- package/src/menubar/menubarmenuview.js +0 -198
- package/src/menubar/menubarview.js +0 -281
- package/src/menubar/utils.js +0 -1432
- package/src/model.js +0 -31
- package/src/notification/notification.js +0 -192
- package/src/panel/balloon/balloonpanelview.js +0 -1077
- package/src/panel/balloon/contextualballoon.js +0 -616
- package/src/panel/sticky/stickypanelview.js +0 -246
- package/src/search/filteredview.js +0 -5
- package/src/search/filtergroupanditemnames.js +0 -38
- package/src/search/searchinfoview.js +0 -59
- package/src/search/searchresultsview.js +0 -83
- package/src/search/text/searchtextqueryview.js +0 -87
- package/src/search/text/searchtextview.js +0 -242
- package/src/spinner/spinnerview.js +0 -38
- package/src/template.js +0 -1396
- package/src/textarea/textareaview.js +0 -189
- package/src/toolbar/balloon/balloontoolbar.js +0 -358
- package/src/toolbar/block/blockbuttonview.js +0 -41
- package/src/toolbar/block/blocktoolbar.js +0 -507
- package/src/toolbar/normalizetoolbarconfig.js +0 -52
- package/src/toolbar/toolbarlinebreakview.js +0 -28
- package/src/toolbar/toolbarseparatorview.js +0 -28
- package/src/toolbar/toolbarview.js +0 -873
- package/src/tooltipmanager.js +0 -454
- package/src/view.js +0 -471
- package/src/viewcollection.js +0 -210
- package/theme/components/arialiveannouncer/arialiveannouncer.css +0 -14
- package/theme/components/autocomplete/autocomplete.css +0 -22
- package/theme/components/button/button.css +0 -39
- package/theme/components/button/listitembutton.css +0 -48
- package/theme/components/button/switchbutton.css +0 -14
- package/theme/components/collapsible/collapsible.css +0 -10
- package/theme/components/colorgrid/colorgrid.css +0 -8
- package/theme/components/colorpicker/colorpicker.css +0 -34
- package/theme/components/colorselector/colorselector.css +0 -35
- package/theme/components/dialog/dialog.css +0 -42
- package/theme/components/dialog/dialogactions.css +0 -11
- package/theme/components/dropdown/dropdown.css +0 -95
- package/theme/components/dropdown/listdropdown.css +0 -10
- package/theme/components/dropdown/menu/dropdownmenu.css +0 -8
- package/theme/components/dropdown/menu/dropdownmenubutton.css +0 -9
- package/theme/components/dropdown/menu/dropdownmenulistitem.css +0 -10
- package/theme/components/dropdown/menu/dropdownmenulistitembutton.css +0 -10
- package/theme/components/dropdown/menu/dropdownmenupanel.css +0 -11
- package/theme/components/dropdown/splitbutton.css +0 -14
- package/theme/components/dropdown/toolbardropdown.css +0 -20
- package/theme/components/editorui/accessibilityhelp.css +0 -10
- package/theme/components/editorui/editorui.css +0 -10
- package/theme/components/form/form.css +0 -87
- package/theme/components/formheader/formheader.css +0 -18
- package/theme/components/formrow/formrow.css +0 -32
- package/theme/components/highlightedtext/highlightedtext.css +0 -12
- package/theme/components/icon/icon.css +0 -8
- package/theme/components/input/input.css +0 -10
- package/theme/components/label/label.css +0 -12
- package/theme/components/labeledfield/labeledfieldview.css +0 -16
- package/theme/components/labeledinput/labeledinput.css +0 -10
- package/theme/components/list/list.css +0 -26
- package/theme/components/menubar/menubar.css +0 -10
- package/theme/components/menubar/menubarmenu.css +0 -9
- package/theme/components/menubar/menubarmenubutton.css +0 -11
- package/theme/components/menubar/menubarmenulistitem.css +0 -10
- package/theme/components/menubar/menubarmenulistitembutton.css +0 -10
- package/theme/components/menubar/menubarmenupanel.css +0 -62
- package/theme/components/panel/balloonpanel.css +0 -56
- package/theme/components/panel/balloonrotator.css +0 -17
- package/theme/components/panel/fakepanel.css +0 -23
- package/theme/components/panel/stickypanel.css +0 -17
- package/theme/components/responsive-form/responsiveform.css +0 -42
- package/theme/components/search/search.css +0 -43
- package/theme/components/spinner/spinner.css +0 -23
- package/theme/components/textarea/textarea.css +0 -10
- package/theme/components/toolbar/blocktoolbar.css +0 -9
- package/theme/components/toolbar/toolbar.css +0 -58
- package/theme/components/tooltip/tooltip.css +0 -12
- package/theme/globals/_evaluationbadge.css +0 -54
- package/theme/globals/_hidden.css +0 -13
- package/theme/globals/_poweredby.css +0 -84
- package/theme/globals/_transition.css +0 -12
- package/theme/globals/_zindex.css +0 -10
- package/theme/globals/globals.css +0 -10
- package/theme/mixins/_dir.css +0 -10
- package/theme/mixins/_mediacolors.css +0 -20
- package/theme/mixins/_rwd.css +0 -10
- package/theme/mixins/_unselectable.css +0 -14
- /package/{src → dist}/arialiveannouncer.d.ts +0 -0
- /package/{src → dist}/augmentation.d.ts +0 -0
- /package/{src → dist}/autocomplete/autocompleteview.d.ts +0 -0
- /package/{src → dist}/badge/badge.d.ts +0 -0
- /package/{src → dist}/bindings/addkeyboardhandlingforgrid.d.ts +0 -0
- /package/{src → dist}/bindings/clickoutsidehandler.d.ts +0 -0
- /package/{src → dist}/bindings/csstransitiondisablermixin.d.ts +0 -0
- /package/{src → dist}/bindings/draggableviewmixin.d.ts +0 -0
- /package/{src → dist}/bindings/preventdefault.d.ts +0 -0
- /package/{src → dist}/bindings/submithandler.d.ts +0 -0
- /package/{src → dist}/button/button.d.ts +0 -0
- /package/{src → dist}/button/buttonlabel.d.ts +0 -0
- /package/{src → dist}/button/buttonlabelview.d.ts +0 -0
- /package/{src → dist}/button/buttonview.d.ts +0 -0
- /package/{src → dist}/button/filedialogbuttonview.d.ts +0 -0
- /package/{src → dist}/button/listitembuttonview.d.ts +0 -0
- /package/{src → dist}/button/switchbuttonview.d.ts +0 -0
- /package/{src → dist}/collapsible/collapsibleview.d.ts +0 -0
- /package/{src → dist}/colorgrid/colorgridview.d.ts +0 -0
- /package/{src → dist}/colorgrid/colortileview.d.ts +0 -0
- /package/{src → dist}/colorgrid/utils.d.ts +0 -0
- /package/{src → dist}/colorpicker/colorpickerview.d.ts +0 -0
- /package/{src → dist}/colorpicker/utils.d.ts +0 -0
- /package/{src → dist}/colorselector/colorgridsfragmentview.d.ts +0 -0
- /package/{src → dist}/colorselector/colorpickerfragmentview.d.ts +0 -0
- /package/{src → dist}/colorselector/colorselectorview.d.ts +0 -0
- /package/{src → dist}/componentfactory.d.ts +0 -0
- /package/{src → dist}/dialog/dialogactionsview.d.ts +0 -0
- /package/{src → dist}/dialog/dialogcontentview.d.ts +0 -0
- /package/{src → dist}/dialog/dialogview.d.ts +0 -0
- /package/{src → dist}/dropdown/button/dropdownbutton.d.ts +0 -0
- /package/{src → dist}/dropdown/button/dropdownbuttonview.d.ts +0 -0
- /package/{src → dist}/dropdown/button/splitbuttonview.d.ts +0 -0
- /package/{src → dist}/dropdown/dropdownpanelfocusable.d.ts +0 -0
- /package/{src → dist}/dropdown/dropdownpanelview.d.ts +0 -0
- /package/{src → dist}/dropdown/dropdownview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenubehaviors.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenubuttonview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenulistitembuttonview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenulistitemview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenulistview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenunestedmenupanelview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenunestedmenuview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/dropdownmenurootlistview.d.ts +0 -0
- /package/{src → dist}/dropdown/menu/utils.d.ts +0 -0
- /package/{src → dist}/dropdown/utils.d.ts +0 -0
- /package/{src → dist}/editableui/editableuiview.d.ts +0 -0
- /package/{src → dist}/editableui/inline/inlineeditableuiview.d.ts +0 -0
- /package/{src → dist}/editorui/accessibilityhelp/accessibilityhelp.d.ts +0 -0
- /package/{src → dist}/editorui/accessibilityhelp/accessibilityhelpcontentview.d.ts +0 -0
- /package/{src → dist}/editorui/bodycollection.d.ts +0 -0
- /package/{src → dist}/editorui/boxed/boxededitoruiview.d.ts +0 -0
- /package/{src → dist}/editorui/editorui.d.ts +0 -0
- /package/{src → dist}/editorui/editoruiview.d.ts +0 -0
- /package/{src → dist}/editorui/evaluationbadge.d.ts +0 -0
- /package/{src → dist}/editorui/poweredby.d.ts +0 -0
- /package/{src → dist}/focuscycler.d.ts +0 -0
- /package/{src → dist}/formheader/formheaderview.d.ts +0 -0
- /package/{src → dist}/formrow/formrowview.d.ts +0 -0
- /package/{src → dist}/highlightedtext/buttonlabelwithhighlightview.d.ts +0 -0
- /package/{src → dist}/highlightedtext/highlightedtextview.d.ts +0 -0
- /package/{src → dist}/highlightedtext/labelwithhighlightview.d.ts +0 -0
- /package/{src → dist}/icon/iconview.d.ts +0 -0
- /package/{src → dist}/iframe/iframeview.d.ts +0 -0
- /package/{src → dist}/index.d.ts +0 -0
- /package/{src → dist}/input/inputbase.d.ts +0 -0
- /package/{src → dist}/input/inputview.d.ts +0 -0
- /package/{src → dist}/inputnumber/inputnumberview.d.ts +0 -0
- /package/{src → dist}/inputtext/inputtextview.d.ts +0 -0
- /package/{src → dist}/label/labelview.d.ts +0 -0
- /package/{src → dist}/labeledfield/labeledfieldview.d.ts +0 -0
- /package/{src → dist}/labeledfield/utils.d.ts +0 -0
- /package/{src → dist}/labeledinput/labeledinputview.d.ts +0 -0
- /package/{src → dist}/legacyerrors.d.ts +0 -0
- /package/{src → dist}/list/listitemgroupview.d.ts +0 -0
- /package/{src → dist}/list/listitemview.d.ts +0 -0
- /package/{src → dist}/list/listseparatorview.d.ts +0 -0
- /package/{src → dist}/list/listview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenubuttonview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenulistitembuttonview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenulistitemfiledialogbuttonview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenulistitemview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenulistview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarmenupanelview.d.ts +0 -0
- /package/{src → dist}/menubar/menubarview.d.ts +0 -0
- /package/{src → dist}/menubar/utils.d.ts +0 -0
- /package/{src → dist}/model.d.ts +0 -0
- /package/{src → dist}/notification/notification.d.ts +0 -0
- /package/{src → dist}/panel/balloon/balloonpanelview.d.ts +0 -0
- /package/{src → dist}/panel/balloon/contextualballoon.d.ts +0 -0
- /package/{src → dist}/panel/sticky/stickypanelview.d.ts +0 -0
- /package/{src → dist}/search/filteredview.d.ts +0 -0
- /package/{src → dist}/search/filtergroupanditemnames.d.ts +0 -0
- /package/{src → dist}/search/searchinfoview.d.ts +0 -0
- /package/{src → dist}/search/searchresultsview.d.ts +0 -0
- /package/{src → dist}/search/text/searchtextqueryview.d.ts +0 -0
- /package/{src → dist}/search/text/searchtextview.d.ts +0 -0
- /package/{src → dist}/spinner/spinnerview.d.ts +0 -0
- /package/{src → dist}/template.d.ts +0 -0
- /package/{src → dist}/textarea/textareaview.d.ts +0 -0
- /package/{src → dist}/toolbar/balloon/balloontoolbar.d.ts +0 -0
- /package/{src → dist}/toolbar/block/blockbuttonview.d.ts +0 -0
- /package/{src → dist}/toolbar/block/blocktoolbar.d.ts +0 -0
- /package/{src → dist}/toolbar/normalizetoolbarconfig.d.ts +0 -0
- /package/{src → dist}/toolbar/toolbarlinebreakview.d.ts +0 -0
- /package/{src → dist}/toolbar/toolbarseparatorview.d.ts +0 -0
- /package/{src → dist}/toolbar/toolbarview.d.ts +0 -0
- /package/{src → dist}/tooltipmanager.d.ts +0 -0
- /package/{src → dist}/viewcollection.d.ts +0 -0
package/src/dialog/dialogview.js
DELETED
|
@@ -1,507 +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/dialog/dialogview
|
|
7
|
-
*/
|
|
8
|
-
import { KeystrokeHandler, FocusTracker, Rect, getConstrainedViewportRect, global, toUnit } from '@ckeditor/ckeditor5-utils';
|
|
9
|
-
import { IconCancel } from '@ckeditor/ckeditor5-icons';
|
|
10
|
-
import { ViewCollection } from '../viewcollection.js';
|
|
11
|
-
import { View } from '../view.js';
|
|
12
|
-
import { FormHeaderView } from '../formheader/formheaderview.js';
|
|
13
|
-
import { ButtonView } from '../button/buttonview.js';
|
|
14
|
-
import { FocusCycler, isViewWithFocusCycler, isFocusable } from '../focuscycler.js';
|
|
15
|
-
import { DraggableViewMixin } from '../bindings/draggableviewmixin.js';
|
|
16
|
-
import { DialogActionsView } from './dialogactionsview.js';
|
|
17
|
-
import { DialogContentView } from './dialogcontentview.js';
|
|
18
|
-
import '../../theme/components/dialog/dialog.css';
|
|
19
|
-
// @if CK_DEBUG_DIALOG // const RectDrawer = require( '@ckeditor/ckeditor5-utils/tests/_utils/rectdrawer' ).default;
|
|
20
|
-
/**
|
|
21
|
-
* Available dialog view positions:
|
|
22
|
-
*
|
|
23
|
-
* * `DialogViewPosition.SCREEN_CENTER` – A fixed position in the center of the screen.
|
|
24
|
-
* * `DialogViewPosition.EDITOR_CENTER` – A dynamic position in the center of the editor editable area.
|
|
25
|
-
* * `DialogViewPosition.EDITOR_TOP_SIDE` – A dynamic position at the top-right (for the left-to-right languages)
|
|
26
|
-
* or top-left (for right-to-left languages) corner of the editor editable area.
|
|
27
|
-
* * `DialogViewPosition.EDITOR_TOP_CENTER` – A dynamic position at the top-center of the editor editable area.
|
|
28
|
-
* * `DialogViewPosition.EDITOR_BOTTOM_CENTER` – A dynamic position at the bottom-center of the editor editable area.
|
|
29
|
-
* * `DialogViewPosition.EDITOR_ABOVE_CENTER` – A dynamic position centered above the editor editable area.
|
|
30
|
-
* * `DialogViewPosition.EDITOR_BELOW_CENTER` – A dynamic position centered below the editor editable area.
|
|
31
|
-
*
|
|
32
|
-
* The position of a dialog is specified by a {@link module:ui/dialog/dialog~DialogDefinition#position `position` property} of a
|
|
33
|
-
* definition passed to the {@link module:ui/dialog/dialog~Dialog#show} method.
|
|
34
|
-
*/
|
|
35
|
-
export const DialogViewPosition = {
|
|
36
|
-
SCREEN_CENTER: 'screen-center',
|
|
37
|
-
EDITOR_CENTER: 'editor-center',
|
|
38
|
-
EDITOR_TOP_SIDE: 'editor-top-side',
|
|
39
|
-
EDITOR_TOP_CENTER: 'editor-top-center',
|
|
40
|
-
EDITOR_BOTTOM_CENTER: 'editor-bottom-center',
|
|
41
|
-
EDITOR_ABOVE_CENTER: 'editor-above-center',
|
|
42
|
-
EDITOR_BELOW_CENTER: 'editor-below-center'
|
|
43
|
-
};
|
|
44
|
-
const toPx = /* #__PURE__ */ toUnit('px');
|
|
45
|
-
/**
|
|
46
|
-
* A dialog view class.
|
|
47
|
-
*/
|
|
48
|
-
export class DialogView extends /* #__PURE__ */ DraggableViewMixin(View) {
|
|
49
|
-
/**
|
|
50
|
-
* A collection of the child views inside of the dialog.
|
|
51
|
-
* A dialog can have 3 optional parts: header, content, and actions.
|
|
52
|
-
*/
|
|
53
|
-
parts;
|
|
54
|
-
/**
|
|
55
|
-
* A header view of the dialog. It is also a drag handle of the dialog.
|
|
56
|
-
*/
|
|
57
|
-
headerView;
|
|
58
|
-
/**
|
|
59
|
-
* A close button view. It is automatically added to the header view if present.
|
|
60
|
-
*/
|
|
61
|
-
closeButtonView;
|
|
62
|
-
/**
|
|
63
|
-
* A view with the action buttons available to the user.
|
|
64
|
-
*/
|
|
65
|
-
actionsView;
|
|
66
|
-
/**
|
|
67
|
-
* A default dialog element offset from the reference element (e.g. editor editable area).
|
|
68
|
-
*/
|
|
69
|
-
static defaultOffset = 15;
|
|
70
|
-
/**
|
|
71
|
-
* A view with the dialog content.
|
|
72
|
-
*/
|
|
73
|
-
contentView;
|
|
74
|
-
/**
|
|
75
|
-
* A keystroke handler instance.
|
|
76
|
-
*/
|
|
77
|
-
keystrokes;
|
|
78
|
-
/**
|
|
79
|
-
* A focus tracker instance.
|
|
80
|
-
*/
|
|
81
|
-
focusTracker;
|
|
82
|
-
/**
|
|
83
|
-
* A flag indicating if the dialog was moved manually. If so, its position
|
|
84
|
-
* will not be updated automatically upon window resize or document scroll.
|
|
85
|
-
*/
|
|
86
|
-
wasMoved = false;
|
|
87
|
-
/**
|
|
88
|
-
* A callback returning the DOM root that requested the dialog.
|
|
89
|
-
*/
|
|
90
|
-
_getCurrentDomRoot;
|
|
91
|
-
/**
|
|
92
|
-
* A callback returning the configured editor viewport offset.
|
|
93
|
-
*/
|
|
94
|
-
_getViewportOffset;
|
|
95
|
-
/**
|
|
96
|
-
* The list of the focusable elements inside the dialog view.
|
|
97
|
-
*/
|
|
98
|
-
_focusables;
|
|
99
|
-
/**
|
|
100
|
-
* The focus cycler instance.
|
|
101
|
-
*/
|
|
102
|
-
_focusCycler;
|
|
103
|
-
/**
|
|
104
|
-
* @inheritDoc
|
|
105
|
-
*/
|
|
106
|
-
constructor(locale, { getCurrentDomRoot, getViewportOffset, keystrokeHandlerOptions }) {
|
|
107
|
-
super(locale);
|
|
108
|
-
const bind = this.bindTemplate;
|
|
109
|
-
const t = locale.t;
|
|
110
|
-
this.set('className', '');
|
|
111
|
-
this.set('ariaLabel', t('Editor dialog'));
|
|
112
|
-
this.set('isModal', false);
|
|
113
|
-
this.set('position', DialogViewPosition.SCREEN_CENTER);
|
|
114
|
-
this.set('_isVisible', false);
|
|
115
|
-
this.set('_isTransparent', false);
|
|
116
|
-
this.set('_top', 0);
|
|
117
|
-
this.set('_left', 0);
|
|
118
|
-
this._getCurrentDomRoot = getCurrentDomRoot;
|
|
119
|
-
this._getViewportOffset = getViewportOffset;
|
|
120
|
-
this.decorate('moveTo');
|
|
121
|
-
this.parts = this.createCollection();
|
|
122
|
-
this.keystrokes = new KeystrokeHandler();
|
|
123
|
-
this.focusTracker = new FocusTracker();
|
|
124
|
-
this._focusables = new ViewCollection();
|
|
125
|
-
this._focusCycler = new FocusCycler({
|
|
126
|
-
focusables: this._focusables,
|
|
127
|
-
focusTracker: this.focusTracker,
|
|
128
|
-
keystrokeHandler: this.keystrokes,
|
|
129
|
-
actions: {
|
|
130
|
-
// Navigate form fields backwards using the Shift + Tab keystroke.
|
|
131
|
-
focusPrevious: 'shift + tab',
|
|
132
|
-
// Navigate form fields forwards using the Tab key.
|
|
133
|
-
focusNext: 'tab'
|
|
134
|
-
},
|
|
135
|
-
keystrokeHandlerOptions
|
|
136
|
-
});
|
|
137
|
-
this.setTemplate({
|
|
138
|
-
tag: 'div',
|
|
139
|
-
attributes: {
|
|
140
|
-
class: [
|
|
141
|
-
'ck',
|
|
142
|
-
'ck-dialog-overlay',
|
|
143
|
-
bind.if('isModal', 'ck-dialog-overlay__transparent', isModal => !isModal),
|
|
144
|
-
bind.if('_isVisible', 'ck-hidden', value => !value)
|
|
145
|
-
],
|
|
146
|
-
// Prevent from editor losing focus when clicking on the modal overlay.
|
|
147
|
-
tabindex: '-1'
|
|
148
|
-
},
|
|
149
|
-
children: [
|
|
150
|
-
{
|
|
151
|
-
tag: 'div',
|
|
152
|
-
attributes: {
|
|
153
|
-
tabindex: '-1',
|
|
154
|
-
class: [
|
|
155
|
-
'ck',
|
|
156
|
-
'ck-dialog',
|
|
157
|
-
bind.if('isModal', 'ck-dialog_modal'),
|
|
158
|
-
bind.to('className')
|
|
159
|
-
],
|
|
160
|
-
role: 'dialog',
|
|
161
|
-
'aria-label': bind.to('ariaLabel'),
|
|
162
|
-
style: {
|
|
163
|
-
top: bind.to('_top', top => toPx(top)),
|
|
164
|
-
left: bind.to('_left', left => toPx(left)),
|
|
165
|
-
visibility: bind.if('_isTransparent', 'hidden')
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
|
-
children: this.parts
|
|
169
|
-
}
|
|
170
|
-
]
|
|
171
|
-
});
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* @inheritDoc
|
|
175
|
-
*/
|
|
176
|
-
render() {
|
|
177
|
-
super.render();
|
|
178
|
-
this.keystrokes.set('Esc', (data, cancel) => {
|
|
179
|
-
// Do not react to the Esc key if the event has already been handled and defaultPrevented
|
|
180
|
-
// by some logic of the dialog guest (child) view (https://github.com/ckeditor/ckeditor5/issues/17343).
|
|
181
|
-
if (!data.defaultPrevented) {
|
|
182
|
-
this.fire('close', { source: 'escKeyPress' });
|
|
183
|
-
cancel();
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
// Support for dragging the modal.
|
|
187
|
-
this.on('drag', (evt, { deltaX, deltaY }) => {
|
|
188
|
-
this.wasMoved = true;
|
|
189
|
-
this.moveBy(deltaX, deltaY);
|
|
190
|
-
});
|
|
191
|
-
// Update dialog position upon window resize, if the position was not changed manually.
|
|
192
|
-
this.listenTo(global.window, 'resize', () => {
|
|
193
|
-
if (this._isVisible && !this.wasMoved) {
|
|
194
|
-
this.updatePosition();
|
|
195
|
-
}
|
|
196
|
-
});
|
|
197
|
-
// Update dialog position upon document scroll, if the position was not changed manually.
|
|
198
|
-
this.listenTo(global.document, 'scroll', () => {
|
|
199
|
-
if (this._isVisible && !this.wasMoved) {
|
|
200
|
-
this.updatePosition();
|
|
201
|
-
}
|
|
202
|
-
});
|
|
203
|
-
this.on('change:_isVisible', (evt, name, isVisible) => {
|
|
204
|
-
if (isVisible) {
|
|
205
|
-
// Let the content render first, then apply the position. Otherwise, the calculated DOM Rects
|
|
206
|
-
// will not reflect the final look of the dialog. Note that we're not using #_moveOffScreen() here because
|
|
207
|
-
// it causes a violent movement of the viewport on iOS (because the dialog still keeps the DOM focus).
|
|
208
|
-
this._isTransparent = true;
|
|
209
|
-
// FYI: RAF is too short. We need to wait a bit longer.
|
|
210
|
-
setTimeout(() => {
|
|
211
|
-
this.updatePosition();
|
|
212
|
-
this._isTransparent = false;
|
|
213
|
-
// The view must get the focus after it gets visible. But this is only possible
|
|
214
|
-
// after the dialog is no longer transparent.
|
|
215
|
-
this.focus();
|
|
216
|
-
}, 10);
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
this.keystrokes.listenTo(this.element);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Returns the element that should be used as a drag handle.
|
|
223
|
-
*/
|
|
224
|
-
get dragHandleElement() {
|
|
225
|
-
// Modals should not be draggable.
|
|
226
|
-
if (this.headerView && !this.isModal) {
|
|
227
|
-
return this.headerView.element;
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
return null;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Creates the dialog parts. Which of them are created depends on the arguments passed to the method.
|
|
235
|
-
* There are no rules regarding the dialog construction, that is, no part is mandatory.
|
|
236
|
-
* Each part can only be created once.
|
|
237
|
-
*
|
|
238
|
-
* @internal
|
|
239
|
-
*/
|
|
240
|
-
setupParts({ icon, title, hasCloseButton = true, content, actionButtons }) {
|
|
241
|
-
if (title) {
|
|
242
|
-
this.headerView = new FormHeaderView(this.locale, { icon });
|
|
243
|
-
if (hasCloseButton) {
|
|
244
|
-
this.closeButtonView = this._createCloseButton();
|
|
245
|
-
this.headerView.children.add(this.closeButtonView);
|
|
246
|
-
}
|
|
247
|
-
this.headerView.label = title;
|
|
248
|
-
this.ariaLabel = title;
|
|
249
|
-
this.parts.add(this.headerView, 0);
|
|
250
|
-
}
|
|
251
|
-
if (content) {
|
|
252
|
-
// Normalize the content specified in the arguments.
|
|
253
|
-
if (content instanceof View) {
|
|
254
|
-
content = [content];
|
|
255
|
-
}
|
|
256
|
-
this.contentView = new DialogContentView(this.locale);
|
|
257
|
-
this.contentView.children.addMany(content);
|
|
258
|
-
this.parts.add(this.contentView);
|
|
259
|
-
}
|
|
260
|
-
if (actionButtons) {
|
|
261
|
-
this.actionsView = new DialogActionsView(this.locale);
|
|
262
|
-
this.actionsView.setButtons(actionButtons);
|
|
263
|
-
this.parts.add(this.actionsView);
|
|
264
|
-
}
|
|
265
|
-
this._updateFocusCyclableItems();
|
|
266
|
-
}
|
|
267
|
-
/**
|
|
268
|
-
* Focuses the first focusable element inside the dialog.
|
|
269
|
-
*/
|
|
270
|
-
focus() {
|
|
271
|
-
this._focusCycler.focusFirst();
|
|
272
|
-
}
|
|
273
|
-
/**
|
|
274
|
-
* Normalizes the passed coordinates to make sure the dialog view
|
|
275
|
-
* is displayed within the visible viewport and moves it there.
|
|
276
|
-
*
|
|
277
|
-
* @internal
|
|
278
|
-
*/
|
|
279
|
-
moveTo(left, top) {
|
|
280
|
-
const viewportRect = this._getViewportRect();
|
|
281
|
-
const dialogRect = this._getDialogRect();
|
|
282
|
-
// Don't let the dialog go beyond the right edge of the viewport.
|
|
283
|
-
if (left + dialogRect.width > viewportRect.right) {
|
|
284
|
-
left = viewportRect.right - dialogRect.width;
|
|
285
|
-
}
|
|
286
|
-
// Don't let the dialog go beyond the left edge of the viewport.
|
|
287
|
-
if (left < viewportRect.left) {
|
|
288
|
-
left = viewportRect.left;
|
|
289
|
-
}
|
|
290
|
-
// Don't let the dialog go beyond the top edge of the viewport.
|
|
291
|
-
if (top < viewportRect.top) {
|
|
292
|
-
top = viewportRect.top;
|
|
293
|
-
}
|
|
294
|
-
// Note: We don't do the same for the bottom edge to allow users to resize the window vertically
|
|
295
|
-
// and let the dialog to stay put instead of covering the editing root.
|
|
296
|
-
this._moveTo(left, top);
|
|
297
|
-
}
|
|
298
|
-
/**
|
|
299
|
-
* Moves the dialog to the specified coordinates.
|
|
300
|
-
*/
|
|
301
|
-
_moveTo(left, top) {
|
|
302
|
-
this._left = left;
|
|
303
|
-
this._top = top;
|
|
304
|
-
}
|
|
305
|
-
/**
|
|
306
|
-
* Moves the dialog by the specified offset.
|
|
307
|
-
*
|
|
308
|
-
* @internal
|
|
309
|
-
*/
|
|
310
|
-
moveBy(left, top) {
|
|
311
|
-
this.moveTo(this._left + left, this._top + top);
|
|
312
|
-
}
|
|
313
|
-
/**
|
|
314
|
-
* Moves the dialog view to the off-screen position.
|
|
315
|
-
* Used when there is no space to display the dialog.
|
|
316
|
-
*/
|
|
317
|
-
_moveOffScreen() {
|
|
318
|
-
this._moveTo(-9999, -9999);
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* Recalculates the dialog according to the set position and viewport,
|
|
322
|
-
* and moves it to the new position.
|
|
323
|
-
*/
|
|
324
|
-
updatePosition() {
|
|
325
|
-
if (!this.element || !this.element.parentNode) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
const viewportRect = this._getViewportRect();
|
|
329
|
-
// Actual position may be different from the configured one if there's no DOM root.
|
|
330
|
-
let configuredPosition = this.position;
|
|
331
|
-
let domRootRect;
|
|
332
|
-
if (!this._getCurrentDomRoot()) {
|
|
333
|
-
configuredPosition = DialogViewPosition.SCREEN_CENTER;
|
|
334
|
-
}
|
|
335
|
-
else {
|
|
336
|
-
domRootRect = this._getVisibleDomRootRect(viewportRect);
|
|
337
|
-
}
|
|
338
|
-
const defaultOffset = DialogView.defaultOffset;
|
|
339
|
-
const dialogRect = this._getDialogRect();
|
|
340
|
-
if (this.position == null) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
else if (typeof this.position == 'function') {
|
|
344
|
-
const coords = this.position(dialogRect, domRootRect);
|
|
345
|
-
if (coords == null) {
|
|
346
|
-
this._moveOffScreen();
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
this._moveTo(coords.left, coords.top);
|
|
350
|
-
return;
|
|
351
|
-
}
|
|
352
|
-
// @if CK_DEBUG_DIALOG // RectDrawer.clear();
|
|
353
|
-
// @if CK_DEBUG_DIALOG // RectDrawer.draw( viewportRect, { outlineColor: 'blue' }, 'Viewport' );
|
|
354
|
-
switch (configuredPosition) {
|
|
355
|
-
case DialogViewPosition.EDITOR_TOP_SIDE: {
|
|
356
|
-
// @if CK_DEBUG_DIALOG // if ( domRootRect ) {
|
|
357
|
-
// @if CK_DEBUG_DIALOG // RectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );
|
|
358
|
-
// @if CK_DEBUG_DIALOG // }
|
|
359
|
-
if (domRootRect) {
|
|
360
|
-
const leftCoordinate = this.locale.contentLanguageDirection === 'ltr' ?
|
|
361
|
-
domRootRect.right - dialogRect.width - defaultOffset :
|
|
362
|
-
domRootRect.left + defaultOffset;
|
|
363
|
-
this.moveTo(leftCoordinate, domRootRect.top + defaultOffset);
|
|
364
|
-
}
|
|
365
|
-
else {
|
|
366
|
-
this._moveOffScreen();
|
|
367
|
-
}
|
|
368
|
-
break;
|
|
369
|
-
}
|
|
370
|
-
case DialogViewPosition.EDITOR_CENTER: {
|
|
371
|
-
if (domRootRect) {
|
|
372
|
-
this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), Math.round(domRootRect.top + domRootRect.height / 2 - dialogRect.height / 2));
|
|
373
|
-
}
|
|
374
|
-
else {
|
|
375
|
-
this._moveOffScreen();
|
|
376
|
-
}
|
|
377
|
-
break;
|
|
378
|
-
}
|
|
379
|
-
case DialogViewPosition.SCREEN_CENTER: {
|
|
380
|
-
this.moveTo(Math.round((viewportRect.width - dialogRect.width) / 2), Math.round((viewportRect.height - dialogRect.height) / 2));
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
case DialogViewPosition.EDITOR_TOP_CENTER: {
|
|
384
|
-
// @if CK_DEBUG_DIALOG // if ( domRootRect ) {
|
|
385
|
-
// @if CK_DEBUG_DIALOG // RectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );
|
|
386
|
-
// @if CK_DEBUG_DIALOG // }
|
|
387
|
-
if (domRootRect) {
|
|
388
|
-
this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), domRootRect.top + defaultOffset);
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
391
|
-
this._moveOffScreen();
|
|
392
|
-
}
|
|
393
|
-
break;
|
|
394
|
-
}
|
|
395
|
-
case DialogViewPosition.EDITOR_BOTTOM_CENTER: {
|
|
396
|
-
// @if CK_DEBUG_DIALOG // if ( domRootRect ) {
|
|
397
|
-
// @if CK_DEBUG_DIALOG // RectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );
|
|
398
|
-
// @if CK_DEBUG_DIALOG // }
|
|
399
|
-
if (domRootRect) {
|
|
400
|
-
this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), domRootRect.bottom - dialogRect.height - defaultOffset);
|
|
401
|
-
}
|
|
402
|
-
else {
|
|
403
|
-
this._moveOffScreen();
|
|
404
|
-
}
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
case DialogViewPosition.EDITOR_ABOVE_CENTER: {
|
|
408
|
-
// @if CK_DEBUG_DIALOG // if ( domRootRect ) {
|
|
409
|
-
// @if CK_DEBUG_DIALOG // RectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );
|
|
410
|
-
// @if CK_DEBUG_DIALOG // }
|
|
411
|
-
if (domRootRect) {
|
|
412
|
-
this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), domRootRect.top - dialogRect.height - defaultOffset);
|
|
413
|
-
}
|
|
414
|
-
else {
|
|
415
|
-
this._moveOffScreen();
|
|
416
|
-
}
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
case DialogViewPosition.EDITOR_BELOW_CENTER: {
|
|
420
|
-
// @if CK_DEBUG_DIALOG // if ( domRootRect ) {
|
|
421
|
-
// @if CK_DEBUG_DIALOG // RectDrawer.draw( domRootRect, { outlineColor: 'red', zIndex: 9999999 }, 'DOM ROOT' );
|
|
422
|
-
// @if CK_DEBUG_DIALOG // }
|
|
423
|
-
if (domRootRect) {
|
|
424
|
-
this.moveTo(Math.round(domRootRect.left + domRootRect.width / 2 - dialogRect.width / 2), domRootRect.bottom + defaultOffset);
|
|
425
|
-
}
|
|
426
|
-
else {
|
|
427
|
-
this._moveOffScreen();
|
|
428
|
-
}
|
|
429
|
-
break;
|
|
430
|
-
}
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Calculates the visible DOM root part.
|
|
435
|
-
*/
|
|
436
|
-
_getVisibleDomRootRect(viewportRect) {
|
|
437
|
-
let visibleDomRootRect = new Rect(this._getCurrentDomRoot()).getVisible();
|
|
438
|
-
if (!visibleDomRootRect) {
|
|
439
|
-
return null;
|
|
440
|
-
}
|
|
441
|
-
else {
|
|
442
|
-
visibleDomRootRect = viewportRect.getIntersection(visibleDomRootRect);
|
|
443
|
-
if (!visibleDomRootRect) {
|
|
444
|
-
return null;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
return visibleDomRootRect;
|
|
448
|
-
}
|
|
449
|
-
/**
|
|
450
|
-
* Calculates the dialog element rect.
|
|
451
|
-
*/
|
|
452
|
-
_getDialogRect() {
|
|
453
|
-
return new Rect(this.element.firstElementChild);
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Returns a viewport `Rect` shrunk by the viewport offset config from all sides.
|
|
457
|
-
*/
|
|
458
|
-
_getViewportRect() {
|
|
459
|
-
const viewportRect = new Rect(global.window);
|
|
460
|
-
// Modals should not be restricted by the viewport offsets as they are always displayed on top of the page.
|
|
461
|
-
if (this.isModal) {
|
|
462
|
-
return viewportRect;
|
|
463
|
-
}
|
|
464
|
-
return getConstrainedViewportRect(this._getViewportOffset());
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Collects all focusable elements inside the dialog parts
|
|
468
|
-
* and adds them to the focus tracker and focus cycler.
|
|
469
|
-
*/
|
|
470
|
-
_updateFocusCyclableItems() {
|
|
471
|
-
const focusables = [];
|
|
472
|
-
if (this.contentView) {
|
|
473
|
-
for (const child of this.contentView.children) {
|
|
474
|
-
if (isFocusable(child)) {
|
|
475
|
-
focusables.push(child);
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
if (this.actionsView) {
|
|
480
|
-
focusables.push(this.actionsView);
|
|
481
|
-
}
|
|
482
|
-
if (this.closeButtonView) {
|
|
483
|
-
focusables.push(this.closeButtonView);
|
|
484
|
-
}
|
|
485
|
-
focusables.forEach(focusable => {
|
|
486
|
-
this._focusables.add(focusable);
|
|
487
|
-
this.focusTracker.add(focusable.element);
|
|
488
|
-
if (isViewWithFocusCycler(focusable)) {
|
|
489
|
-
this._focusCycler.chain(focusable.focusCycler);
|
|
490
|
-
}
|
|
491
|
-
});
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Creates the close button view that is displayed in the header view corner.
|
|
495
|
-
*/
|
|
496
|
-
_createCloseButton() {
|
|
497
|
-
const buttonView = new ButtonView(this.locale);
|
|
498
|
-
const t = this.locale.t;
|
|
499
|
-
buttonView.set({
|
|
500
|
-
label: t('Close'),
|
|
501
|
-
tooltip: true,
|
|
502
|
-
icon: IconCancel
|
|
503
|
-
});
|
|
504
|
-
buttonView.on('execute', () => this.fire('close', { source: 'closeButton' }));
|
|
505
|
-
return buttonView;
|
|
506
|
-
}
|
|
507
|
-
}
|
|
@@ -1,70 +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/dropdown/button/dropdownbuttonview
|
|
7
|
-
*/
|
|
8
|
-
import { IconDropdownArrow } from '@ckeditor/ckeditor5-icons';
|
|
9
|
-
import { ButtonView } from '../../button/buttonview.js';
|
|
10
|
-
import { IconView } from '../../icon/iconview.js';
|
|
11
|
-
/**
|
|
12
|
-
* The default dropdown button view class.
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* const view = new DropdownButtonView();
|
|
16
|
-
*
|
|
17
|
-
* view.set( {
|
|
18
|
-
* label: 'A button',
|
|
19
|
-
* keystroke: 'Ctrl+B',
|
|
20
|
-
* tooltip: true
|
|
21
|
-
* } );
|
|
22
|
-
*
|
|
23
|
-
* view.render();
|
|
24
|
-
*
|
|
25
|
-
* document.body.append( view.element );
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* Also see the {@link module:ui/dropdown/utils~createDropdown `createDropdown()` util}.
|
|
29
|
-
*/
|
|
30
|
-
export class DropdownButtonView extends ButtonView {
|
|
31
|
-
/**
|
|
32
|
-
* An icon that displays arrow to indicate a dropdown button.
|
|
33
|
-
*/
|
|
34
|
-
arrowView;
|
|
35
|
-
/**
|
|
36
|
-
* @inheritDoc
|
|
37
|
-
*/
|
|
38
|
-
constructor(locale) {
|
|
39
|
-
super(locale);
|
|
40
|
-
this.arrowView = this._createArrowView();
|
|
41
|
-
this.extendTemplate({
|
|
42
|
-
attributes: {
|
|
43
|
-
'aria-haspopup': true,
|
|
44
|
-
'aria-expanded': this.bindTemplate.to('isOn', value => String(value))
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
// The DropdownButton interface expects the open event upon which will open the dropdown.
|
|
48
|
-
this.delegate('execute').to(this, 'open');
|
|
49
|
-
}
|
|
50
|
-
/**
|
|
51
|
-
* @inheritDoc
|
|
52
|
-
*/
|
|
53
|
-
render() {
|
|
54
|
-
super.render();
|
|
55
|
-
this.children.add(this.arrowView);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Creates a {@link module:ui/icon/iconview~IconView} instance as {@link #arrowView}.
|
|
59
|
-
*/
|
|
60
|
-
_createArrowView() {
|
|
61
|
-
const arrowView = new IconView();
|
|
62
|
-
arrowView.content = IconDropdownArrow;
|
|
63
|
-
arrowView.extendTemplate({
|
|
64
|
-
attributes: {
|
|
65
|
-
class: 'ck-dropdown__arrow'
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return arrowView;
|
|
69
|
-
}
|
|
70
|
-
}
|