@ckeditor/ckeditor5-ui 43.0.0-alpha.6 → 43.1.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/dist/bindings/clickoutsidehandler.d.ts +5 -3
- package/dist/dropdown/dropdownview.d.ts +21 -8
- package/dist/dropdown/menu/dropdownmenubehaviors.d.ts +48 -0
- package/dist/dropdown/menu/dropdownmenubuttonview.d.ts +40 -0
- package/dist/dropdown/menu/dropdownmenulistitembuttonview.d.ts +21 -0
- package/dist/dropdown/menu/dropdownmenulistitemview.d.ts +26 -0
- package/dist/dropdown/menu/dropdownmenulistview.d.ts +28 -0
- package/dist/dropdown/menu/dropdownmenunestedmenupanelview.d.ts +38 -0
- package/dist/dropdown/menu/dropdownmenunestedmenuview.d.ts +135 -0
- package/dist/dropdown/menu/dropdownmenurootlistview.d.ts +144 -0
- package/dist/dropdown/menu/utils.d.ts +128 -0
- package/dist/dropdown/utils.d.ts +58 -0
- package/dist/editableui/editableuiview.d.ts +1 -1
- package/dist/editableui/inline/inlineeditableuiview.d.ts +13 -9
- package/dist/editorui/editorui.d.ts +4 -0
- package/dist/index-editor.css +16 -0
- package/dist/index.css +31 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +4717 -3869
- package/dist/index.js.map +1 -1
- package/dist/menubar/utils.d.ts +5 -5
- package/dist/panel/balloon/contextualballoon.d.ts +12 -6
- package/dist/toolbar/balloon/balloontoolbar.d.ts +5 -0
- package/dist/translations/af.js +1 -1
- package/dist/translations/af.umd.js +1 -1
- package/dist/translations/ar.js +1 -1
- package/dist/translations/ar.umd.js +1 -1
- package/dist/translations/ast.js +1 -1
- package/dist/translations/ast.umd.js +1 -1
- package/dist/translations/az.js +1 -1
- package/dist/translations/az.umd.js +1 -1
- package/dist/translations/bg.js +1 -1
- package/dist/translations/bg.umd.js +1 -1
- package/dist/translations/bn.js +1 -1
- package/dist/translations/bn.umd.js +1 -1
- package/dist/translations/bs.js +1 -1
- package/dist/translations/bs.umd.js +1 -1
- package/dist/translations/ca.js +1 -1
- package/dist/translations/ca.umd.js +1 -1
- package/dist/translations/cs.js +1 -1
- package/dist/translations/cs.umd.js +1 -1
- package/dist/translations/da.js +1 -1
- package/dist/translations/da.umd.js +1 -1
- package/dist/translations/de-ch.js +1 -1
- package/dist/translations/de-ch.umd.js +1 -1
- package/dist/translations/de.js +1 -1
- package/dist/translations/de.umd.js +1 -1
- package/dist/translations/el.js +1 -1
- package/dist/translations/el.umd.js +1 -1
- package/dist/translations/en-au.js +1 -1
- package/dist/translations/en-au.umd.js +1 -1
- package/dist/translations/en-gb.js +1 -1
- package/dist/translations/en-gb.umd.js +1 -1
- package/dist/translations/en.js +1 -1
- package/dist/translations/en.umd.js +1 -1
- package/dist/translations/eo.js +1 -1
- package/dist/translations/eo.umd.js +1 -1
- package/dist/translations/es-co.js +1 -1
- package/dist/translations/es-co.umd.js +1 -1
- package/dist/translations/es.js +1 -1
- package/dist/translations/es.umd.js +1 -1
- package/dist/translations/et.js +1 -1
- package/dist/translations/et.umd.js +1 -1
- package/dist/translations/eu.js +1 -1
- package/dist/translations/eu.umd.js +1 -1
- package/dist/translations/fa.js +1 -1
- package/dist/translations/fa.umd.js +1 -1
- package/dist/translations/fi.js +1 -1
- package/dist/translations/fi.umd.js +1 -1
- package/dist/translations/fr.js +1 -1
- package/dist/translations/fr.umd.js +1 -1
- package/dist/translations/gl.js +1 -1
- package/dist/translations/gl.umd.js +1 -1
- package/dist/translations/he.js +1 -1
- package/dist/translations/he.umd.js +1 -1
- package/dist/translations/hi.js +1 -1
- package/dist/translations/hi.umd.js +1 -1
- package/dist/translations/hr.js +1 -1
- package/dist/translations/hr.umd.js +1 -1
- package/dist/translations/hu.js +1 -1
- package/dist/translations/hu.umd.js +1 -1
- package/dist/translations/id.js +1 -1
- package/dist/translations/id.umd.js +1 -1
- package/dist/translations/it.js +1 -1
- package/dist/translations/it.umd.js +1 -1
- package/dist/translations/ja.js +1 -1
- package/dist/translations/ja.umd.js +1 -1
- package/dist/translations/jv.js +1 -1
- package/dist/translations/jv.umd.js +1 -1
- package/dist/translations/km.js +1 -1
- package/dist/translations/km.umd.js +1 -1
- package/dist/translations/kn.js +1 -1
- package/dist/translations/kn.umd.js +1 -1
- package/dist/translations/ko.js +1 -1
- package/dist/translations/ko.umd.js +1 -1
- package/dist/translations/ku.js +1 -1
- package/dist/translations/ku.umd.js +1 -1
- package/dist/translations/lt.js +1 -1
- package/dist/translations/lt.umd.js +1 -1
- package/dist/translations/lv.js +1 -1
- package/dist/translations/lv.umd.js +1 -1
- package/dist/translations/ms.js +1 -1
- package/dist/translations/ms.umd.js +1 -1
- package/dist/translations/nb.js +1 -1
- package/dist/translations/nb.umd.js +1 -1
- package/dist/translations/ne.js +1 -1
- package/dist/translations/ne.umd.js +1 -1
- package/dist/translations/nl.js +1 -1
- package/dist/translations/nl.umd.js +1 -1
- package/dist/translations/no.js +1 -1
- package/dist/translations/no.umd.js +1 -1
- package/dist/translations/pl.js +1 -1
- package/dist/translations/pl.umd.js +1 -1
- package/dist/translations/pt-br.js +1 -1
- package/dist/translations/pt-br.umd.js +1 -1
- package/dist/translations/pt.js +1 -1
- package/dist/translations/pt.umd.js +1 -1
- package/dist/translations/ro.js +1 -1
- package/dist/translations/ro.umd.js +1 -1
- package/dist/translations/ru.js +1 -1
- package/dist/translations/ru.umd.js +1 -1
- package/dist/translations/sk.js +1 -1
- package/dist/translations/sk.umd.js +1 -1
- package/dist/translations/sl.js +1 -1
- package/dist/translations/sl.umd.js +1 -1
- package/dist/translations/sq.js +1 -1
- package/dist/translations/sq.umd.js +1 -1
- package/dist/translations/sr-latn.js +1 -1
- package/dist/translations/sr-latn.umd.js +1 -1
- package/dist/translations/sr.js +1 -1
- package/dist/translations/sr.umd.js +1 -1
- package/dist/translations/sv.js +1 -1
- package/dist/translations/sv.umd.js +1 -1
- package/dist/translations/th.js +1 -1
- package/dist/translations/th.umd.js +1 -1
- package/dist/translations/ti.js +1 -1
- package/dist/translations/ti.umd.js +1 -1
- package/dist/translations/tk.js +1 -1
- package/dist/translations/tk.umd.js +1 -1
- package/dist/translations/tr.js +1 -1
- package/dist/translations/tr.umd.js +1 -1
- package/dist/translations/tt.js +1 -1
- package/dist/translations/tt.umd.js +1 -1
- package/dist/translations/ug.js +1 -1
- package/dist/translations/ug.umd.js +1 -1
- package/dist/translations/uk.js +1 -1
- package/dist/translations/uk.umd.js +1 -1
- package/dist/translations/ur.js +1 -1
- package/dist/translations/ur.umd.js +1 -1
- package/dist/translations/uz.js +1 -1
- package/dist/translations/uz.umd.js +1 -1
- package/dist/translations/vi.js +1 -1
- package/dist/translations/vi.umd.js +1 -1
- package/dist/translations/zh-cn.js +1 -1
- package/dist/translations/zh-cn.umd.js +1 -1
- package/dist/translations/zh.js +1 -1
- package/dist/translations/zh.umd.js +1 -1
- package/lang/contexts.json +1 -1
- package/lang/translations/af.po +4 -4
- package/lang/translations/ar.po +4 -4
- package/lang/translations/ast.po +4 -4
- package/lang/translations/az.po +4 -4
- package/lang/translations/bg.po +4 -4
- package/lang/translations/bn.po +4 -4
- package/lang/translations/bs.po +4 -4
- package/lang/translations/ca.po +4 -4
- package/lang/translations/cs.po +4 -4
- package/lang/translations/da.po +4 -4
- package/lang/translations/de-ch.po +4 -4
- package/lang/translations/de.po +4 -4
- package/lang/translations/el.po +4 -4
- package/lang/translations/en-au.po +4 -4
- package/lang/translations/en-gb.po +4 -4
- package/lang/translations/en.po +4 -4
- package/lang/translations/eo.po +4 -4
- package/lang/translations/es-co.po +4 -4
- package/lang/translations/es.po +4 -4
- package/lang/translations/et.po +4 -4
- package/lang/translations/eu.po +4 -4
- package/lang/translations/fa.po +4 -4
- package/lang/translations/fi.po +4 -4
- package/lang/translations/fr.po +4 -4
- package/lang/translations/gl.po +4 -4
- package/lang/translations/he.po +4 -4
- package/lang/translations/hi.po +4 -4
- package/lang/translations/hr.po +4 -4
- package/lang/translations/hu.po +4 -4
- package/lang/translations/id.po +4 -4
- package/lang/translations/it.po +4 -4
- package/lang/translations/ja.po +4 -4
- package/lang/translations/jv.po +4 -4
- package/lang/translations/km.po +4 -4
- package/lang/translations/kn.po +4 -4
- package/lang/translations/ko.po +4 -4
- package/lang/translations/ku.po +4 -4
- package/lang/translations/lt.po +4 -4
- package/lang/translations/lv.po +4 -4
- package/lang/translations/ms.po +4 -4
- package/lang/translations/nb.po +4 -4
- package/lang/translations/ne.po +4 -4
- package/lang/translations/nl.po +4 -4
- package/lang/translations/no.po +4 -4
- package/lang/translations/pl.po +4 -4
- package/lang/translations/pt-br.po +4 -4
- package/lang/translations/pt.po +4 -4
- package/lang/translations/ro.po +4 -4
- package/lang/translations/ru.po +4 -4
- package/lang/translations/sk.po +4 -4
- package/lang/translations/sl.po +4 -4
- package/lang/translations/sq.po +4 -4
- package/lang/translations/sr-latn.po +4 -4
- package/lang/translations/sr.po +4 -4
- package/lang/translations/sv.po +4 -4
- package/lang/translations/th.po +4 -4
- package/lang/translations/ti.po +4 -4
- package/lang/translations/tk.po +4 -4
- package/lang/translations/tr.po +4 -4
- package/lang/translations/tt.po +4 -4
- package/lang/translations/ug.po +4 -4
- package/lang/translations/uk.po +4 -4
- package/lang/translations/ur.po +4 -4
- package/lang/translations/uz.po +4 -4
- package/lang/translations/vi.po +4 -4
- package/lang/translations/zh-cn.po +4 -4
- package/lang/translations/zh.po +4 -4
- package/package.json +4 -3
- package/src/bindings/clickoutsidehandler.d.ts +5 -3
- package/src/bindings/clickoutsidehandler.js +3 -2
- package/src/dialog/dialog.js +0 -1
- package/src/dropdown/dropdownview.d.ts +21 -8
- package/src/dropdown/menu/dropdownmenubehaviors.d.ts +44 -0
- package/src/dropdown/menu/dropdownmenubehaviors.js +119 -0
- package/src/dropdown/menu/dropdownmenubuttonview.d.ts +36 -0
- package/src/dropdown/menu/dropdownmenubuttonview.js +65 -0
- package/src/dropdown/menu/dropdownmenulistitembuttonview.d.ts +17 -0
- package/src/dropdown/menu/dropdownmenulistitembuttonview.js +29 -0
- package/src/dropdown/menu/dropdownmenulistitemview.d.ts +22 -0
- package/src/dropdown/menu/dropdownmenulistitemview.js +34 -0
- package/src/dropdown/menu/dropdownmenulistview.d.ts +24 -0
- package/src/dropdown/menu/dropdownmenulistview.js +29 -0
- package/src/dropdown/menu/dropdownmenunestedmenupanelview.d.ts +34 -0
- package/src/dropdown/menu/dropdownmenunestedmenupanelview.js +63 -0
- package/src/dropdown/menu/dropdownmenunestedmenuview.d.ts +131 -0
- package/src/dropdown/menu/dropdownmenunestedmenuview.js +191 -0
- package/src/dropdown/menu/dropdownmenurootlistview.d.ts +140 -0
- package/src/dropdown/menu/dropdownmenurootlistview.js +160 -0
- package/src/dropdown/menu/utils.d.ts +124 -0
- package/src/dropdown/menu/utils.js +61 -0
- package/src/dropdown/utils.d.ts +58 -0
- package/src/dropdown/utils.js +101 -18
- package/src/editableui/editableuiview.d.ts +1 -1
- package/src/editableui/inline/inlineeditableuiview.d.ts +13 -9
- package/src/editableui/inline/inlineeditableuiview.js +29 -6
- package/src/editorui/accessibilityhelp/accessibilityhelp.js +3 -1
- package/src/editorui/editorui.d.ts +4 -0
- package/src/editorui/editorui.js +16 -1
- package/src/editorui/poweredby.js +0 -1
- package/src/index.d.ts +7 -1
- package/src/index.js +6 -0
- package/src/menubar/menubarmenuview.js +1 -0
- package/src/menubar/utils.d.ts +5 -5
- package/src/menubar/utils.js +21 -12
- package/src/panel/balloon/balloonpanelview.js +19 -12
- package/src/panel/balloon/contextualballoon.d.ts +12 -6
- package/src/panel/balloon/contextualballoon.js +24 -24
- package/src/toolbar/balloon/balloontoolbar.d.ts +5 -0
- package/src/toolbar/balloon/balloontoolbar.js +26 -5
- package/src/toolbar/block/blocktoolbar.js +0 -2
- package/theme/components/dropdown/menu/dropdownmenu.css +8 -0
- package/theme/components/dropdown/menu/dropdownmenubutton.css +9 -0
- package/theme/components/dropdown/menu/dropdownmenulistitem.css +10 -0
- package/theme/components/dropdown/menu/dropdownmenulistitembutton.css +10 -0
- package/theme/components/dropdown/menu/dropdownmenupanel.css +11 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/dropdown/menu/dropdownmenubuttonview
|
|
7
|
+
*/
|
|
8
|
+
import IconView from '../../icon/iconview.js';
|
|
9
|
+
import ListItemButtonView from '../../button/listitembuttonview.js';
|
|
10
|
+
import dropdownArrowIcon from '../../../theme/icons/dropdown-arrow.svg';
|
|
11
|
+
import '../../../theme/components/dropdown/menu/dropdownmenubutton.css';
|
|
12
|
+
/**
|
|
13
|
+
* Represents a view for a dropdown menu button.
|
|
14
|
+
*/
|
|
15
|
+
export default class DropdownMenuButtonView extends ListItemButtonView {
|
|
16
|
+
/**
|
|
17
|
+
* Creates an instance of the dropdown menu button view.
|
|
18
|
+
*
|
|
19
|
+
* @param locale The localization services instance.
|
|
20
|
+
*/
|
|
21
|
+
constructor(locale) {
|
|
22
|
+
super(locale);
|
|
23
|
+
const bind = this.bindTemplate;
|
|
24
|
+
this.set({
|
|
25
|
+
withText: true,
|
|
26
|
+
role: 'menuitem'
|
|
27
|
+
});
|
|
28
|
+
this.arrowView = this._createArrowView();
|
|
29
|
+
this.extendTemplate({
|
|
30
|
+
attributes: {
|
|
31
|
+
class: [
|
|
32
|
+
'ck-dropdown-menu-list__nested-menu__button'
|
|
33
|
+
],
|
|
34
|
+
'aria-haspopup': true,
|
|
35
|
+
'aria-expanded': this.bindTemplate.to('isOn', value => String(value)),
|
|
36
|
+
'data-cke-tooltip-disabled': bind.to('isOn')
|
|
37
|
+
},
|
|
38
|
+
on: {
|
|
39
|
+
'mouseenter': bind.to('mouseenter')
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* @inheritDoc
|
|
45
|
+
*/
|
|
46
|
+
render() {
|
|
47
|
+
super.render();
|
|
48
|
+
this.children.add(this.arrowView);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Creates the arrow view instance.
|
|
52
|
+
*
|
|
53
|
+
* @private
|
|
54
|
+
*/
|
|
55
|
+
_createArrowView() {
|
|
56
|
+
const arrowView = new IconView();
|
|
57
|
+
arrowView.content = dropdownArrowIcon;
|
|
58
|
+
arrowView.extendTemplate({
|
|
59
|
+
attributes: {
|
|
60
|
+
class: 'ck-dropdown-menu-list__nested-menu__button__arrow'
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
return arrowView;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/dropdown/menu/dropdownmenulistitembuttonview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
import ButtonView from '../../button/buttonview.js';
|
|
10
|
+
import '../../../theme/components/dropdown/menu/dropdownmenulistitembutton.css';
|
|
11
|
+
/**
|
|
12
|
+
* Represents a view for a button in a dropdown menu list item.
|
|
13
|
+
*/
|
|
14
|
+
export default class DropdownMenuListItemButtonView extends ButtonView {
|
|
15
|
+
readonly id: string;
|
|
16
|
+
constructor(locale: Locale, id: string, label: string);
|
|
17
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import ButtonView from '../../button/buttonview.js';
|
|
6
|
+
import '../../../theme/components/dropdown/menu/dropdownmenulistitembutton.css';
|
|
7
|
+
/**
|
|
8
|
+
* Represents a view for a button in a dropdown menu list item.
|
|
9
|
+
*/
|
|
10
|
+
export default class DropdownMenuListItemButtonView extends ButtonView {
|
|
11
|
+
constructor(locale, id, label) {
|
|
12
|
+
super(locale);
|
|
13
|
+
this.id = id;
|
|
14
|
+
this.set({
|
|
15
|
+
withText: true,
|
|
16
|
+
withKeystroke: true,
|
|
17
|
+
tooltip: false,
|
|
18
|
+
role: 'menuitem',
|
|
19
|
+
label
|
|
20
|
+
});
|
|
21
|
+
this.extendTemplate({
|
|
22
|
+
attributes: {
|
|
23
|
+
class: [
|
|
24
|
+
'ck-dropdown-menu-list__nested-menu__item__button'
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/dropdown/menu/dropdownmenulistitemview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
import type DropdownMenuNestedMenuView from './dropdownmenunestedmenuview.js';
|
|
10
|
+
import ListItemView from '../../list/listitemview.js';
|
|
11
|
+
import DropdownMenuListItemButtonView from './dropdownmenulistitembuttonview.js';
|
|
12
|
+
import '../../../theme/components/dropdown/menu/dropdownmenulistitem.css';
|
|
13
|
+
/**
|
|
14
|
+
* Represents a view for a single item in a dropdown menu list.
|
|
15
|
+
*/
|
|
16
|
+
export default class DropdownMenuListItemView extends ListItemView {
|
|
17
|
+
/**
|
|
18
|
+
* The view representing either a flat item or a nested menu in a dropdown menu list item.
|
|
19
|
+
*/
|
|
20
|
+
readonly childView: DropdownMenuNestedMenuView | DropdownMenuListItemButtonView;
|
|
21
|
+
constructor(locale: Locale, parentMenuView: DropdownMenuNestedMenuView | null, childView: DropdownMenuNestedMenuView | DropdownMenuListItemButtonView);
|
|
22
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import ListItemView from '../../list/listitemview.js';
|
|
6
|
+
import DropdownMenuListItemButtonView from './dropdownmenulistitembuttonview.js';
|
|
7
|
+
import '../../../theme/components/dropdown/menu/dropdownmenulistitem.css';
|
|
8
|
+
/**
|
|
9
|
+
* Represents a view for a single item in a dropdown menu list.
|
|
10
|
+
*/
|
|
11
|
+
export default class DropdownMenuListItemView extends ListItemView {
|
|
12
|
+
constructor(locale, parentMenuView, childView) {
|
|
13
|
+
super(locale);
|
|
14
|
+
const bind = this.bindTemplate;
|
|
15
|
+
this.childView = childView;
|
|
16
|
+
this.children.add(childView);
|
|
17
|
+
this.extendTemplate({
|
|
18
|
+
attributes: {
|
|
19
|
+
class: [
|
|
20
|
+
'ck-dropdown-menu-list__nested-menu__item'
|
|
21
|
+
]
|
|
22
|
+
},
|
|
23
|
+
on: {
|
|
24
|
+
'mouseenter': bind.to('mouseenter')
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
if (parentMenuView) {
|
|
28
|
+
this.delegate('mouseenter').to(parentMenuView);
|
|
29
|
+
if (childView instanceof DropdownMenuListItemButtonView) {
|
|
30
|
+
childView.delegate('execute').to(parentMenuView);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/dropdown/menu/dropdownmenulistview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
import ListView from '../../list/listview.js';
|
|
10
|
+
/**
|
|
11
|
+
* Represents a dropdown menu list view.
|
|
12
|
+
*/
|
|
13
|
+
export default class DropdownMenuListView extends ListView {
|
|
14
|
+
/**
|
|
15
|
+
* Represents whether the dropdown menu list view is visible or not.
|
|
16
|
+
*/
|
|
17
|
+
isVisible: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Creates an instance of the dropdown menu list view.
|
|
20
|
+
*
|
|
21
|
+
* @param locale The localization services instance.
|
|
22
|
+
*/
|
|
23
|
+
constructor(locale: Locale);
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import ListView from '../../list/listview.js';
|
|
6
|
+
/**
|
|
7
|
+
* Represents a dropdown menu list view.
|
|
8
|
+
*/
|
|
9
|
+
export default class DropdownMenuListView extends ListView {
|
|
10
|
+
/**
|
|
11
|
+
* Creates an instance of the dropdown menu list view.
|
|
12
|
+
*
|
|
13
|
+
* @param locale The localization services instance.
|
|
14
|
+
*/
|
|
15
|
+
constructor(locale) {
|
|
16
|
+
super(locale);
|
|
17
|
+
const bind = this.bindTemplate;
|
|
18
|
+
this.role = 'menu';
|
|
19
|
+
this.set('isVisible', true);
|
|
20
|
+
this.extendTemplate({
|
|
21
|
+
attributes: {
|
|
22
|
+
class: [
|
|
23
|
+
'ck-dropdown-menu-list',
|
|
24
|
+
bind.if('isVisible', 'ck-hidden', value => !value)
|
|
25
|
+
]
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/dropdown/menu/dropdownmenunestedmenupanelview
|
|
7
|
+
*/
|
|
8
|
+
import type { Locale } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
import type { FocusableView } from '../../focuscycler.js';
|
|
10
|
+
import BalloonPanelView from '../../panel/balloon/balloonpanelview.js';
|
|
11
|
+
import '../../../theme/components/dropdown/menu/dropdownmenupanel.css';
|
|
12
|
+
/**
|
|
13
|
+
* Represents the view for the dropdown menu panel.
|
|
14
|
+
*/
|
|
15
|
+
export default class DropdownMenuNestedMenuPanelView extends BalloonPanelView implements FocusableView {
|
|
16
|
+
/**
|
|
17
|
+
* Creates an instance of the menu panel view.
|
|
18
|
+
*
|
|
19
|
+
* @param locale The localization services instance.
|
|
20
|
+
*/
|
|
21
|
+
constructor(locale?: Locale);
|
|
22
|
+
/**
|
|
23
|
+
* Focuses the first child of the panel (default) or the last one if the `direction` is `-1`.
|
|
24
|
+
*
|
|
25
|
+
* @param direction The direction to focus. Default is `1`.
|
|
26
|
+
*/
|
|
27
|
+
focus(direction?: -1 | 1): void;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* The names of the positions of the {@link module:ui/dropdown/menu/dropdownmenunestedmenupanelview~DropdownMenuNestedMenuPanelView}.
|
|
31
|
+
*
|
|
32
|
+
* They are reflected as CSS class suffixes on the panel view element.
|
|
33
|
+
*/
|
|
34
|
+
export type DropdownMenuNestedMenuPanelPosition = 'es' | 'ws' | 'en' | 'wn' | 'w' | 'e';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
import BalloonPanelView from '../../panel/balloon/balloonpanelview.js';
|
|
6
|
+
import '../../../theme/components/dropdown/menu/dropdownmenupanel.css';
|
|
7
|
+
/**
|
|
8
|
+
* Represents the view for the dropdown menu panel.
|
|
9
|
+
*/
|
|
10
|
+
export default class DropdownMenuNestedMenuPanelView extends BalloonPanelView {
|
|
11
|
+
/**
|
|
12
|
+
* Creates an instance of the menu panel view.
|
|
13
|
+
*
|
|
14
|
+
* @param locale The localization services instance.
|
|
15
|
+
*/
|
|
16
|
+
constructor(locale) {
|
|
17
|
+
super(locale);
|
|
18
|
+
const bind = this.bindTemplate;
|
|
19
|
+
this.set({
|
|
20
|
+
isVisible: false,
|
|
21
|
+
position: 'se',
|
|
22
|
+
class: null,
|
|
23
|
+
top: 0,
|
|
24
|
+
left: 0
|
|
25
|
+
});
|
|
26
|
+
this.extendTemplate({
|
|
27
|
+
tag: 'div',
|
|
28
|
+
attributes: {
|
|
29
|
+
class: [
|
|
30
|
+
'ck-reset',
|
|
31
|
+
'ck-dropdown-menu__nested-menu__panel'
|
|
32
|
+
],
|
|
33
|
+
tabindex: '-1'
|
|
34
|
+
},
|
|
35
|
+
on: {
|
|
36
|
+
// Drag and drop in the panel should not break the selection in the editor.
|
|
37
|
+
// https://github.com/ckeditor/ckeditor5-ui/issues/228
|
|
38
|
+
selectstart: bind.to(evt => {
|
|
39
|
+
if (evt.target.tagName.toLocaleLowerCase() === 'input') {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
evt.preventDefault();
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Focuses the first child of the panel (default) or the last one if the `direction` is `-1`.
|
|
49
|
+
*
|
|
50
|
+
* @param direction The direction to focus. Default is `1`.
|
|
51
|
+
*/
|
|
52
|
+
focus(direction = 1) {
|
|
53
|
+
const { content } = this;
|
|
54
|
+
if (content.length) {
|
|
55
|
+
if (direction === 1) {
|
|
56
|
+
content.first.focus();
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
content.last.focus();
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/dropdown/menu/dropdownmenunestedmenuview
|
|
7
|
+
*/
|
|
8
|
+
import { FocusTracker, KeystrokeHandler, type PositioningFunction, type Locale } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
import type { FocusableView } from '../../focuscycler.js';
|
|
10
|
+
import type BodyCollection from '../../editorui/bodycollection.js';
|
|
11
|
+
import DropdownMenuButtonView from './dropdownmenubuttonview.js';
|
|
12
|
+
import DropdownMenuListView from './dropdownmenulistview.js';
|
|
13
|
+
import View from '../../view.js';
|
|
14
|
+
import DropdownMenuNestedMenuPanelView, { type DropdownMenuNestedMenuPanelPosition } from './dropdownmenunestedmenupanelview.js';
|
|
15
|
+
import '../../../theme/components/dropdown/menu/dropdownmenu.css';
|
|
16
|
+
/**
|
|
17
|
+
* Represents a nested menu view.
|
|
18
|
+
*/
|
|
19
|
+
export default class DropdownMenuNestedMenuView extends View implements FocusableView {
|
|
20
|
+
/**
|
|
21
|
+
* An array of delegated events for the dropdown menu definition controller.
|
|
22
|
+
* These events are delegated to the dropdown menu element.
|
|
23
|
+
*/
|
|
24
|
+
static readonly DELEGATED_EVENTS: readonly ["mouseenter", "execute", "change:isOpen"];
|
|
25
|
+
readonly id: string;
|
|
26
|
+
/**
|
|
27
|
+
* Button of the menu view.
|
|
28
|
+
*/
|
|
29
|
+
readonly buttonView: DropdownMenuButtonView;
|
|
30
|
+
/**
|
|
31
|
+
* Panel of the menu. It hosts children of the menu.
|
|
32
|
+
*/
|
|
33
|
+
readonly panelView: DropdownMenuNestedMenuPanelView;
|
|
34
|
+
/**
|
|
35
|
+
* List of nested menu entries.
|
|
36
|
+
*/
|
|
37
|
+
readonly listView: DropdownMenuListView;
|
|
38
|
+
/**
|
|
39
|
+
* Tracks information about the DOM focus in the menu.
|
|
40
|
+
*/
|
|
41
|
+
readonly focusTracker: FocusTracker;
|
|
42
|
+
/**
|
|
43
|
+
* Instance of the {@link module:utils/keystrokehandler~KeystrokeHandler}. It manages
|
|
44
|
+
* keystrokes of the menu.
|
|
45
|
+
*/
|
|
46
|
+
readonly keystrokes: KeystrokeHandler;
|
|
47
|
+
/**
|
|
48
|
+
* Controls whether the menu is open, i.e. shows or hides the {@link #panelView panel}.
|
|
49
|
+
*
|
|
50
|
+
* @observable
|
|
51
|
+
*/
|
|
52
|
+
isOpen: boolean;
|
|
53
|
+
/**
|
|
54
|
+
* Controls whether the menu is enabled, i.e. its {@link #buttonView} can be clicked.
|
|
55
|
+
*
|
|
56
|
+
* @observable
|
|
57
|
+
*/
|
|
58
|
+
isEnabled: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* (Optional) The additional CSS class set on the menu {@link #element}.
|
|
61
|
+
*
|
|
62
|
+
* @observable
|
|
63
|
+
*/
|
|
64
|
+
class: string | undefined;
|
|
65
|
+
/**
|
|
66
|
+
* The name of the position of the {@link #panelView}, relative to the menu.
|
|
67
|
+
*
|
|
68
|
+
* **Note**: The value is updated each time the panel gets {@link #isOpen open}.
|
|
69
|
+
*
|
|
70
|
+
* @observable
|
|
71
|
+
* @default 'w'
|
|
72
|
+
*/
|
|
73
|
+
panelPosition: DropdownMenuNestedMenuPanelPosition;
|
|
74
|
+
/**
|
|
75
|
+
* The parent menu view of the menu. It is `null` for top-level menus.
|
|
76
|
+
*
|
|
77
|
+
* @observable
|
|
78
|
+
* @default null
|
|
79
|
+
*/
|
|
80
|
+
readonly parentMenuView: DropdownMenuNestedMenuView | null;
|
|
81
|
+
private _bodyCollection;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a new instance of the DropdownMenuView class.
|
|
84
|
+
*
|
|
85
|
+
* @param locale
|
|
86
|
+
* @param bodyCollection
|
|
87
|
+
* @param id
|
|
88
|
+
* @param label The label for the dropdown menu button.
|
|
89
|
+
* @param parentMenuView The parent dropdown menu view, if any.
|
|
90
|
+
*/
|
|
91
|
+
constructor(locale: Locale, bodyCollection: BodyCollection, id: string, label: string, parentMenuView: DropdownMenuNestedMenuView | null);
|
|
92
|
+
/**
|
|
93
|
+
* An array of positioning functions used to determine the position of the dropdown menu panel.
|
|
94
|
+
* The order of the functions in the array determines the priority of the positions to be tried.
|
|
95
|
+
* The first function that returns a valid position will be used.
|
|
96
|
+
*
|
|
97
|
+
* @returns {Array<PositioningFunction>} An array of positioning functions.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
get _panelPositions(): Array<PositioningFunction>;
|
|
101
|
+
/**
|
|
102
|
+
* @inheritDoc
|
|
103
|
+
*/
|
|
104
|
+
render(): void;
|
|
105
|
+
/**
|
|
106
|
+
* @inheritDoc
|
|
107
|
+
*/
|
|
108
|
+
destroy(): void;
|
|
109
|
+
/**
|
|
110
|
+
* @inheritDoc
|
|
111
|
+
*/
|
|
112
|
+
focus(): void;
|
|
113
|
+
private _handleParentMenuView;
|
|
114
|
+
/**
|
|
115
|
+
* Attach all keyboard behaviors for the menu view.
|
|
116
|
+
*/
|
|
117
|
+
private _attachBehaviors;
|
|
118
|
+
/**
|
|
119
|
+
* Mounts the portal view in the body when the menu is open and removes it when the menu is closed.
|
|
120
|
+
* Binds keystrokes to the portal view when the menu is open.
|
|
121
|
+
*/
|
|
122
|
+
private _mountPanelOnOpen;
|
|
123
|
+
/**
|
|
124
|
+
* Removes the panel view from the editor's body and removes it from the focus tracker.
|
|
125
|
+
*/
|
|
126
|
+
private _removePanelFromBody;
|
|
127
|
+
/**
|
|
128
|
+
* Adds the panel view to the editor's body and sets up event listeners.
|
|
129
|
+
*/
|
|
130
|
+
private _addPanelToBody;
|
|
131
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* @module ui/dropdown/menu/dropdownmenunestedmenuview
|
|
7
|
+
*/
|
|
8
|
+
import { FocusTracker, KeystrokeHandler, global } from '@ckeditor/ckeditor5-utils';
|
|
9
|
+
import DropdownMenuButtonView from './dropdownmenubuttonview.js';
|
|
10
|
+
import DropdownMenuListView from './dropdownmenulistview.js';
|
|
11
|
+
import { DropdownMenuPanelPositioningFunctions } from './utils.js';
|
|
12
|
+
import { DropdownMenuBehaviors } from './dropdownmenubehaviors.js';
|
|
13
|
+
import View from '../../view.js';
|
|
14
|
+
import DropdownMenuNestedMenuPanelView from './dropdownmenunestedmenupanelview.js';
|
|
15
|
+
import '../../../theme/components/dropdown/menu/dropdownmenu.css';
|
|
16
|
+
/**
|
|
17
|
+
* Represents a nested menu view.
|
|
18
|
+
*/
|
|
19
|
+
class DropdownMenuNestedMenuView extends View {
|
|
20
|
+
/**
|
|
21
|
+
* Creates a new instance of the DropdownMenuView class.
|
|
22
|
+
*
|
|
23
|
+
* @param locale
|
|
24
|
+
* @param bodyCollection
|
|
25
|
+
* @param id
|
|
26
|
+
* @param label The label for the dropdown menu button.
|
|
27
|
+
* @param parentMenuView The parent dropdown menu view, if any.
|
|
28
|
+
*/
|
|
29
|
+
constructor(locale, bodyCollection, id, label, parentMenuView) {
|
|
30
|
+
super(locale);
|
|
31
|
+
this._bodyCollection = bodyCollection;
|
|
32
|
+
this.id = id;
|
|
33
|
+
this.set({
|
|
34
|
+
isOpen: false,
|
|
35
|
+
isEnabled: true,
|
|
36
|
+
panelPosition: 'w',
|
|
37
|
+
class: undefined,
|
|
38
|
+
parentMenuView: null
|
|
39
|
+
});
|
|
40
|
+
this.keystrokes = new KeystrokeHandler();
|
|
41
|
+
this.focusTracker = new FocusTracker();
|
|
42
|
+
this.buttonView = new DropdownMenuButtonView(locale);
|
|
43
|
+
this.buttonView.delegate('mouseenter').to(this);
|
|
44
|
+
this.buttonView.bind('isOn', 'isEnabled').to(this, 'isOpen', 'isEnabled');
|
|
45
|
+
this.buttonView.label = label;
|
|
46
|
+
this.panelView = new DropdownMenuNestedMenuPanelView(locale);
|
|
47
|
+
this.panelView.isVisible = true;
|
|
48
|
+
this.listView = new DropdownMenuListView(locale);
|
|
49
|
+
this.listView.bind('ariaLabel').to(this.buttonView, 'label');
|
|
50
|
+
this.panelView.content.add(this.listView);
|
|
51
|
+
const bind = this.bindTemplate;
|
|
52
|
+
this.setTemplate({
|
|
53
|
+
tag: 'div',
|
|
54
|
+
attributes: {
|
|
55
|
+
class: [
|
|
56
|
+
'ck',
|
|
57
|
+
'ck-dropdown-menu-list__nested-menu',
|
|
58
|
+
bind.to('class'),
|
|
59
|
+
bind.if('isEnabled', 'ck-disabled', value => !value)
|
|
60
|
+
],
|
|
61
|
+
role: 'presentation'
|
|
62
|
+
},
|
|
63
|
+
children: [
|
|
64
|
+
this.buttonView
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
this.parentMenuView = parentMenuView;
|
|
68
|
+
if (this.parentMenuView) {
|
|
69
|
+
this._handleParentMenuView();
|
|
70
|
+
}
|
|
71
|
+
this._attachBehaviors();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* An array of positioning functions used to determine the position of the dropdown menu panel.
|
|
75
|
+
* The order of the functions in the array determines the priority of the positions to be tried.
|
|
76
|
+
* The first function that returns a valid position will be used.
|
|
77
|
+
*
|
|
78
|
+
* @returns {Array<PositioningFunction>} An array of positioning functions.
|
|
79
|
+
* @internal
|
|
80
|
+
*/
|
|
81
|
+
get _panelPositions() {
|
|
82
|
+
const { westSouth, eastSouth, westNorth, eastNorth } = DropdownMenuPanelPositioningFunctions;
|
|
83
|
+
if (this.locale.uiLanguageDirection === 'ltr') {
|
|
84
|
+
return [eastSouth, eastNorth, westSouth, westNorth];
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
return [westSouth, westNorth, eastSouth, eastNorth];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* @inheritDoc
|
|
92
|
+
*/
|
|
93
|
+
render() {
|
|
94
|
+
super.render();
|
|
95
|
+
this.panelView.render();
|
|
96
|
+
this.focusTracker.add(this.buttonView.element);
|
|
97
|
+
this.focusTracker.add(this.panelView.element);
|
|
98
|
+
// Listen for keystrokes coming from within #element.
|
|
99
|
+
this.keystrokes.listenTo(this.element);
|
|
100
|
+
this._mountPanelOnOpen();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* @inheritDoc
|
|
104
|
+
*/
|
|
105
|
+
destroy() {
|
|
106
|
+
this._removePanelFromBody();
|
|
107
|
+
this.panelView.destroy();
|
|
108
|
+
super.destroy();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @inheritDoc
|
|
112
|
+
*/
|
|
113
|
+
focus() {
|
|
114
|
+
this.buttonView.focus();
|
|
115
|
+
}
|
|
116
|
+
_handleParentMenuView() {
|
|
117
|
+
// Propagate events from this component to parent-menu.
|
|
118
|
+
this.delegate(...DropdownMenuNestedMenuView.DELEGATED_EVENTS).to(this.parentMenuView);
|
|
119
|
+
// Close this menu if its parent closes.
|
|
120
|
+
DropdownMenuBehaviors.closeOnParentClose(this, this.parentMenuView);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Attach all keyboard behaviors for the menu view.
|
|
124
|
+
*/
|
|
125
|
+
_attachBehaviors() {
|
|
126
|
+
DropdownMenuBehaviors.openOnButtonClick(this);
|
|
127
|
+
DropdownMenuBehaviors.openAndFocusOnEnterKeyPress(this);
|
|
128
|
+
DropdownMenuBehaviors.openOnArrowRightKey(this);
|
|
129
|
+
DropdownMenuBehaviors.closeOnEscKey(this);
|
|
130
|
+
DropdownMenuBehaviors.closeOnArrowLeftKey(this);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Mounts the portal view in the body when the menu is open and removes it when the menu is closed.
|
|
134
|
+
* Binds keystrokes to the portal view when the menu is open.
|
|
135
|
+
*/
|
|
136
|
+
_mountPanelOnOpen() {
|
|
137
|
+
const { panelView } = this;
|
|
138
|
+
this.on('change:isOpen', (evt, name, isOpen) => {
|
|
139
|
+
// Ensure that the event was triggered by this instance.
|
|
140
|
+
// TODO: Remove checking `evt.source` if `change:isOpen` is no longer delegated.
|
|
141
|
+
if (evt.source !== this) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
// Removes the panel view from the body when the menu is closed.
|
|
145
|
+
if (!isOpen && this._bodyCollection.has(panelView)) {
|
|
146
|
+
this._removePanelFromBody();
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
// Adds the panel view to the body when the menu is open.
|
|
150
|
+
if (isOpen && !this._bodyCollection.has(panelView)) {
|
|
151
|
+
this._addPanelToBody();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Removes the panel view from the editor's body and removes it from the focus tracker.
|
|
157
|
+
*/
|
|
158
|
+
_removePanelFromBody() {
|
|
159
|
+
const { panelView, keystrokes } = this;
|
|
160
|
+
if (this._bodyCollection.has(panelView)) {
|
|
161
|
+
this._bodyCollection.remove(panelView);
|
|
162
|
+
keystrokes.stopListening(panelView.element);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Adds the panel view to the editor's body and sets up event listeners.
|
|
167
|
+
*/
|
|
168
|
+
_addPanelToBody() {
|
|
169
|
+
const { panelView, buttonView, keystrokes } = this;
|
|
170
|
+
if (!this._bodyCollection.has(panelView)) {
|
|
171
|
+
this._bodyCollection.add(panelView);
|
|
172
|
+
keystrokes.listenTo(panelView.element);
|
|
173
|
+
panelView.pin({
|
|
174
|
+
positions: this._panelPositions,
|
|
175
|
+
limiter: global.document.body,
|
|
176
|
+
element: panelView.element,
|
|
177
|
+
target: buttonView.element,
|
|
178
|
+
fitInViewport: true
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* An array of delegated events for the dropdown menu definition controller.
|
|
185
|
+
* These events are delegated to the dropdown menu element.
|
|
186
|
+
*/
|
|
187
|
+
// Due to some spaghetti code we need to delegate `change:isOpen`.
|
|
188
|
+
DropdownMenuNestedMenuView.DELEGATED_EVENTS = [
|
|
189
|
+
'mouseenter', 'execute', 'change:isOpen'
|
|
190
|
+
];
|
|
191
|
+
export default DropdownMenuNestedMenuView;
|