@atlaskit/editor-plugin-selection-extension 3.6.3 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +17 -0
- package/dist/cjs/ui/utils/registerBlockMenuItems.js +91 -15
- package/dist/es2019/ui/utils/registerBlockMenuItems.js +92 -15
- package/dist/esm/ui/utils/registerBlockMenuItems.js +92 -16
- package/dist/types/types/index.d.ts +5 -2
- package/dist/types/ui/extensions.d.ts +3 -3
- package/dist/types-ts4.5/types/index.d.ts +5 -2
- package/dist/types-ts4.5/ui/extensions.d.ts +3 -3
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-selection-extension
|
|
2
2
|
|
|
3
|
+
## 3.7.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`942b7b9e97c21`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/942b7b9e97c21) -
|
|
8
|
+
Support nested block menu via selection extension config
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
14
|
+
## 3.6.4
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 3.6.3
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
@@ -5,8 +5,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.registerBlockMenuItems = registerBlockMenuItems;
|
|
8
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
8
9
|
var _react = _interopRequireDefault(require("react"));
|
|
9
10
|
var _editorToolbar = require("@atlaskit/editor-toolbar");
|
|
11
|
+
var _chevronRight = _interopRequireDefault(require("@atlaskit/icon/core/chevron-right"));
|
|
10
12
|
var _extensions = require("../extensions");
|
|
11
13
|
function registerBlockMenuItems(extensionList, api) {
|
|
12
14
|
var blockMenuExtensions = (0, _extensions.getBlockMenuItemExtensions)(extensionList, 'first-party');
|
|
@@ -14,23 +16,97 @@ function registerBlockMenuItems(extensionList, api) {
|
|
|
14
16
|
return;
|
|
15
17
|
}
|
|
16
18
|
blockMenuExtensions.forEach(function (extension, index) {
|
|
17
|
-
var _api$blockMenu;
|
|
18
19
|
var menuItem = extension.menuItem;
|
|
20
|
+
var nestedMenuItems = extension.nestedMenuItems;
|
|
19
21
|
var blockMenuItemKey = "selection-extension-".concat(index);
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
|
|
23
|
+
// If there are nested menu items, create a nested dropdown menu
|
|
24
|
+
if (nestedMenuItems && nestedMenuItems.length > 0) {
|
|
25
|
+
var _api$blockMenu;
|
|
26
|
+
var nestedMenuComponents = [{
|
|
27
|
+
type: 'block-menu-nested',
|
|
28
|
+
key: "".concat(blockMenuItemKey, "-nested"),
|
|
29
|
+
parent: {
|
|
30
|
+
type: 'block-menu-section',
|
|
31
|
+
key: 'block-menu-section-primary',
|
|
32
|
+
rank: 200
|
|
33
|
+
},
|
|
34
|
+
component: function component() {
|
|
35
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
36
|
+
children: null
|
|
37
|
+
},
|
|
38
|
+
children = _ref.children;
|
|
39
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarNestedDropdownMenu, {
|
|
40
|
+
text: menuItem.label,
|
|
41
|
+
elemBefore: menuItem.icon ? /*#__PURE__*/_react.default.createElement(menuItem.icon, {
|
|
42
|
+
label: ''
|
|
43
|
+
}) : undefined,
|
|
44
|
+
elemAfter: /*#__PURE__*/_react.default.createElement(_chevronRight.default, {
|
|
45
|
+
label: 'nested menu'
|
|
46
|
+
})
|
|
47
|
+
}, children);
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
24
50
|
type: 'block-menu-section',
|
|
25
|
-
key:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
51
|
+
key: "".concat(blockMenuItemKey, "-nested-section"),
|
|
52
|
+
parent: {
|
|
53
|
+
type: 'block-menu-nested',
|
|
54
|
+
key: "".concat(blockMenuItemKey, "-nested"),
|
|
55
|
+
rank: 100
|
|
56
|
+
},
|
|
57
|
+
component: function component() {
|
|
58
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
59
|
+
children: null
|
|
60
|
+
},
|
|
61
|
+
children = _ref2.children;
|
|
62
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItemSection, null, children);
|
|
63
|
+
}
|
|
64
|
+
}].concat((0, _toConsumableArray2.default)(nestedMenuItems.reduce(function (acc, nestedItem, nestedIndex) {
|
|
65
|
+
if ('label' in nestedItem) {
|
|
66
|
+
acc.push({
|
|
67
|
+
type: 'block-menu-item',
|
|
68
|
+
key: "".concat(blockMenuItemKey, "-nested-item-").concat(nestedIndex),
|
|
69
|
+
parent: {
|
|
70
|
+
type: 'block-menu-section',
|
|
71
|
+
key: "".concat(blockMenuItemKey, "-nested-section"),
|
|
72
|
+
rank: nestedIndex + 100
|
|
73
|
+
},
|
|
74
|
+
component: function component() {
|
|
75
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
76
|
+
elemBefore: nestedItem.icon ? /*#__PURE__*/_react.default.createElement(nestedItem.icon, {
|
|
77
|
+
label: ''
|
|
78
|
+
}) : undefined,
|
|
79
|
+
onClick: nestedItem.onClick,
|
|
80
|
+
isDisabled: nestedItem.isDisabled
|
|
81
|
+
}, nestedItem.label);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return acc;
|
|
86
|
+
}, [])));
|
|
87
|
+
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(nestedMenuComponents);
|
|
88
|
+
} else {
|
|
89
|
+
var _api$blockMenu2;
|
|
90
|
+
// If no nested items, create a regular menu item
|
|
91
|
+
var blockMenuComponent = [{
|
|
92
|
+
type: 'block-menu-item',
|
|
93
|
+
key: blockMenuItemKey,
|
|
94
|
+
parent: {
|
|
95
|
+
type: 'block-menu-section',
|
|
96
|
+
key: 'block-menu-section-primary',
|
|
97
|
+
rank: 200
|
|
98
|
+
},
|
|
99
|
+
component: function component() {
|
|
100
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarDropdownItem, {
|
|
101
|
+
elemBefore: menuItem.icon ? /*#__PURE__*/_react.default.createElement(menuItem.icon, {
|
|
102
|
+
label: ''
|
|
103
|
+
}) : undefined,
|
|
104
|
+
onClick: menuItem.onClick,
|
|
105
|
+
isDisabled: menuItem.isDisabled
|
|
106
|
+
}, menuItem.label);
|
|
107
|
+
}
|
|
108
|
+
}];
|
|
109
|
+
api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 || _api$blockMenu2.actions.registerBlockMenuComponents(blockMenuComponent);
|
|
110
|
+
}
|
|
35
111
|
});
|
|
36
112
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
2
|
+
import { ToolbarDropdownItem, ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
3
4
|
import { getBlockMenuItemExtensions } from '../extensions';
|
|
4
5
|
export function registerBlockMenuItems(extensionList, api) {
|
|
5
6
|
const blockMenuExtensions = getBlockMenuItemExtensions(extensionList, 'first-party');
|
|
@@ -7,23 +8,99 @@ export function registerBlockMenuItems(extensionList, api) {
|
|
|
7
8
|
return;
|
|
8
9
|
}
|
|
9
10
|
blockMenuExtensions.forEach((extension, index) => {
|
|
10
|
-
var _api$blockMenu;
|
|
11
11
|
const menuItem = extension.menuItem;
|
|
12
|
+
const nestedMenuItems = extension.nestedMenuItems;
|
|
12
13
|
const blockMenuItemKey = `selection-extension-${index}`;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
// If there are nested menu items, create a nested dropdown menu
|
|
16
|
+
if (nestedMenuItems && nestedMenuItems.length > 0) {
|
|
17
|
+
var _api$blockMenu;
|
|
18
|
+
const nestedMenuComponents = [{
|
|
19
|
+
type: 'block-menu-nested',
|
|
20
|
+
key: `${blockMenuItemKey}-nested`,
|
|
21
|
+
parent: {
|
|
22
|
+
type: 'block-menu-section',
|
|
23
|
+
key: 'block-menu-section-primary',
|
|
24
|
+
rank: 200
|
|
25
|
+
},
|
|
26
|
+
component: ({
|
|
27
|
+
children
|
|
28
|
+
} = {
|
|
29
|
+
children: null
|
|
30
|
+
}) => {
|
|
31
|
+
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
32
|
+
text: menuItem.label,
|
|
33
|
+
elemBefore: menuItem.icon ? /*#__PURE__*/React.createElement(menuItem.icon, {
|
|
34
|
+
label: ''
|
|
35
|
+
}) : undefined,
|
|
36
|
+
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
37
|
+
label: 'nested menu'
|
|
38
|
+
})
|
|
39
|
+
}, children);
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
17
42
|
type: 'block-menu-section',
|
|
18
|
-
key:
|
|
19
|
-
|
|
43
|
+
key: `${blockMenuItemKey}-nested-section`,
|
|
44
|
+
parent: {
|
|
45
|
+
type: 'block-menu-nested',
|
|
46
|
+
key: `${blockMenuItemKey}-nested`,
|
|
47
|
+
rank: 100
|
|
48
|
+
},
|
|
49
|
+
component: ({
|
|
50
|
+
children
|
|
51
|
+
} = {
|
|
52
|
+
children: null
|
|
53
|
+
}) => {
|
|
54
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
|
|
55
|
+
}
|
|
20
56
|
},
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
57
|
+
// Add nested menu items
|
|
58
|
+
...nestedMenuItems.reduce((acc, nestedItem, nestedIndex) => {
|
|
59
|
+
if ('label' in nestedItem) {
|
|
60
|
+
acc.push({
|
|
61
|
+
type: 'block-menu-item',
|
|
62
|
+
key: `${blockMenuItemKey}-nested-item-${nestedIndex}`,
|
|
63
|
+
parent: {
|
|
64
|
+
type: 'block-menu-section',
|
|
65
|
+
key: `${blockMenuItemKey}-nested-section`,
|
|
66
|
+
rank: nestedIndex + 100
|
|
67
|
+
},
|
|
68
|
+
component: () => {
|
|
69
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
70
|
+
elemBefore: nestedItem.icon ? /*#__PURE__*/React.createElement(nestedItem.icon, {
|
|
71
|
+
label: ''
|
|
72
|
+
}) : undefined,
|
|
73
|
+
onClick: nestedItem.onClick,
|
|
74
|
+
isDisabled: nestedItem.isDisabled
|
|
75
|
+
}, nestedItem.label);
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
return acc;
|
|
80
|
+
}, [])];
|
|
81
|
+
api === null || api === void 0 ? void 0 : (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 ? void 0 : _api$blockMenu.actions.registerBlockMenuComponents(nestedMenuComponents);
|
|
82
|
+
} else {
|
|
83
|
+
var _api$blockMenu2;
|
|
84
|
+
// If no nested items, create a regular menu item
|
|
85
|
+
const blockMenuComponent = [{
|
|
86
|
+
type: 'block-menu-item',
|
|
87
|
+
key: blockMenuItemKey,
|
|
88
|
+
parent: {
|
|
89
|
+
type: 'block-menu-section',
|
|
90
|
+
key: 'block-menu-section-primary',
|
|
91
|
+
rank: 200
|
|
92
|
+
},
|
|
93
|
+
component: () => {
|
|
94
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
95
|
+
elemBefore: menuItem.icon ? /*#__PURE__*/React.createElement(menuItem.icon, {
|
|
96
|
+
label: ''
|
|
97
|
+
}) : undefined,
|
|
98
|
+
onClick: menuItem.onClick,
|
|
99
|
+
isDisabled: menuItem.isDisabled
|
|
100
|
+
}, menuItem.label);
|
|
101
|
+
}
|
|
102
|
+
}];
|
|
103
|
+
api === null || api === void 0 ? void 0 : (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 ? void 0 : _api$blockMenu2.actions.registerBlockMenuComponents(blockMenuComponent);
|
|
104
|
+
}
|
|
28
105
|
});
|
|
29
106
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
1
2
|
import React from 'react';
|
|
2
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
3
|
+
import { ToolbarDropdownItem, ToolbarDropdownItemSection, ToolbarNestedDropdownMenu } from '@atlaskit/editor-toolbar';
|
|
4
|
+
import ChevronRightIcon from '@atlaskit/icon/core/chevron-right';
|
|
3
5
|
import { getBlockMenuItemExtensions } from '../extensions';
|
|
4
6
|
export function registerBlockMenuItems(extensionList, api) {
|
|
5
7
|
var blockMenuExtensions = getBlockMenuItemExtensions(extensionList, 'first-party');
|
|
@@ -7,23 +9,97 @@ export function registerBlockMenuItems(extensionList, api) {
|
|
|
7
9
|
return;
|
|
8
10
|
}
|
|
9
11
|
blockMenuExtensions.forEach(function (extension, index) {
|
|
10
|
-
var _api$blockMenu;
|
|
11
12
|
var menuItem = extension.menuItem;
|
|
13
|
+
var nestedMenuItems = extension.nestedMenuItems;
|
|
12
14
|
var blockMenuItemKey = "selection-extension-".concat(index);
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
|
|
16
|
+
// If there are nested menu items, create a nested dropdown menu
|
|
17
|
+
if (nestedMenuItems && nestedMenuItems.length > 0) {
|
|
18
|
+
var _api$blockMenu;
|
|
19
|
+
var nestedMenuComponents = [{
|
|
20
|
+
type: 'block-menu-nested',
|
|
21
|
+
key: "".concat(blockMenuItemKey, "-nested"),
|
|
22
|
+
parent: {
|
|
23
|
+
type: 'block-menu-section',
|
|
24
|
+
key: 'block-menu-section-primary',
|
|
25
|
+
rank: 200
|
|
26
|
+
},
|
|
27
|
+
component: function component() {
|
|
28
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
29
|
+
children: null
|
|
30
|
+
},
|
|
31
|
+
children = _ref.children;
|
|
32
|
+
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
33
|
+
text: menuItem.label,
|
|
34
|
+
elemBefore: menuItem.icon ? /*#__PURE__*/React.createElement(menuItem.icon, {
|
|
35
|
+
label: ''
|
|
36
|
+
}) : undefined,
|
|
37
|
+
elemAfter: /*#__PURE__*/React.createElement(ChevronRightIcon, {
|
|
38
|
+
label: 'nested menu'
|
|
39
|
+
})
|
|
40
|
+
}, children);
|
|
41
|
+
}
|
|
42
|
+
}, {
|
|
17
43
|
type: 'block-menu-section',
|
|
18
|
-
key:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
44
|
+
key: "".concat(blockMenuItemKey, "-nested-section"),
|
|
45
|
+
parent: {
|
|
46
|
+
type: 'block-menu-nested',
|
|
47
|
+
key: "".concat(blockMenuItemKey, "-nested"),
|
|
48
|
+
rank: 100
|
|
49
|
+
},
|
|
50
|
+
component: function component() {
|
|
51
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
52
|
+
children: null
|
|
53
|
+
},
|
|
54
|
+
children = _ref2.children;
|
|
55
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, null, children);
|
|
56
|
+
}
|
|
57
|
+
}].concat(_toConsumableArray(nestedMenuItems.reduce(function (acc, nestedItem, nestedIndex) {
|
|
58
|
+
if ('label' in nestedItem) {
|
|
59
|
+
acc.push({
|
|
60
|
+
type: 'block-menu-item',
|
|
61
|
+
key: "".concat(blockMenuItemKey, "-nested-item-").concat(nestedIndex),
|
|
62
|
+
parent: {
|
|
63
|
+
type: 'block-menu-section',
|
|
64
|
+
key: "".concat(blockMenuItemKey, "-nested-section"),
|
|
65
|
+
rank: nestedIndex + 100
|
|
66
|
+
},
|
|
67
|
+
component: function component() {
|
|
68
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
69
|
+
elemBefore: nestedItem.icon ? /*#__PURE__*/React.createElement(nestedItem.icon, {
|
|
70
|
+
label: ''
|
|
71
|
+
}) : undefined,
|
|
72
|
+
onClick: nestedItem.onClick,
|
|
73
|
+
isDisabled: nestedItem.isDisabled
|
|
74
|
+
}, nestedItem.label);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return acc;
|
|
79
|
+
}, [])));
|
|
80
|
+
api === null || api === void 0 || (_api$blockMenu = api.blockMenu) === null || _api$blockMenu === void 0 || _api$blockMenu.actions.registerBlockMenuComponents(nestedMenuComponents);
|
|
81
|
+
} else {
|
|
82
|
+
var _api$blockMenu2;
|
|
83
|
+
// If no nested items, create a regular menu item
|
|
84
|
+
var blockMenuComponent = [{
|
|
85
|
+
type: 'block-menu-item',
|
|
86
|
+
key: blockMenuItemKey,
|
|
87
|
+
parent: {
|
|
88
|
+
type: 'block-menu-section',
|
|
89
|
+
key: 'block-menu-section-primary',
|
|
90
|
+
rank: 200
|
|
91
|
+
},
|
|
92
|
+
component: function component() {
|
|
93
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
94
|
+
elemBefore: menuItem.icon ? /*#__PURE__*/React.createElement(menuItem.icon, {
|
|
95
|
+
label: ''
|
|
96
|
+
}) : undefined,
|
|
97
|
+
onClick: menuItem.onClick,
|
|
98
|
+
isDisabled: menuItem.isDisabled
|
|
99
|
+
}, menuItem.label);
|
|
100
|
+
}
|
|
101
|
+
}];
|
|
102
|
+
api === null || api === void 0 || (_api$blockMenu2 = api.blockMenu) === null || _api$blockMenu2 === void 0 || _api$blockMenu2.actions.registerBlockMenuComponents(blockMenuComponent);
|
|
103
|
+
}
|
|
28
104
|
});
|
|
29
105
|
}
|
|
@@ -136,13 +136,16 @@ export type ExtensionConfiguration = {
|
|
|
136
136
|
export type GetToolbarItemFn = () => ExtensionToolbarItemConfiguration;
|
|
137
137
|
export type GetMenuItemsFn = () => Array<ExtensionMenuItemConfiguration | ExtensionMenuSectionConfiguration>;
|
|
138
138
|
export type GetMenuItemFn = () => Omit<ExtensionMenuItemConfiguration, 'section'>;
|
|
139
|
+
export type BlockMenuItemConfiguration = Omit<ExtensionMenuItemConfiguration, 'contentComponent'>;
|
|
140
|
+
export type GetBlockMenuItemFn = () => Omit<BlockMenuItemConfiguration, 'section'>;
|
|
141
|
+
export type GetBlockMenuNestedItemsFn = () => Array<BlockMenuItemConfiguration | ExtensionMenuSectionConfiguration>;
|
|
139
142
|
export type ToolbarExtensionConfiguration = {
|
|
140
143
|
getMenuItems?: GetMenuItemsFn;
|
|
141
144
|
getToolbarItem?: GetToolbarItemFn;
|
|
142
145
|
};
|
|
143
146
|
export type BlockMenuExtensionConfiguration = {
|
|
144
|
-
getMenuItem:
|
|
145
|
-
getNestedMenuItems?:
|
|
147
|
+
getMenuItem: GetBlockMenuItemFn;
|
|
148
|
+
getNestedMenuItems?: GetBlockMenuNestedItemsFn;
|
|
146
149
|
};
|
|
147
150
|
export type ExtensionToolbarItemConfiguration = {
|
|
148
151
|
icon: React.ComponentType<React.PropsWithChildren<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionConfiguration, ExtensionSource,
|
|
1
|
+
import type { ExtensionConfiguration, ExtensionSource, GetBlockMenuItemFn, GetBlockMenuNestedItemsFn, GetMenuItemsFn, GetToolbarItemFn, SelectionExtensionConfig } from '../types';
|
|
2
2
|
export type ToolbarItemExtension = {
|
|
3
3
|
getMenuItems?: GetMenuItemsFn;
|
|
4
4
|
getToolbarItem: GetToolbarItemFn;
|
|
@@ -26,8 +26,8 @@ export declare const getToolbarItemExtensions: (extensionList: ExtensionConfigur
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const getMenuItemExtensions: (extensionList: ExtensionConfiguration[], targetSource: ExtensionSource) => SelectionExtensionConfig[];
|
|
28
28
|
type BlockMenuItems = {
|
|
29
|
-
menuItem: ReturnType<
|
|
30
|
-
nestedMenuItems?: ReturnType<
|
|
29
|
+
menuItem: ReturnType<GetBlockMenuItemFn>;
|
|
30
|
+
nestedMenuItems?: ReturnType<GetBlockMenuNestedItemsFn>;
|
|
31
31
|
};
|
|
32
32
|
export declare const getBlockMenuItemExtensions: (extensionList: ExtensionConfiguration[], targetSource: ExtensionSource) => BlockMenuItems[];
|
|
33
33
|
export {};
|
|
@@ -136,13 +136,16 @@ export type ExtensionConfiguration = {
|
|
|
136
136
|
export type GetToolbarItemFn = () => ExtensionToolbarItemConfiguration;
|
|
137
137
|
export type GetMenuItemsFn = () => Array<ExtensionMenuItemConfiguration | ExtensionMenuSectionConfiguration>;
|
|
138
138
|
export type GetMenuItemFn = () => Omit<ExtensionMenuItemConfiguration, 'section'>;
|
|
139
|
+
export type BlockMenuItemConfiguration = Omit<ExtensionMenuItemConfiguration, 'contentComponent'>;
|
|
140
|
+
export type GetBlockMenuItemFn = () => Omit<BlockMenuItemConfiguration, 'section'>;
|
|
141
|
+
export type GetBlockMenuNestedItemsFn = () => Array<BlockMenuItemConfiguration | ExtensionMenuSectionConfiguration>;
|
|
139
142
|
export type ToolbarExtensionConfiguration = {
|
|
140
143
|
getMenuItems?: GetMenuItemsFn;
|
|
141
144
|
getToolbarItem?: GetToolbarItemFn;
|
|
142
145
|
};
|
|
143
146
|
export type BlockMenuExtensionConfiguration = {
|
|
144
|
-
getMenuItem:
|
|
145
|
-
getNestedMenuItems?:
|
|
147
|
+
getMenuItem: GetBlockMenuItemFn;
|
|
148
|
+
getNestedMenuItems?: GetBlockMenuNestedItemsFn;
|
|
146
149
|
};
|
|
147
150
|
export type ExtensionToolbarItemConfiguration = {
|
|
148
151
|
icon: React.ComponentType<React.PropsWithChildren<{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ExtensionConfiguration, ExtensionSource,
|
|
1
|
+
import type { ExtensionConfiguration, ExtensionSource, GetBlockMenuItemFn, GetBlockMenuNestedItemsFn, GetMenuItemsFn, GetToolbarItemFn, SelectionExtensionConfig } from '../types';
|
|
2
2
|
export type ToolbarItemExtension = {
|
|
3
3
|
getMenuItems?: GetMenuItemsFn;
|
|
4
4
|
getToolbarItem: GetToolbarItemFn;
|
|
@@ -26,8 +26,8 @@ export declare const getToolbarItemExtensions: (extensionList: ExtensionConfigur
|
|
|
26
26
|
*/
|
|
27
27
|
export declare const getMenuItemExtensions: (extensionList: ExtensionConfiguration[], targetSource: ExtensionSource) => SelectionExtensionConfig[];
|
|
28
28
|
type BlockMenuItems = {
|
|
29
|
-
menuItem: ReturnType<
|
|
30
|
-
nestedMenuItems?: ReturnType<
|
|
29
|
+
menuItem: ReturnType<GetBlockMenuItemFn>;
|
|
30
|
+
nestedMenuItems?: ReturnType<GetBlockMenuNestedItemsFn>;
|
|
31
31
|
};
|
|
32
32
|
export declare const getBlockMenuItemExtensions: (extensionList: ExtensionConfiguration[], targetSource: ExtensionSource) => BlockMenuItems[];
|
|
33
33
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-selection-extension",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@atlaskit/adf-utils": "^19.21.0",
|
|
36
36
|
"@atlaskit/editor-json-transformer": "^8.27.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^3.0.0",
|
|
38
|
-
"@atlaskit/editor-plugin-block-menu": "^0.0.
|
|
38
|
+
"@atlaskit/editor-plugin-block-menu": "^0.0.18",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode": "^5.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-primary-toolbar": "^4.1.0",
|
|
41
41
|
"@atlaskit/editor-plugin-selection-toolbar": "^4.3.0",
|
|
@@ -43,18 +43,18 @@
|
|
|
43
43
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^3.6.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
46
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
46
|
+
"@atlaskit/editor-toolbar": "^0.6.0",
|
|
47
47
|
"@atlaskit/icon": "^28.1.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^14.12.0",
|
|
50
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^11.11.0",
|
|
51
51
|
"@babel/runtime": "^7.0.0",
|
|
52
52
|
"lodash": "^4.17.21",
|
|
53
53
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
54
54
|
"uuid": "^3.1.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@atlaskit/editor-common": "^107.
|
|
57
|
+
"@atlaskit/editor-common": "^107.34.0",
|
|
58
58
|
"react": "^18.2.0"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|