@atlaskit/editor-plugin-insert-block 1.14.6 → 2.0.1
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 +24 -0
- package/dist/cjs/plugin.js +0 -1
- package/dist/cjs/ui/ElementBrowser/InsertMenu.js +10 -9
- package/dist/cjs/ui/ElementRail/MainToolBarIcon.js +15 -3
- package/dist/cjs/ui/ElementRail/index.js +2 -1
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
- package/dist/cjs/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/cjs/ui/ToolbarInsertBlock/item.js +26 -6
- package/dist/es2019/plugin.js +0 -1
- package/dist/es2019/ui/ElementBrowser/InsertMenu.js +10 -9
- package/dist/es2019/ui/ElementRail/MainToolBarIcon.js +15 -3
- package/dist/es2019/ui/ElementRail/index.js +2 -1
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
- package/dist/es2019/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/es2019/ui/ToolbarInsertBlock/item.js +22 -6
- package/dist/esm/plugin.js +0 -1
- package/dist/esm/ui/ElementBrowser/InsertMenu.js +10 -9
- package/dist/esm/ui/ElementRail/MainToolBarIcon.js +15 -3
- package/dist/esm/ui/ElementRail/index.js +2 -1
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
- package/dist/esm/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/esm/ui/ToolbarInsertBlock/index.js +11 -11
- package/dist/esm/ui/ToolbarInsertBlock/item.js +26 -6
- package/dist/types/plugin.d.ts +0 -1
- package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types/ui/ElementBrowser/types.d.ts +1 -0
- package/dist/types/ui/ElementRail/MainToolBarIcon.d.ts +2 -1
- package/dist/types/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -1
- package/dist/types/ui/ToolbarInsertBlock/types.d.ts +1 -2
- package/dist/types-ts4.5/plugin.d.ts +0 -1
- package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +1 -1
- package/dist/types-ts4.5/ui/ElementBrowser/types.d.ts +1 -0
- package/dist/types-ts4.5/ui/ElementRail/MainToolBarIcon.d.ts +2 -1
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -1
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/types.d.ts +1 -2
- package/package.json +8 -7
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -42
- package/dist/cjs/ui/ToolbarInsertBlock/sort-items.js +0 -30
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
- package/dist/es2019/ui/ToolbarInsertBlock/sort-items.js +0 -22
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
- package/dist/esm/ui/ToolbarInsertBlock/sort-items.js +0 -24
- package/dist/types/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -21
- package/dist/types/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -21
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 2.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#142202](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/142202)
|
|
8
|
+
[`030b6385e8e47`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/030b6385e8e47) -
|
|
9
|
+
Add disabled state for right rail experiment, and add appearance checks for experiments
|
|
10
|
+
|
|
11
|
+
## 2.0.0
|
|
12
|
+
|
|
13
|
+
### Major Changes
|
|
14
|
+
|
|
15
|
+
- [#141573](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141573)
|
|
16
|
+
[`2360742cbceac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2360742cbceac) -
|
|
17
|
+
[ux] Removing replacePlusMenuWithElementBrowser option from insert-block plugin. This is to ensure
|
|
18
|
+
consistent UI and reduce unnecessary code bundled with the editor. If you are currently using this
|
|
19
|
+
option you must remove it and it will use the new approach only now.
|
|
20
|
+
|
|
21
|
+
### Minor Changes
|
|
22
|
+
|
|
23
|
+
- [#140915](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140915)
|
|
24
|
+
[`eaccad51157d6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eaccad51157d6) -
|
|
25
|
+
[ux] Migrate new icons including color, highlight and task on Editor primary toolbar
|
|
26
|
+
|
|
3
27
|
## 1.14.6
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -332,7 +332,6 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
332
332
|
insertMenuItems: options.insertMenuItems,
|
|
333
333
|
editorActions: editorActions,
|
|
334
334
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
335
|
-
replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
|
|
336
335
|
showElementBrowserLink: options.showElementBrowserLink,
|
|
337
336
|
showSeparator: !isLastItem && toolbarSize <= _types.ToolbarSize.S,
|
|
338
337
|
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
@@ -33,7 +33,8 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
33
33
|
showElementBrowserLink = _ref.showElementBrowserLink,
|
|
34
34
|
onInsert = _ref.onInsert,
|
|
35
35
|
toggleVisiblity = _ref.toggleVisiblity,
|
|
36
|
-
pluginInjectionApi = _ref.pluginInjectionApi
|
|
36
|
+
pluginInjectionApi = _ref.pluginInjectionApi,
|
|
37
|
+
isFullPageAppearance = _ref.isFullPageAppearance;
|
|
37
38
|
var _useState = (0, _react.useState)(0),
|
|
38
39
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
39
40
|
itemCount = _useState2[0],
|
|
@@ -69,7 +70,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
69
70
|
if (!editorView.hasFocus()) {
|
|
70
71
|
editorView.focus();
|
|
71
72
|
}
|
|
72
|
-
if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
|
|
73
|
+
if (isFullPageAppearance && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
|
|
73
74
|
var _pluginInjectionApi$q;
|
|
74
75
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 || _pluginInjectionApi$q.actions.insertItem(item,
|
|
75
76
|
// @ts-expect-error
|
|
@@ -78,7 +79,7 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
78
79
|
var _pluginInjectionApi$q2;
|
|
79
80
|
pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q2 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q2 === void 0 || _pluginInjectionApi$q2.actions.insertItem(item, _analytics.INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
80
81
|
}
|
|
81
|
-
}, [editorView, toggleVisiblity, pluginInjectionApi]);
|
|
82
|
+
}, [editorView, toggleVisiblity, pluginInjectionApi, isFullPageAppearance]);
|
|
82
83
|
var getItems = (0, _react.useCallback)(function (query, category) {
|
|
83
84
|
var result;
|
|
84
85
|
/**
|
|
@@ -99,9 +100,9 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
99
100
|
category: category,
|
|
100
101
|
featuredItems: true,
|
|
101
102
|
// @ts-ignore
|
|
102
|
-
templateItems: (0, _experiments.editorExperiment)('element-level-templates', true)
|
|
103
|
+
templateItems: isFullPageAppearance && (0, _experiments.editorExperiment)('element-level-templates', true)
|
|
103
104
|
})) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
|
|
104
|
-
if ((0, _experiments.editorExperiment)('element-level-templates', true)) {
|
|
105
|
+
if (isFullPageAppearance && (0, _experiments.editorExperiment)('element-level-templates', true)) {
|
|
105
106
|
// Make sure template options appear as top 5 items
|
|
106
107
|
featuredQuickInsertSuggestions.sort(function (a, b) {
|
|
107
108
|
var _b$priority, _a$priority;
|
|
@@ -115,12 +116,12 @@ var InsertMenu = function InsertMenu(_ref) {
|
|
|
115
116
|
}
|
|
116
117
|
setItemCount(result.length);
|
|
117
118
|
return result;
|
|
118
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.actions, quickInsertDropdownItems]);
|
|
119
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.actions, quickInsertDropdownItems, isFullPageAppearance]);
|
|
119
120
|
var emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 || (_pluginInjectionApi$q8 = _pluginInjectionApi$q8.sharedState.currentState()) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : _pluginInjectionApi$q8.emptyStateHandler;
|
|
120
121
|
return (
|
|
121
122
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
122
123
|
(0, _react2.jsx)("div", {
|
|
123
|
-
css: insertMenuWrapper(itemCount)
|
|
124
|
+
css: insertMenuWrapper(itemCount, isFullPageAppearance)
|
|
124
125
|
}, (0, _react2.jsx)(ElementBrowserWrapper, {
|
|
125
126
|
handleClickOutside: toggleVisiblity,
|
|
126
127
|
handleEscapeKeydown: toggleVisiblity,
|
|
@@ -164,8 +165,8 @@ var getInsertMenuHeight = function getInsertMenuHeight(_ref3) {
|
|
|
164
165
|
}
|
|
165
166
|
return 560; // For showing 6 Elements.
|
|
166
167
|
};
|
|
167
|
-
var insertMenuWrapper = function insertMenuWrapper(itemCount) {
|
|
168
|
-
if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
|
|
168
|
+
var insertMenuWrapper = function insertMenuWrapper(itemCount, isFullPageAppearance) {
|
|
169
|
+
if (isFullPageAppearance && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
|
|
169
170
|
return (0, _react2.css)({
|
|
170
171
|
display: 'flex',
|
|
171
172
|
flexDirection: 'column',
|
|
@@ -44,8 +44,19 @@ var buttonStyles = (0, _primitives.xcss)({
|
|
|
44
44
|
outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
|
+
var disabledStyles = (0, _primitives.xcss)({
|
|
48
|
+
color: 'color.text.disabled',
|
|
49
|
+
backgroundColor: 'color.background.neutral',
|
|
50
|
+
':hover': {
|
|
51
|
+
backgroundColor: 'color.background.neutral'
|
|
52
|
+
},
|
|
53
|
+
':active': {
|
|
54
|
+
backgroundColor: 'color.background.neutral'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
47
57
|
var RightRailIcon = exports.RightRailIcon = function RightRailIcon(_ref) {
|
|
48
|
-
var onClick = _ref.onClick
|
|
58
|
+
var onClick = _ref.onClick,
|
|
59
|
+
isDisabled = _ref.isDisabled;
|
|
49
60
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
50
61
|
formatMessage = _useIntl.formatMessage;
|
|
51
62
|
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
@@ -60,8 +71,9 @@ var RightRailIcon = exports.RightRailIcon = function RightRailIcon(_ref) {
|
|
|
60
71
|
}, /*#__PURE__*/_react.default.createElement(_primitives.Pressable, {
|
|
61
72
|
type: "button",
|
|
62
73
|
"aria-label": formatMessage(_messages.toolbarInsertBlockMessages.insertMenu),
|
|
63
|
-
xcss: [buttonStyles],
|
|
64
|
-
onClick: onClick
|
|
74
|
+
xcss: [buttonStyles, isDisabled ? disabledStyles : undefined],
|
|
75
|
+
onClick: onClick,
|
|
76
|
+
isDisabled: isDisabled
|
|
65
77
|
}, /*#__PURE__*/_react.default.createElement(_add.default, {
|
|
66
78
|
label: formatMessage(_messages.toolbarInsertBlockMessages.insertMenu),
|
|
67
79
|
size: "medium"
|
|
@@ -230,6 +230,7 @@ var InsertMenuRail = exports.InsertMenuRail = function InsertMenuRail(_ref) {
|
|
|
230
230
|
onInsert: onInsert,
|
|
231
231
|
toggleVisiblity: function toggleVisiblity() {},
|
|
232
232
|
showElementBrowserLink: true,
|
|
233
|
-
pluginInjectionApi: api
|
|
233
|
+
pluginInjectionApi: api,
|
|
234
|
+
isFullPageAppearance: true
|
|
234
235
|
}));
|
|
235
236
|
};
|
|
@@ -26,7 +26,8 @@ var BlockInsertElementBrowser = exports.BlockInsertElementBrowser = function Blo
|
|
|
26
26
|
onInsert: props.onInsert,
|
|
27
27
|
toggleVisiblity: props.togglePlusMenuVisibility,
|
|
28
28
|
showElementBrowserLink: props.showElementBrowserLink,
|
|
29
|
-
pluginInjectionApi: props.pluginInjectionApi
|
|
29
|
+
pluginInjectionApi: props.pluginInjectionApi,
|
|
30
|
+
isFullPageAppearance: props.isFullPageAppearance
|
|
30
31
|
})), /*#__PURE__*/_react.default.createElement(_dropdownButton.DropDownButton, {
|
|
31
32
|
"aria-expanded": props.open,
|
|
32
33
|
"aria-haspopup": true,
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.BlockInsertMenu = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _blockInsertElementBrowser = require("./block-insert-element-browser");
|
|
10
|
-
var _blockInsertMenuLegacy = require("./block-insert-menu-legacy");
|
|
11
10
|
var _dropdownButton = require("./dropdown-button");
|
|
12
11
|
var BlockInsertMenu = exports.BlockInsertMenu = function BlockInsertMenu(props) {
|
|
13
12
|
if (props.items.length === 0) {
|
|
@@ -27,40 +26,24 @@ var BlockInsertMenu = exports.BlockInsertMenu = function BlockInsertMenu(props)
|
|
|
27
26
|
"aria-keyshortcuts": "/"
|
|
28
27
|
}));
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/_react.default.createElement(_blockInsertElementBrowser.BlockInsertElementBrowser, {
|
|
32
|
-
disabled: props.disabled,
|
|
33
|
-
editorView: props.editorView,
|
|
34
|
-
items: props.items,
|
|
35
|
-
label: props.label,
|
|
36
|
-
onClick: props.onClick,
|
|
37
|
-
onKeyDown: props.onKeyDown,
|
|
38
|
-
onInsert: props.onInsert,
|
|
39
|
-
onRef: props.onPlusButtonRef,
|
|
40
|
-
open: props.open,
|
|
41
|
-
plusButtonRef: props.plusButtonRef,
|
|
42
|
-
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
43
|
-
popupsMountPoint: props.popupsMountPoint,
|
|
44
|
-
popupsScrollableElement: props.popupsScrollableElement,
|
|
45
|
-
spacing: props.spacing,
|
|
46
|
-
togglePlusMenuVisibility: props.togglePlusMenuVisibility,
|
|
47
|
-
showElementBrowserLink: props.showElementBrowserLink,
|
|
48
|
-
pluginInjectionApi: props.pluginInjectionApi
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
return /*#__PURE__*/_react.default.createElement(_blockInsertMenuLegacy.BlockInsertMenuLegacy, {
|
|
29
|
+
return /*#__PURE__*/_react.default.createElement(_blockInsertElementBrowser.BlockInsertElementBrowser, {
|
|
52
30
|
disabled: props.disabled,
|
|
31
|
+
editorView: props.editorView,
|
|
53
32
|
items: props.items,
|
|
54
33
|
label: props.label,
|
|
55
34
|
onClick: props.onClick,
|
|
56
35
|
onKeyDown: props.onKeyDown,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
onRef: props.onRef,
|
|
36
|
+
onInsert: props.onInsert,
|
|
37
|
+
onRef: props.onPlusButtonRef,
|
|
60
38
|
open: props.open,
|
|
39
|
+
plusButtonRef: props.plusButtonRef,
|
|
61
40
|
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
62
41
|
popupsMountPoint: props.popupsMountPoint,
|
|
63
42
|
popupsScrollableElement: props.popupsScrollableElement,
|
|
64
|
-
spacing: props.spacing
|
|
43
|
+
spacing: props.spacing,
|
|
44
|
+
togglePlusMenuVisibility: props.togglePlusMenuVisibility,
|
|
45
|
+
showElementBrowserLink: props.showElementBrowserLink,
|
|
46
|
+
pluginInjectionApi: props.pluginInjectionApi,
|
|
47
|
+
isFullPageAppearance: props.isFullPageAppearance
|
|
65
48
|
});
|
|
66
49
|
};
|
|
@@ -15,7 +15,6 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
15
15
|
var _item = require("./item");
|
|
16
16
|
var _messages2 = require("./messages");
|
|
17
17
|
var _shallowEquals = require("./shallow-equals");
|
|
18
|
-
var _sortItems = require("./sort-items");
|
|
19
18
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
19
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
20
|
var buttonToItem = (0, _memoize.default)(function (button) {
|
|
@@ -63,8 +62,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
63
62
|
expandEnabled = config.expandEnabled,
|
|
64
63
|
numberOfButtons = config.numberOfButtons,
|
|
65
64
|
schema = config.schema,
|
|
66
|
-
formatMessage = config.formatMessage
|
|
67
|
-
isNewMenuEnabled = config.isNewMenuEnabled;
|
|
65
|
+
formatMessage = config.formatMessage;
|
|
68
66
|
var items = [];
|
|
69
67
|
if (actionSupported) {
|
|
70
68
|
items.push((0, _item.action)({
|
|
@@ -223,7 +221,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
223
221
|
var name = _ref.value.name;
|
|
224
222
|
return name !== 'table selector';
|
|
225
223
|
});
|
|
226
|
-
var dropdownItems =
|
|
224
|
+
var dropdownItems = remainingItems.map(buttonToDropdownItem(formatMessage(_messages2.messages.insertMenu)));
|
|
227
225
|
return [buttonItems, dropdownItems];
|
|
228
226
|
};
|
|
229
227
|
var createItems = exports.createItems = (0, _memoizeOne.default)(createInsertBlockItems, _shallowEquals.shallowEquals);
|
|
@@ -569,13 +569,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
569
569
|
popupsMountPoint = _this$props11.popupsMountPoint,
|
|
570
570
|
popupsBoundariesElement = _this$props11.popupsBoundariesElement,
|
|
571
571
|
popupsScrollableElement = _this$props11.popupsScrollableElement,
|
|
572
|
-
emojiProvider = _this$props11.emojiProvider
|
|
573
|
-
replacePlusMenuWithElementBrowser = _this$props11.replacePlusMenuWithElementBrowser;
|
|
572
|
+
emojiProvider = _this$props11.emojiProvider;
|
|
574
573
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref7) {
|
|
575
574
|
var name = _ref7.value.name;
|
|
576
575
|
return name === 'emoji';
|
|
577
576
|
});
|
|
578
|
-
var dropDownButtonRef =
|
|
577
|
+
var dropDownButtonRef = this.plusButtonRef;
|
|
579
578
|
var ref = dropdownEmoji ? dropDownButtonRef : this.emojiButtonRef;
|
|
580
579
|
if (!emojiPickerOpen || !ref || !emojiProvider) {
|
|
581
580
|
return null;
|
|
@@ -660,7 +659,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
660
659
|
_tableSelectorButton5,
|
|
661
660
|
_tableSelectorButton6,
|
|
662
661
|
_this$props$isDisable,
|
|
663
|
-
_this$props$
|
|
662
|
+
_this$props$isDisable2,
|
|
664
663
|
_this$props$pluginInj3;
|
|
665
664
|
var _this$state2 = this.state,
|
|
666
665
|
buttons = _this$state2.buttons,
|
|
@@ -705,6 +704,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
705
704
|
} finally {
|
|
706
705
|
_iterator.f();
|
|
707
706
|
}
|
|
707
|
+
var isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
|
|
708
708
|
return (
|
|
709
709
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
710
710
|
(0, _react2.jsx)("span", {
|
|
@@ -768,13 +768,14 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
768
768
|
onKeyDown: this.handleTableSelectorOpenByKeyboard
|
|
769
769
|
})), (0, _react2.jsx)("span", {
|
|
770
770
|
css: _styles.wrapperStyle
|
|
771
|
-
}, this.renderPopup(), this.renderTableSelectorPopup(), (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)
|
|
772
|
-
onClick: this.handleClick
|
|
771
|
+
}, this.renderPopup(), this.renderTableSelectorPopup(), isFullPageAppearance && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true) ? (0, _react2.jsx)(_MainToolBarIcon.RightRailIcon, {
|
|
772
|
+
onClick: this.handleClick,
|
|
773
|
+
isDisabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false
|
|
773
774
|
}) : (0, _react2.jsx)(_blockInsertMenu.BlockInsertMenu, {
|
|
774
775
|
popupsMountPoint: this.props.popupsMountPoint,
|
|
775
776
|
popupsBoundariesElement: this.props.popupsBoundariesElement,
|
|
776
777
|
popupsScrollableElement: this.props.popupsScrollableElement,
|
|
777
|
-
disabled: (_this$props$
|
|
778
|
+
disabled: (_this$props$isDisable2 = this.props.isDisabled) !== null && _this$props$isDisable2 !== void 0 ? _this$props$isDisable2 : false,
|
|
778
779
|
editorView: this.props.editorView,
|
|
779
780
|
spacing: this.props.isReducedSpacing ? 'none' : 'default',
|
|
780
781
|
label: this.props.intl.formatMessage(_messages.messages.insertMenu),
|
|
@@ -789,9 +790,9 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
789
790
|
onInsert: this.insertInsertMenuItem,
|
|
790
791
|
onOpenChange: this.onOpenChange,
|
|
791
792
|
togglePlusMenuVisibility: this.togglePlusMenuVisibility,
|
|
792
|
-
replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
|
|
793
793
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
794
|
-
pluginInjectionApi: this.props.pluginInjectionApi
|
|
794
|
+
pluginInjectionApi: this.props.pluginInjectionApi,
|
|
795
|
+
isFullPageAppearance: isFullPageAppearance
|
|
795
796
|
})), !((_this$props$pluginInj3 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj3 !== void 0 && _this$props$pluginInj3.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
796
797
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
|
|
797
798
|
(0, _react2.jsx)("span", {
|
|
@@ -829,8 +830,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
829
830
|
insertMenuItems: props.insertMenuItems,
|
|
830
831
|
schema: props.editorView.state.schema,
|
|
831
832
|
numberOfButtons: props.buttons,
|
|
832
|
-
formatMessage: props.intl.formatMessage
|
|
833
|
-
isNewMenuEnabled: props.replacePlusMenuWithElementBrowser
|
|
833
|
+
formatMessage: props.intl.formatMessage
|
|
834
834
|
}),
|
|
835
835
|
_createItems2 = (0, _slicedToArray2.default)(_createItems, 2),
|
|
836
836
|
buttons = _createItems2[0],
|
|
@@ -10,9 +10,10 @@ var _react2 = require("@emotion/react");
|
|
|
10
10
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
11
11
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
12
12
|
var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
|
|
13
|
+
var _fieldText = _interopRequireDefault(require("@atlaskit/icon-lab/core/field-text"));
|
|
14
|
+
var _status = _interopRequireDefault(require("@atlaskit/icon-lab/core/status"));
|
|
13
15
|
var _angleBracketsEditorCode = _interopRequireDefault(require("@atlaskit/icon/core/migration/angle-brackets--editor-code"));
|
|
14
16
|
var _calendarEditorDate = _interopRequireDefault(require("@atlaskit/icon/core/migration/calendar--editor-date"));
|
|
15
|
-
var _checkboxCheckedEditorTask = _interopRequireDefault(require("@atlaskit/icon/core/migration/checkbox-checked--editor-task"));
|
|
16
17
|
var _decisionEditorDecision = _interopRequireDefault(require("@atlaskit/icon/core/migration/decision--editor-decision"));
|
|
17
18
|
var _emojiEditorEmoji = _interopRequireDefault(require("@atlaskit/icon/core/migration/emoji--editor-emoji"));
|
|
18
19
|
var _gridEditorTable = _interopRequireDefault(require("@atlaskit/icon/core/migration/grid--editor-table"));
|
|
@@ -24,8 +25,10 @@ var _mentionEditorMention = _interopRequireDefault(require("@atlaskit/icon/core/
|
|
|
24
25
|
var _minusEditorHorizontalRule = _interopRequireDefault(require("@atlaskit/icon/core/migration/minus--editor-horizontal-rule"));
|
|
25
26
|
var _quotationMarkQuote = _interopRequireDefault(require("@atlaskit/icon/core/migration/quotation-mark--quote"));
|
|
26
27
|
var _showMoreHorizontalEditorMore = _interopRequireDefault(require("@atlaskit/icon/core/migration/show-more-horizontal--editor-more"));
|
|
28
|
+
var _task = _interopRequireDefault(require("@atlaskit/icon/core/task"));
|
|
29
|
+
var _task2 = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/task"));
|
|
27
30
|
var _text = _interopRequireDefault(require("@atlaskit/icon/glyph/media-services/text"));
|
|
28
|
-
var
|
|
31
|
+
var _status2 = _interopRequireDefault(require("@atlaskit/icon/glyph/status"));
|
|
29
32
|
var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-down"));
|
|
30
33
|
var _chevronRightChevronRightCircle = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-right--chevron-right-circle"));
|
|
31
34
|
var _shallowEquals = require("./shallow-equals");
|
|
@@ -70,7 +73,14 @@ var action = exports.action = mem(function (init) {
|
|
|
70
73
|
disabled: init.disabled,
|
|
71
74
|
name: 'action',
|
|
72
75
|
shortcut: '[]',
|
|
73
|
-
Icon:
|
|
76
|
+
Icon: function Icon() {
|
|
77
|
+
return (0, _react2.jsx)(_task.default, {
|
|
78
|
+
label: "",
|
|
79
|
+
color: "currentColor",
|
|
80
|
+
spacing: "spacious",
|
|
81
|
+
LEGACY_fallbackIcon: _task2.default
|
|
82
|
+
});
|
|
83
|
+
},
|
|
74
84
|
'aria-keyshortcuts': '[ ] Space'
|
|
75
85
|
});
|
|
76
86
|
});
|
|
@@ -244,8 +254,11 @@ var placeholder = exports.placeholder = mem(function (init) {
|
|
|
244
254
|
disabled: init.disabled,
|
|
245
255
|
name: 'placeholder text',
|
|
246
256
|
Icon: function Icon() {
|
|
247
|
-
return (0, _react2.jsx)(
|
|
248
|
-
label: ""
|
|
257
|
+
return (0, _react2.jsx)(_fieldText.default, {
|
|
258
|
+
label: "",
|
|
259
|
+
spacing: "spacious",
|
|
260
|
+
color: "currentColor",
|
|
261
|
+
LEGACY_fallbackIcon: _text.default
|
|
249
262
|
});
|
|
250
263
|
}
|
|
251
264
|
});
|
|
@@ -256,7 +269,14 @@ var status = exports.status = mem(function (init) {
|
|
|
256
269
|
tooltipDescription: init.tooltipDescription,
|
|
257
270
|
disabled: init.disabled,
|
|
258
271
|
name: 'status',
|
|
259
|
-
Icon:
|
|
272
|
+
Icon: function Icon() {
|
|
273
|
+
return (0, _react2.jsx)(_status.default, {
|
|
274
|
+
label: "",
|
|
275
|
+
color: "currentColor",
|
|
276
|
+
spacing: "spacious",
|
|
277
|
+
LEGACY_fallbackIcon: _status2.default
|
|
278
|
+
});
|
|
279
|
+
}
|
|
260
280
|
});
|
|
261
281
|
});
|
|
262
282
|
var more = exports.more = mem(function (init) {
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -327,7 +327,6 @@ function ToolbarInsertBlockWithInjectionApi({
|
|
|
327
327
|
insertMenuItems: options.insertMenuItems,
|
|
328
328
|
editorActions: editorActions,
|
|
329
329
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
330
|
-
replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
|
|
331
330
|
showElementBrowserLink: options.showElementBrowserLink,
|
|
332
331
|
showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S,
|
|
333
332
|
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
@@ -23,7 +23,8 @@ const InsertMenu = ({
|
|
|
23
23
|
showElementBrowserLink,
|
|
24
24
|
onInsert,
|
|
25
25
|
toggleVisiblity,
|
|
26
|
-
pluginInjectionApi
|
|
26
|
+
pluginInjectionApi,
|
|
27
|
+
isFullPageAppearance
|
|
27
28
|
}) => {
|
|
28
29
|
var _pluginInjectionApi$q7, _pluginInjectionApi$q8, _pluginInjectionApi$q9;
|
|
29
30
|
const [itemCount, setItemCount] = useState(0);
|
|
@@ -52,7 +53,7 @@ const InsertMenu = ({
|
|
|
52
53
|
if (!editorView.hasFocus()) {
|
|
53
54
|
editorView.focus();
|
|
54
55
|
}
|
|
55
|
-
if (editorExperiment('insert-menu-in-right-rail', true)) {
|
|
56
|
+
if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
56
57
|
var _pluginInjectionApi$q;
|
|
57
58
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 ? void 0 : _pluginInjectionApi$q.actions.insertItem(item,
|
|
58
59
|
// @ts-expect-error
|
|
@@ -61,7 +62,7 @@ const InsertMenu = ({
|
|
|
61
62
|
var _pluginInjectionApi$q2;
|
|
62
63
|
pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q2 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q2 === void 0 ? void 0 : _pluginInjectionApi$q2.actions.insertItem(item, INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
|
|
63
64
|
}
|
|
64
|
-
}, [editorView, toggleVisiblity, pluginInjectionApi]);
|
|
65
|
+
}, [editorView, toggleVisiblity, pluginInjectionApi, isFullPageAppearance]);
|
|
65
66
|
const getItems = useCallback((query, category) => {
|
|
66
67
|
let result;
|
|
67
68
|
/**
|
|
@@ -82,9 +83,9 @@ const InsertMenu = ({
|
|
|
82
83
|
category,
|
|
83
84
|
featuredItems: true,
|
|
84
85
|
// @ts-ignore
|
|
85
|
-
templateItems: editorExperiment('element-level-templates', true)
|
|
86
|
+
templateItems: isFullPageAppearance && editorExperiment('element-level-templates', true)
|
|
86
87
|
})) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
|
|
87
|
-
if (editorExperiment('element-level-templates', true)) {
|
|
88
|
+
if (isFullPageAppearance && editorExperiment('element-level-templates', true)) {
|
|
88
89
|
// Make sure template options appear as top 5 items
|
|
89
90
|
featuredQuickInsertSuggestions.sort((a, b) => {
|
|
90
91
|
var _b$priority, _a$priority;
|
|
@@ -98,12 +99,12 @@ const InsertMenu = ({
|
|
|
98
99
|
}
|
|
99
100
|
setItemCount(result.length);
|
|
100
101
|
return result;
|
|
101
|
-
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.actions, quickInsertDropdownItems]);
|
|
102
|
+
}, [pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.actions, quickInsertDropdownItems, isFullPageAppearance]);
|
|
102
103
|
const emptyStateHandler = pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$q8 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q8 === void 0 ? void 0 : (_pluginInjectionApi$q9 = _pluginInjectionApi$q8.sharedState.currentState()) === null || _pluginInjectionApi$q9 === void 0 ? void 0 : _pluginInjectionApi$q9.emptyStateHandler;
|
|
103
104
|
return (
|
|
104
105
|
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
105
106
|
jsx("div", {
|
|
106
|
-
css: insertMenuWrapper(itemCount)
|
|
107
|
+
css: insertMenuWrapper(itemCount, isFullPageAppearance)
|
|
107
108
|
}, jsx(ElementBrowserWrapper, {
|
|
108
109
|
handleClickOutside: toggleVisiblity,
|
|
109
110
|
handleEscapeKeydown: toggleVisiblity,
|
|
@@ -149,8 +150,8 @@ const getInsertMenuHeight = ({
|
|
|
149
150
|
}
|
|
150
151
|
return 560; // For showing 6 Elements.
|
|
151
152
|
};
|
|
152
|
-
const insertMenuWrapper = itemCount => {
|
|
153
|
-
if (editorExperiment('insert-menu-in-right-rail', true)) {
|
|
153
|
+
const insertMenuWrapper = (itemCount, isFullPageAppearance) => {
|
|
154
|
+
if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
|
|
154
155
|
return css({
|
|
155
156
|
display: 'flex',
|
|
156
157
|
flexDirection: 'column',
|
|
@@ -37,8 +37,19 @@ const buttonStyles = xcss({
|
|
|
37
37
|
outline: `2px solid ${"var(--ds-border-focused, #388BFF)"}`
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
|
+
const disabledStyles = xcss({
|
|
41
|
+
color: 'color.text.disabled',
|
|
42
|
+
backgroundColor: 'color.background.neutral',
|
|
43
|
+
':hover': {
|
|
44
|
+
backgroundColor: 'color.background.neutral'
|
|
45
|
+
},
|
|
46
|
+
':active': {
|
|
47
|
+
backgroundColor: 'color.background.neutral'
|
|
48
|
+
}
|
|
49
|
+
});
|
|
40
50
|
export const RightRailIcon = ({
|
|
41
|
-
onClick
|
|
51
|
+
onClick,
|
|
52
|
+
isDisabled
|
|
42
53
|
}) => {
|
|
43
54
|
const {
|
|
44
55
|
formatMessage
|
|
@@ -55,8 +66,9 @@ export const RightRailIcon = ({
|
|
|
55
66
|
}, /*#__PURE__*/React.createElement(Pressable, {
|
|
56
67
|
type: "button",
|
|
57
68
|
"aria-label": formatMessage(toolbarInsertBlockMessages.insertMenu),
|
|
58
|
-
xcss: [buttonStyles],
|
|
59
|
-
onClick: onClick
|
|
69
|
+
xcss: [buttonStyles, isDisabled ? disabledStyles : undefined],
|
|
70
|
+
onClick: onClick,
|
|
71
|
+
isDisabled: isDisabled
|
|
60
72
|
}, /*#__PURE__*/React.createElement(EditorAddIcon, {
|
|
61
73
|
label: formatMessage(toolbarInsertBlockMessages.insertMenu),
|
|
62
74
|
size: "medium"
|
|
@@ -19,7 +19,8 @@ export const BlockInsertElementBrowser = props => {
|
|
|
19
19
|
onInsert: props.onInsert,
|
|
20
20
|
toggleVisiblity: props.togglePlusMenuVisibility,
|
|
21
21
|
showElementBrowserLink: props.showElementBrowserLink,
|
|
22
|
-
pluginInjectionApi: props.pluginInjectionApi
|
|
22
|
+
pluginInjectionApi: props.pluginInjectionApi,
|
|
23
|
+
isFullPageAppearance: props.isFullPageAppearance
|
|
23
24
|
})), /*#__PURE__*/React.createElement(DropDownButton, {
|
|
24
25
|
"aria-expanded": props.open,
|
|
25
26
|
"aria-haspopup": true,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BlockInsertElementBrowser } from './block-insert-element-browser';
|
|
3
|
-
import { BlockInsertMenuLegacy } from './block-insert-menu-legacy';
|
|
4
3
|
import { DropDownButton } from './dropdown-button';
|
|
5
4
|
export const BlockInsertMenu = props => {
|
|
6
5
|
if (props.items.length === 0) {
|
|
@@ -20,40 +19,24 @@ export const BlockInsertMenu = props => {
|
|
|
20
19
|
"aria-keyshortcuts": "/"
|
|
21
20
|
}));
|
|
22
21
|
}
|
|
23
|
-
|
|
24
|
-
return /*#__PURE__*/React.createElement(BlockInsertElementBrowser, {
|
|
25
|
-
disabled: props.disabled,
|
|
26
|
-
editorView: props.editorView,
|
|
27
|
-
items: props.items,
|
|
28
|
-
label: props.label,
|
|
29
|
-
onClick: props.onClick,
|
|
30
|
-
onKeyDown: props.onKeyDown,
|
|
31
|
-
onInsert: props.onInsert,
|
|
32
|
-
onRef: props.onPlusButtonRef,
|
|
33
|
-
open: props.open,
|
|
34
|
-
plusButtonRef: props.plusButtonRef,
|
|
35
|
-
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
36
|
-
popupsMountPoint: props.popupsMountPoint,
|
|
37
|
-
popupsScrollableElement: props.popupsScrollableElement,
|
|
38
|
-
spacing: props.spacing,
|
|
39
|
-
togglePlusMenuVisibility: props.togglePlusMenuVisibility,
|
|
40
|
-
showElementBrowserLink: props.showElementBrowserLink,
|
|
41
|
-
pluginInjectionApi: props.pluginInjectionApi
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
return /*#__PURE__*/React.createElement(BlockInsertMenuLegacy, {
|
|
22
|
+
return /*#__PURE__*/React.createElement(BlockInsertElementBrowser, {
|
|
45
23
|
disabled: props.disabled,
|
|
24
|
+
editorView: props.editorView,
|
|
46
25
|
items: props.items,
|
|
47
26
|
label: props.label,
|
|
48
27
|
onClick: props.onClick,
|
|
49
28
|
onKeyDown: props.onKeyDown,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
onRef: props.onRef,
|
|
29
|
+
onInsert: props.onInsert,
|
|
30
|
+
onRef: props.onPlusButtonRef,
|
|
53
31
|
open: props.open,
|
|
32
|
+
plusButtonRef: props.plusButtonRef,
|
|
54
33
|
popupsBoundariesElement: props.popupsBoundariesElement,
|
|
55
34
|
popupsMountPoint: props.popupsMountPoint,
|
|
56
35
|
popupsScrollableElement: props.popupsScrollableElement,
|
|
57
|
-
spacing: props.spacing
|
|
36
|
+
spacing: props.spacing,
|
|
37
|
+
togglePlusMenuVisibility: props.togglePlusMenuVisibility,
|
|
38
|
+
showElementBrowserLink: props.showElementBrowserLink,
|
|
39
|
+
pluginInjectionApi: props.pluginInjectionApi,
|
|
40
|
+
isFullPageAppearance: props.isFullPageAppearance
|
|
58
41
|
});
|
|
59
42
|
};
|
|
@@ -6,7 +6,6 @@ import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
|
6
6
|
import { action, blockquote, codeblock, date, decision, emoji, expand, horizontalrule, imageUpload, layout, link, media, mention, more, panel, placeholder, status, table, tableSelector } from './item';
|
|
7
7
|
import { messages } from './messages';
|
|
8
8
|
import { shallowEquals } from './shallow-equals';
|
|
9
|
-
import { sortItems } from './sort-items';
|
|
10
9
|
const buttonToItem = memoize(button => ({
|
|
11
10
|
...button,
|
|
12
11
|
title: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
@@ -49,8 +48,7 @@ const createInsertBlockItems = config => {
|
|
|
49
48
|
expandEnabled,
|
|
50
49
|
numberOfButtons,
|
|
51
50
|
schema,
|
|
52
|
-
formatMessage
|
|
53
|
-
isNewMenuEnabled
|
|
51
|
+
formatMessage
|
|
54
52
|
} = config;
|
|
55
53
|
const items = [];
|
|
56
54
|
if (actionSupported) {
|
|
@@ -205,7 +203,7 @@ const createInsertBlockItems = config => {
|
|
|
205
203
|
name
|
|
206
204
|
}
|
|
207
205
|
}) => name !== 'table selector');
|
|
208
|
-
const dropdownItems =
|
|
206
|
+
const dropdownItems = remainingItems.map(buttonToDropdownItem(formatMessage(messages.insertMenu)));
|
|
209
207
|
return [buttonItems, dropdownItems];
|
|
210
208
|
};
|
|
211
209
|
export const createItems = memoizeOne(createInsertBlockItems, shallowEquals);
|