@atlaskit/editor-plugin-block-menu 5.2.11 → 5.2.13
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 +17 -0
- package/dist/cjs/editor-commands/transform-node-utils/transform.js +2 -1
- package/dist/cjs/editor-commands/transform-node-utils/utils.js +1 -53
- package/dist/cjs/editor-commands/transformNode.js +4 -4
- package/dist/cjs/ui/block-menu-renderer/BlockMenuComponent.js +37 -0
- package/dist/cjs/ui/block-menu-renderer/BlockMenuComponents.js +29 -0
- package/dist/cjs/ui/block-menu-renderer/BlockMenuRenderer.js +33 -0
- package/dist/cjs/ui/block-menu-renderer/fallbacks.js +32 -0
- package/dist/cjs/ui/block-menu-renderer/types.js +5 -0
- package/dist/cjs/ui/block-menu-renderer/utils.js +127 -0
- package/dist/cjs/ui/block-menu.js +7 -20
- package/dist/cjs/ui/copy-link.js +7 -11
- package/dist/cjs/ui/hooks/useSuggestedItems.js +11 -4
- package/dist/cjs/ui/utils/copyLink.js +4 -4
- package/dist/cjs/ui/utils/suggested-items-rank.js +1 -1
- package/dist/es2019/editor-commands/transform-node-utils/transform.js +2 -1
- package/dist/es2019/editor-commands/transform-node-utils/utils.js +0 -54
- package/dist/es2019/editor-commands/transformNode.js +2 -2
- package/dist/es2019/ui/block-menu-renderer/BlockMenuComponent.js +31 -0
- package/dist/es2019/ui/block-menu-renderer/BlockMenuComponents.js +21 -0
- package/dist/es2019/ui/block-menu-renderer/BlockMenuRenderer.js +24 -0
- package/dist/es2019/ui/block-menu-renderer/fallbacks.js +21 -0
- package/dist/es2019/ui/block-menu-renderer/types.js +1 -0
- package/dist/es2019/ui/block-menu-renderer/utils.js +93 -0
- package/dist/es2019/ui/block-menu.js +6 -13
- package/dist/es2019/ui/copy-link.js +7 -11
- package/dist/es2019/ui/hooks/useSuggestedItems.js +10 -5
- package/dist/es2019/ui/utils/copyLink.js +3 -4
- package/dist/es2019/ui/utils/suggested-items-rank.js +0 -5
- package/dist/esm/editor-commands/transform-node-utils/transform.js +2 -1
- package/dist/esm/editor-commands/transform-node-utils/utils.js +0 -52
- package/dist/esm/editor-commands/transformNode.js +2 -2
- package/dist/esm/ui/block-menu-renderer/BlockMenuComponent.js +30 -0
- package/dist/esm/ui/block-menu-renderer/BlockMenuComponents.js +22 -0
- package/dist/esm/ui/block-menu-renderer/BlockMenuRenderer.js +25 -0
- package/dist/esm/ui/block-menu-renderer/fallbacks.js +25 -0
- package/dist/esm/ui/block-menu-renderer/types.js +1 -0
- package/dist/esm/ui/block-menu-renderer/utils.js +121 -0
- package/dist/esm/ui/block-menu.js +6 -19
- package/dist/esm/ui/copy-link.js +7 -11
- package/dist/esm/ui/hooks/useSuggestedItems.js +12 -5
- package/dist/esm/ui/utils/copyLink.js +4 -4
- package/dist/esm/ui/utils/suggested-items-rank.js +1 -1
- package/dist/types/blockMenuPluginType.d.ts +3 -2
- package/dist/types/editor-commands/transform-node-utils/utils.d.ts +1 -17
- package/dist/types/ui/block-menu-renderer/BlockMenuComponent.d.ts +11 -0
- package/dist/types/ui/block-menu-renderer/BlockMenuComponents.d.ts +12 -0
- package/dist/types/ui/block-menu-renderer/BlockMenuRenderer.d.ts +12 -0
- package/dist/types/ui/block-menu-renderer/fallbacks.d.ts +2 -0
- package/dist/types/ui/block-menu-renderer/types.d.ts +27 -0
- package/dist/types/ui/block-menu-renderer/utils.d.ts +37 -0
- package/dist/types/ui/utils/copyLink.d.ts +1 -3
- package/dist/types-ts4.5/blockMenuPluginType.d.ts +3 -2
- package/dist/types-ts4.5/editor-commands/transform-node-utils/utils.d.ts +1 -17
- package/dist/types-ts4.5/ui/block-menu-renderer/BlockMenuComponent.d.ts +11 -0
- package/dist/types-ts4.5/ui/block-menu-renderer/BlockMenuComponents.d.ts +12 -0
- package/dist/types-ts4.5/ui/block-menu-renderer/BlockMenuRenderer.d.ts +12 -0
- package/dist/types-ts4.5/ui/block-menu-renderer/fallbacks.d.ts +2 -0
- package/dist/types-ts4.5/ui/block-menu-renderer/types.d.ts +27 -0
- package/dist/types-ts4.5/ui/block-menu-renderer/utils.d.ts +37 -0
- package/dist/types-ts4.5/ui/utils/copyLink.d.ts +1 -3
- package/package.json +1 -1
- package/dist/cjs/ui/block-menu-renderer.js +0 -104
- package/dist/es2019/ui/block-menu-renderer.js +0 -83
- package/dist/esm/ui/block-menu-renderer.js +0 -95
- package/dist/types/ui/block-menu-renderer.d.ts +0 -18
- package/dist/types-ts4.5/ui/block-menu-renderer.d.ts +0 -18
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
1
|
import type { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
3
2
|
type CopyLinkOptions = {
|
|
4
3
|
blockLinkHashPrefix?: string;
|
|
5
4
|
getLinkPath?: () => string | null;
|
|
6
|
-
schema: Schema;
|
|
7
5
|
selection: Selection;
|
|
8
6
|
};
|
|
9
|
-
export declare const copyLink: ({ getLinkPath, blockLinkHashPrefix, selection,
|
|
7
|
+
export declare const copyLink: ({ getLinkPath, blockLinkHashPrefix, selection, }: CopyLinkOptions) => Promise<boolean>;
|
|
10
8
|
export {};
|
package/package.json
CHANGED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.BlockMenuRenderer = void 0;
|
|
9
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
-
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
12
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
13
|
-
var NoOp = function NoOp() {
|
|
14
|
-
return null;
|
|
15
|
-
};
|
|
16
|
-
var isNonNestedMenuSection = function isNonNestedMenuSection(component) {
|
|
17
|
-
return component.type === 'block-menu-section' && !('parent' in component);
|
|
18
|
-
};
|
|
19
|
-
var isMenuItem = function isMenuItem(component) {
|
|
20
|
-
return component.type === 'block-menu-item';
|
|
21
|
-
};
|
|
22
|
-
var isNestedMenu = function isNestedMenu(component) {
|
|
23
|
-
return component.type === 'block-menu-nested';
|
|
24
|
-
};
|
|
25
|
-
var isNestedMenuSection = function isNestedMenuSection(component) {
|
|
26
|
-
return 'parent' in component && component.parent !== undefined && component.parent.type === 'block-menu-nested';
|
|
27
|
-
};
|
|
28
|
-
var getSortedChildren = function getSortedChildren(components, parentKey) {
|
|
29
|
-
return components.filter(function (component) {
|
|
30
|
-
return 'parent' in component && component.parent !== undefined && component.parent.key === parentKey;
|
|
31
|
-
}).sort(function (a, b) {
|
|
32
|
-
return (a.parent.rank || 0) - (b.parent.rank || 0);
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
var getSortedNestedSections = function getSortedNestedSections(components, parentKey) {
|
|
36
|
-
var nestedMenuSections = components.filter(isNestedMenuSection);
|
|
37
|
-
var nestedMenuSectionsWithParent = nestedMenuSections.filter(function (section) {
|
|
38
|
-
return section.parent !== undefined;
|
|
39
|
-
});
|
|
40
|
-
return getSortedChildren(nestedMenuSectionsWithParent, parentKey);
|
|
41
|
-
};
|
|
42
|
-
var getSortedNonNestedSections = function getSortedNonNestedSections(components) {
|
|
43
|
-
return components.filter(isNonNestedMenuSection).sort(function (a, b) {
|
|
44
|
-
return (a.rank || 0) - (b.rank || 0);
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
var BlockMenuRenderer = exports.BlockMenuRenderer = function BlockMenuRenderer(_ref) {
|
|
48
|
-
var components = _ref.components,
|
|
49
|
-
fallbacks = _ref.fallbacks;
|
|
50
|
-
var menuSections = getSortedNonNestedSections(components);
|
|
51
|
-
var menuItems = components.filter(isMenuItem);
|
|
52
|
-
var nestedMenus = components.filter(isNestedMenu);
|
|
53
|
-
var renderMenu = function renderMenu() {
|
|
54
|
-
return /*#__PURE__*/_react.default.createElement(_react.Fragment, null, menuSections.map(function (section) {
|
|
55
|
-
// Get all items for the current section, including nested menus, and sort them by rank
|
|
56
|
-
var currentSectionItemsSorted = getSortedChildren([].concat((0, _toConsumableArray2.default)(menuItems), (0, _toConsumableArray2.default)(nestedMenus)), section.key);
|
|
57
|
-
if (currentSectionItemsSorted.length === 0) {
|
|
58
|
-
return null;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// iterate over the current section items, if it is nested menu, get their children, sort them
|
|
62
|
-
// if they are menu items, just render as they are sorted above
|
|
63
|
-
var getChildrenWithNestedItems = function getChildrenWithNestedItems(items) {
|
|
64
|
-
return items.map(function (item) {
|
|
65
|
-
if (isNestedMenu(item)) {
|
|
66
|
-
var sortedNestedSections = getSortedNestedSections(components, item.key);
|
|
67
|
-
var sections = sortedNestedSections.map(function (section) {
|
|
68
|
-
var sortedNestedMenuItems = getSortedChildren(menuItems, section.key);
|
|
69
|
-
if (sortedNestedMenuItems.length === 0) {
|
|
70
|
-
return null;
|
|
71
|
-
}
|
|
72
|
-
var NestedSection = section.component || fallbacks.section || NoOp;
|
|
73
|
-
return /*#__PURE__*/_react.default.createElement(NestedSection, {
|
|
74
|
-
key: section.key
|
|
75
|
-
}, sortedNestedMenuItems.map(function (nestedItem) {
|
|
76
|
-
var NestedMenuItemComponent = nestedItem.component || fallbacks.item || NoOp;
|
|
77
|
-
return /*#__PURE__*/_react.default.createElement(NestedMenuItemComponent, {
|
|
78
|
-
key: nestedItem.key
|
|
79
|
-
});
|
|
80
|
-
}));
|
|
81
|
-
});
|
|
82
|
-
var NestedMenuComponent = item.component || fallbacks.nestedMenu || NoOp;
|
|
83
|
-
return /*#__PURE__*/_react.default.createElement(NestedMenuComponent, {
|
|
84
|
-
key: item.key
|
|
85
|
-
}, sections);
|
|
86
|
-
} else {
|
|
87
|
-
var ItemComponent = item.component || fallbacks.item || NoOp;
|
|
88
|
-
return /*#__PURE__*/_react.default.createElement(ItemComponent, {
|
|
89
|
-
key: item.key
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
var children = getChildrenWithNestedItems(currentSectionItemsSorted);
|
|
95
|
-
var SectionComponent = section.component || fallbacks.section || NoOp;
|
|
96
|
-
return /*#__PURE__*/_react.default.createElement(SectionComponent, {
|
|
97
|
-
key: section.key
|
|
98
|
-
}, children);
|
|
99
|
-
}));
|
|
100
|
-
};
|
|
101
|
-
return /*#__PURE__*/_react.default.createElement(_uiMenu.ArrowKeyNavigationProvider, {
|
|
102
|
-
type: _uiMenu.ArrowKeyNavigationType.MENU
|
|
103
|
-
}, renderMenu());
|
|
104
|
-
};
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import React, { Fragment } from 'react';
|
|
2
|
-
import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
const NoOp = () => null;
|
|
4
|
-
const isNonNestedMenuSection = component => {
|
|
5
|
-
return component.type === 'block-menu-section' && !('parent' in component);
|
|
6
|
-
};
|
|
7
|
-
const isMenuItem = component => {
|
|
8
|
-
return component.type === 'block-menu-item';
|
|
9
|
-
};
|
|
10
|
-
const isNestedMenu = component => {
|
|
11
|
-
return component.type === 'block-menu-nested';
|
|
12
|
-
};
|
|
13
|
-
const isNestedMenuSection = component => {
|
|
14
|
-
return 'parent' in component && component.parent !== undefined && component.parent.type === 'block-menu-nested';
|
|
15
|
-
};
|
|
16
|
-
const getSortedChildren = (components, parentKey) => components.filter(component => 'parent' in component && component.parent !== undefined && component.parent.key === parentKey).sort((a, b) => (a.parent.rank || 0) - (b.parent.rank || 0));
|
|
17
|
-
const getSortedNestedSections = (components, parentKey) => {
|
|
18
|
-
const nestedMenuSections = components.filter(isNestedMenuSection);
|
|
19
|
-
const nestedMenuSectionsWithParent = nestedMenuSections.filter(section => section.parent !== undefined);
|
|
20
|
-
return getSortedChildren(nestedMenuSectionsWithParent, parentKey);
|
|
21
|
-
};
|
|
22
|
-
const getSortedNonNestedSections = components => {
|
|
23
|
-
return components.filter(isNonNestedMenuSection).sort((a, b) => (a.rank || 0) - (b.rank || 0));
|
|
24
|
-
};
|
|
25
|
-
export const BlockMenuRenderer = ({
|
|
26
|
-
components,
|
|
27
|
-
fallbacks
|
|
28
|
-
}) => {
|
|
29
|
-
const menuSections = getSortedNonNestedSections(components);
|
|
30
|
-
const menuItems = components.filter(isMenuItem);
|
|
31
|
-
const nestedMenus = components.filter(isNestedMenu);
|
|
32
|
-
const renderMenu = () => {
|
|
33
|
-
return /*#__PURE__*/React.createElement(Fragment, null, menuSections.map(section => {
|
|
34
|
-
// Get all items for the current section, including nested menus, and sort them by rank
|
|
35
|
-
const currentSectionItemsSorted = getSortedChildren([...menuItems, ...nestedMenus], section.key);
|
|
36
|
-
if (currentSectionItemsSorted.length === 0) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// iterate over the current section items, if it is nested menu, get their children, sort them
|
|
41
|
-
// if they are menu items, just render as they are sorted above
|
|
42
|
-
const getChildrenWithNestedItems = items => {
|
|
43
|
-
return items.map(item => {
|
|
44
|
-
if (isNestedMenu(item)) {
|
|
45
|
-
const sortedNestedSections = getSortedNestedSections(components, item.key);
|
|
46
|
-
const sections = sortedNestedSections.map(section => {
|
|
47
|
-
const sortedNestedMenuItems = getSortedChildren(menuItems, section.key);
|
|
48
|
-
if (sortedNestedMenuItems.length === 0) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
const NestedSection = section.component || fallbacks.section || NoOp;
|
|
52
|
-
return /*#__PURE__*/React.createElement(NestedSection, {
|
|
53
|
-
key: section.key
|
|
54
|
-
}, sortedNestedMenuItems.map(nestedItem => {
|
|
55
|
-
const NestedMenuItemComponent = nestedItem.component || fallbacks.item || NoOp;
|
|
56
|
-
return /*#__PURE__*/React.createElement(NestedMenuItemComponent, {
|
|
57
|
-
key: nestedItem.key
|
|
58
|
-
});
|
|
59
|
-
}));
|
|
60
|
-
});
|
|
61
|
-
const NestedMenuComponent = item.component || fallbacks.nestedMenu || NoOp;
|
|
62
|
-
return /*#__PURE__*/React.createElement(NestedMenuComponent, {
|
|
63
|
-
key: item.key
|
|
64
|
-
}, sections);
|
|
65
|
-
} else {
|
|
66
|
-
const ItemComponent = item.component || fallbacks.item || NoOp;
|
|
67
|
-
return /*#__PURE__*/React.createElement(ItemComponent, {
|
|
68
|
-
key: item.key
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
};
|
|
73
|
-
const children = getChildrenWithNestedItems(currentSectionItemsSorted);
|
|
74
|
-
const SectionComponent = section.component || fallbacks.section || NoOp;
|
|
75
|
-
return /*#__PURE__*/React.createElement(SectionComponent, {
|
|
76
|
-
key: section.key
|
|
77
|
-
}, children);
|
|
78
|
-
}));
|
|
79
|
-
};
|
|
80
|
-
return /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
|
|
81
|
-
type: ArrowKeyNavigationType.MENU
|
|
82
|
-
}, renderMenu());
|
|
83
|
-
};
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import React, { Fragment } from 'react';
|
|
3
|
-
import { ArrowKeyNavigationProvider, ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
|
|
4
|
-
var NoOp = function NoOp() {
|
|
5
|
-
return null;
|
|
6
|
-
};
|
|
7
|
-
var isNonNestedMenuSection = function isNonNestedMenuSection(component) {
|
|
8
|
-
return component.type === 'block-menu-section' && !('parent' in component);
|
|
9
|
-
};
|
|
10
|
-
var isMenuItem = function isMenuItem(component) {
|
|
11
|
-
return component.type === 'block-menu-item';
|
|
12
|
-
};
|
|
13
|
-
var isNestedMenu = function isNestedMenu(component) {
|
|
14
|
-
return component.type === 'block-menu-nested';
|
|
15
|
-
};
|
|
16
|
-
var isNestedMenuSection = function isNestedMenuSection(component) {
|
|
17
|
-
return 'parent' in component && component.parent !== undefined && component.parent.type === 'block-menu-nested';
|
|
18
|
-
};
|
|
19
|
-
var getSortedChildren = function getSortedChildren(components, parentKey) {
|
|
20
|
-
return components.filter(function (component) {
|
|
21
|
-
return 'parent' in component && component.parent !== undefined && component.parent.key === parentKey;
|
|
22
|
-
}).sort(function (a, b) {
|
|
23
|
-
return (a.parent.rank || 0) - (b.parent.rank || 0);
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var getSortedNestedSections = function getSortedNestedSections(components, parentKey) {
|
|
27
|
-
var nestedMenuSections = components.filter(isNestedMenuSection);
|
|
28
|
-
var nestedMenuSectionsWithParent = nestedMenuSections.filter(function (section) {
|
|
29
|
-
return section.parent !== undefined;
|
|
30
|
-
});
|
|
31
|
-
return getSortedChildren(nestedMenuSectionsWithParent, parentKey);
|
|
32
|
-
};
|
|
33
|
-
var getSortedNonNestedSections = function getSortedNonNestedSections(components) {
|
|
34
|
-
return components.filter(isNonNestedMenuSection).sort(function (a, b) {
|
|
35
|
-
return (a.rank || 0) - (b.rank || 0);
|
|
36
|
-
});
|
|
37
|
-
};
|
|
38
|
-
export var BlockMenuRenderer = function BlockMenuRenderer(_ref) {
|
|
39
|
-
var components = _ref.components,
|
|
40
|
-
fallbacks = _ref.fallbacks;
|
|
41
|
-
var menuSections = getSortedNonNestedSections(components);
|
|
42
|
-
var menuItems = components.filter(isMenuItem);
|
|
43
|
-
var nestedMenus = components.filter(isNestedMenu);
|
|
44
|
-
var renderMenu = function renderMenu() {
|
|
45
|
-
return /*#__PURE__*/React.createElement(Fragment, null, menuSections.map(function (section) {
|
|
46
|
-
// Get all items for the current section, including nested menus, and sort them by rank
|
|
47
|
-
var currentSectionItemsSorted = getSortedChildren([].concat(_toConsumableArray(menuItems), _toConsumableArray(nestedMenus)), section.key);
|
|
48
|
-
if (currentSectionItemsSorted.length === 0) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// iterate over the current section items, if it is nested menu, get their children, sort them
|
|
53
|
-
// if they are menu items, just render as they are sorted above
|
|
54
|
-
var getChildrenWithNestedItems = function getChildrenWithNestedItems(items) {
|
|
55
|
-
return items.map(function (item) {
|
|
56
|
-
if (isNestedMenu(item)) {
|
|
57
|
-
var sortedNestedSections = getSortedNestedSections(components, item.key);
|
|
58
|
-
var sections = sortedNestedSections.map(function (section) {
|
|
59
|
-
var sortedNestedMenuItems = getSortedChildren(menuItems, section.key);
|
|
60
|
-
if (sortedNestedMenuItems.length === 0) {
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
var NestedSection = section.component || fallbacks.section || NoOp;
|
|
64
|
-
return /*#__PURE__*/React.createElement(NestedSection, {
|
|
65
|
-
key: section.key
|
|
66
|
-
}, sortedNestedMenuItems.map(function (nestedItem) {
|
|
67
|
-
var NestedMenuItemComponent = nestedItem.component || fallbacks.item || NoOp;
|
|
68
|
-
return /*#__PURE__*/React.createElement(NestedMenuItemComponent, {
|
|
69
|
-
key: nestedItem.key
|
|
70
|
-
});
|
|
71
|
-
}));
|
|
72
|
-
});
|
|
73
|
-
var NestedMenuComponent = item.component || fallbacks.nestedMenu || NoOp;
|
|
74
|
-
return /*#__PURE__*/React.createElement(NestedMenuComponent, {
|
|
75
|
-
key: item.key
|
|
76
|
-
}, sections);
|
|
77
|
-
} else {
|
|
78
|
-
var ItemComponent = item.component || fallbacks.item || NoOp;
|
|
79
|
-
return /*#__PURE__*/React.createElement(ItemComponent, {
|
|
80
|
-
key: item.key
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
var children = getChildrenWithNestedItems(currentSectionItemsSorted);
|
|
86
|
-
var SectionComponent = section.component || fallbacks.section || NoOp;
|
|
87
|
-
return /*#__PURE__*/React.createElement(SectionComponent, {
|
|
88
|
-
key: section.key
|
|
89
|
-
}, children);
|
|
90
|
-
}));
|
|
91
|
-
};
|
|
92
|
-
return /*#__PURE__*/React.createElement(ArrowKeyNavigationProvider, {
|
|
93
|
-
type: ArrowKeyNavigationType.MENU
|
|
94
|
-
}, renderMenu());
|
|
95
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { RegisterBlockMenuComponent, BlockMenuNestedComponent, BlockMenuSectionComponent, BlockMenuItemComponent } from '../blockMenuPluginType';
|
|
3
|
-
type BlockMenuProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Every registered block menu component
|
|
6
|
-
*/
|
|
7
|
-
components: RegisterBlockMenuComponent[];
|
|
8
|
-
/**
|
|
9
|
-
* Fallback components used in rendering
|
|
10
|
-
*/
|
|
11
|
-
fallbacks: {
|
|
12
|
-
item: BlockMenuItemComponent;
|
|
13
|
-
nestedMenu: BlockMenuNestedComponent;
|
|
14
|
-
section: BlockMenuSectionComponent;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare const BlockMenuRenderer: ({ components, fallbacks }: BlockMenuProps) => React.JSX.Element;
|
|
18
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { RegisterBlockMenuComponent, BlockMenuNestedComponent, BlockMenuSectionComponent, BlockMenuItemComponent } from '../blockMenuPluginType';
|
|
3
|
-
type BlockMenuProps = {
|
|
4
|
-
/**
|
|
5
|
-
* Every registered block menu component
|
|
6
|
-
*/
|
|
7
|
-
components: RegisterBlockMenuComponent[];
|
|
8
|
-
/**
|
|
9
|
-
* Fallback components used in rendering
|
|
10
|
-
*/
|
|
11
|
-
fallbacks: {
|
|
12
|
-
item: BlockMenuItemComponent;
|
|
13
|
-
nestedMenu: BlockMenuNestedComponent;
|
|
14
|
-
section: BlockMenuSectionComponent;
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
export declare const BlockMenuRenderer: ({ components, fallbacks }: BlockMenuProps) => React.JSX.Element;
|
|
18
|
-
export {};
|