@atlaskit/editor-plugin-insert-block 1.14.6 → 2.0.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 +16 -0
- package/dist/cjs/plugin.js +0 -1
- package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +9 -27
- package/dist/cjs/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/cjs/ui/ToolbarInsertBlock/index.js +3 -7
- package/dist/cjs/ui/ToolbarInsertBlock/item.js +26 -6
- package/dist/es2019/plugin.js +0 -1
- package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +9 -27
- package/dist/es2019/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/es2019/ui/ToolbarInsertBlock/index.js +4 -7
- package/dist/es2019/ui/ToolbarInsertBlock/item.js +22 -6
- package/dist/esm/plugin.js +0 -1
- package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +9 -27
- package/dist/esm/ui/ToolbarInsertBlock/create-items.js +2 -4
- package/dist/esm/ui/ToolbarInsertBlock/index.js +3 -7
- package/dist/esm/ui/ToolbarInsertBlock/item.js +26 -6
- package/dist/types/plugin.d.ts +0 -1
- package/dist/types/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -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/ToolbarInsertBlock/block-insert-menu.d.ts +0 -1
- package/dist/types-ts4.5/ui/ToolbarInsertBlock/types.d.ts +1 -2
- package/package.json +5 -4
- 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,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-insert-block
|
|
2
2
|
|
|
3
|
+
## 2.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#141573](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141573)
|
|
8
|
+
[`2360742cbceac`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2360742cbceac) -
|
|
9
|
+
[ux] Removing replacePlusMenuWithElementBrowser option from insert-block plugin. This is to ensure
|
|
10
|
+
consistent UI and reduce unnecessary code bundled with the editor. If you are currently using this
|
|
11
|
+
option you must remove it and it will use the new approach only now.
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#140915](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/140915)
|
|
16
|
+
[`eaccad51157d6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/eaccad51157d6) -
|
|
17
|
+
[ux] Migrate new icons including color, highlight and task on Editor primary toolbar
|
|
18
|
+
|
|
3
19
|
## 1.14.6
|
|
4
20
|
|
|
5
21
|
### 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
|
|
@@ -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,23 @@ 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
|
|
65
47
|
});
|
|
66
48
|
};
|
|
@@ -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,6 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
660
659
|
_tableSelectorButton5,
|
|
661
660
|
_tableSelectorButton6,
|
|
662
661
|
_this$props$isDisable,
|
|
663
|
-
_this$props$replacePl,
|
|
664
662
|
_this$props$pluginInj3;
|
|
665
663
|
var _this$state2 = this.state,
|
|
666
664
|
buttons = _this$state2.buttons,
|
|
@@ -789,7 +787,6 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
789
787
|
onInsert: this.insertInsertMenuItem,
|
|
790
788
|
onOpenChange: this.onOpenChange,
|
|
791
789
|
togglePlusMenuVisibility: this.togglePlusMenuVisibility,
|
|
792
|
-
replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
|
|
793
790
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
794
791
|
pluginInjectionApi: this.props.pluginInjectionApi
|
|
795
792
|
})), !((_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 */
|
|
@@ -829,8 +826,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
|
|
|
829
826
|
insertMenuItems: props.insertMenuItems,
|
|
830
827
|
schema: props.editorView.state.schema,
|
|
831
828
|
numberOfButtons: props.buttons,
|
|
832
|
-
formatMessage: props.intl.formatMessage
|
|
833
|
-
isNewMenuEnabled: props.replacePlusMenuWithElementBrowser
|
|
829
|
+
formatMessage: props.intl.formatMessage
|
|
834
830
|
}),
|
|
835
831
|
_createItems2 = (0, _slicedToArray2.default)(_createItems, 2),
|
|
836
832
|
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
|
|
@@ -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,23 @@ 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
|
|
58
40
|
});
|
|
59
41
|
};
|
|
@@ -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);
|
|
@@ -586,8 +586,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
586
586
|
insertMenuItems: props.insertMenuItems,
|
|
587
587
|
schema: props.editorView.state.schema,
|
|
588
588
|
numberOfButtons: props.buttons,
|
|
589
|
-
formatMessage: props.intl.formatMessage
|
|
590
|
-
isNewMenuEnabled: props.replacePlusMenuWithElementBrowser
|
|
589
|
+
formatMessage: props.intl.formatMessage
|
|
591
590
|
});
|
|
592
591
|
return {
|
|
593
592
|
...state,
|
|
@@ -629,15 +628,14 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
629
628
|
popupsMountPoint,
|
|
630
629
|
popupsBoundariesElement,
|
|
631
630
|
popupsScrollableElement,
|
|
632
|
-
emojiProvider
|
|
633
|
-
replacePlusMenuWithElementBrowser
|
|
631
|
+
emojiProvider
|
|
634
632
|
} = this.props;
|
|
635
633
|
const dropdownEmoji = this.state.dropdownItems.some(({
|
|
636
634
|
value: {
|
|
637
635
|
name
|
|
638
636
|
}
|
|
639
637
|
}) => name === 'emoji');
|
|
640
|
-
const dropDownButtonRef =
|
|
638
|
+
const dropDownButtonRef = this.plusButtonRef;
|
|
641
639
|
const ref = dropdownEmoji ? dropDownButtonRef : this.emojiButtonRef;
|
|
642
640
|
if (!emojiPickerOpen || !ref || !emojiProvider) {
|
|
643
641
|
return null;
|
|
@@ -705,7 +703,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
705
703
|
});
|
|
706
704
|
}
|
|
707
705
|
render() {
|
|
708
|
-
var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$
|
|
706
|
+
var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$pluginInj7;
|
|
709
707
|
const {
|
|
710
708
|
buttons,
|
|
711
709
|
dropdownItems,
|
|
@@ -824,7 +822,6 @@ export class ToolbarInsertBlock extends React.PureComponent {
|
|
|
824
822
|
onInsert: this.insertInsertMenuItem,
|
|
825
823
|
onOpenChange: this.onOpenChange,
|
|
826
824
|
togglePlusMenuVisibility: this.togglePlusMenuVisibility,
|
|
827
|
-
replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
|
|
828
825
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
829
826
|
pluginInjectionApi: this.props.pluginInjectionApi
|
|
830
827
|
})), !((_this$props$pluginInj7 = this.props.pluginInjectionApi) !== null && _this$props$pluginInj7 !== void 0 && _this$props$pluginInj7.primaryToolbar) && this.props.showSeparator && /* eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage */
|
|
@@ -9,9 +9,10 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import memoizeOne from 'memoize-one';
|
|
10
10
|
import { addLink, getAriaKeyshortcuts, toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
11
11
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
12
|
+
import FieldTextIcon from '@atlaskit/icon-lab/core/field-text';
|
|
13
|
+
import StatusIcon from '@atlaskit/icon-lab/core/status';
|
|
12
14
|
import AngleBracketsIcon from '@atlaskit/icon/core/migration/angle-brackets--editor-code';
|
|
13
15
|
import CalendarIcon from '@atlaskit/icon/core/migration/calendar--editor-date';
|
|
14
|
-
import CheckboxCheckedIcon from '@atlaskit/icon/core/migration/checkbox-checked--editor-task';
|
|
15
16
|
import DecisionIcon from '@atlaskit/icon/core/migration/decision--editor-decision';
|
|
16
17
|
import EmojiIcon from '@atlaskit/icon/core/migration/emoji--editor-emoji';
|
|
17
18
|
import GridIcon from '@atlaskit/icon/core/migration/grid--editor-table';
|
|
@@ -23,8 +24,10 @@ import MentionIcon from '@atlaskit/icon/core/migration/mention--editor-mention';
|
|
|
23
24
|
import HorizontalRuleIcon from '@atlaskit/icon/core/migration/minus--editor-horizontal-rule';
|
|
24
25
|
import QuotationMarkIcon from '@atlaskit/icon/core/migration/quotation-mark--quote';
|
|
25
26
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/migration/show-more-horizontal--editor-more';
|
|
27
|
+
import TaskIcon from '@atlaskit/icon/core/task';
|
|
28
|
+
import CheckboxCheckedIconLegacy from '@atlaskit/icon/glyph/editor/task';
|
|
26
29
|
import PlaceholderTextIcon from '@atlaskit/icon/glyph/media-services/text';
|
|
27
|
-
import
|
|
30
|
+
import StatusIconLegacy from '@atlaskit/icon/glyph/status';
|
|
28
31
|
import ChevronDownIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
29
32
|
import ExpandNodeIcon from '@atlaskit/icon/utility/migration/chevron-right--chevron-right-circle';
|
|
30
33
|
import { shallowEquals } from './shallow-equals';
|
|
@@ -58,7 +61,12 @@ export const action = mem(init => {
|
|
|
58
61
|
disabled: init.disabled,
|
|
59
62
|
name: 'action',
|
|
60
63
|
shortcut: '[]',
|
|
61
|
-
Icon:
|
|
64
|
+
Icon: () => jsx(TaskIcon, {
|
|
65
|
+
label: "",
|
|
66
|
+
color: "currentColor",
|
|
67
|
+
spacing: "spacious",
|
|
68
|
+
LEGACY_fallbackIcon: CheckboxCheckedIconLegacy
|
|
69
|
+
}),
|
|
62
70
|
'aria-keyshortcuts': '[ ] Space'
|
|
63
71
|
});
|
|
64
72
|
});
|
|
@@ -198,8 +206,11 @@ export const placeholder = mem(init => from({
|
|
|
198
206
|
tooltipDescription: init.tooltipDescription,
|
|
199
207
|
disabled: init.disabled,
|
|
200
208
|
name: 'placeholder text',
|
|
201
|
-
Icon: () => jsx(
|
|
202
|
-
label: ""
|
|
209
|
+
Icon: () => jsx(FieldTextIcon, {
|
|
210
|
+
label: "",
|
|
211
|
+
spacing: "spacious",
|
|
212
|
+
color: "currentColor",
|
|
213
|
+
LEGACY_fallbackIcon: PlaceholderTextIcon
|
|
203
214
|
})
|
|
204
215
|
}));
|
|
205
216
|
export const status = mem(init => from({
|
|
@@ -207,7 +218,12 @@ export const status = mem(init => from({
|
|
|
207
218
|
tooltipDescription: init.tooltipDescription,
|
|
208
219
|
disabled: init.disabled,
|
|
209
220
|
name: 'status',
|
|
210
|
-
Icon: StatusIcon
|
|
221
|
+
Icon: () => jsx(StatusIcon, {
|
|
222
|
+
label: "",
|
|
223
|
+
color: "currentColor",
|
|
224
|
+
spacing: "spacious",
|
|
225
|
+
LEGACY_fallbackIcon: StatusIconLegacy
|
|
226
|
+
})
|
|
211
227
|
}));
|
|
212
228
|
export const more = mem(init => from({
|
|
213
229
|
content: init.content,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -322,7 +322,6 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
|
|
|
322
322
|
insertMenuItems: options.insertMenuItems,
|
|
323
323
|
editorActions: editorActions,
|
|
324
324
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
325
|
-
replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
|
|
326
325
|
showElementBrowserLink: options.showElementBrowserLink,
|
|
327
326
|
showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S,
|
|
328
327
|
registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
|
|
@@ -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 var BlockInsertMenu = function BlockInsertMenu(props) {
|
|
6
5
|
if (props.items.length === 0) {
|
|
@@ -20,40 +19,23 @@ export var BlockInsertMenu = function 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
|
|
58
40
|
});
|
|
59
41
|
};
|
|
@@ -10,7 +10,6 @@ import { blockTypeMessages } from '@atlaskit/editor-common/messages';
|
|
|
10
10
|
import { action, blockquote, codeblock, date, decision, emoji, expand, horizontalrule, imageUpload, layout, link, media, mention, more, panel, placeholder, status, table, tableSelector } from './item';
|
|
11
11
|
import { messages } from './messages';
|
|
12
12
|
import { shallowEquals } from './shallow-equals';
|
|
13
|
-
import { sortItems } from './sort-items';
|
|
14
13
|
var buttonToItem = memoize(function (button) {
|
|
15
14
|
return _objectSpread(_objectSpread({}, button), {}, {
|
|
16
15
|
title: /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
@@ -56,8 +55,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
56
55
|
expandEnabled = config.expandEnabled,
|
|
57
56
|
numberOfButtons = config.numberOfButtons,
|
|
58
57
|
schema = config.schema,
|
|
59
|
-
formatMessage = config.formatMessage
|
|
60
|
-
isNewMenuEnabled = config.isNewMenuEnabled;
|
|
58
|
+
formatMessage = config.formatMessage;
|
|
61
59
|
var items = [];
|
|
62
60
|
if (actionSupported) {
|
|
63
61
|
items.push(action({
|
|
@@ -216,7 +214,7 @@ var createInsertBlockItems = function createInsertBlockItems(config) {
|
|
|
216
214
|
var name = _ref.value.name;
|
|
217
215
|
return name !== 'table selector';
|
|
218
216
|
});
|
|
219
|
-
var dropdownItems =
|
|
217
|
+
var dropdownItems = remainingItems.map(buttonToDropdownItem(formatMessage(messages.insertMenu)));
|
|
220
218
|
return [buttonItems, dropdownItems];
|
|
221
219
|
};
|
|
222
220
|
export var createItems = memoizeOne(createInsertBlockItems, shallowEquals);
|
|
@@ -560,13 +560,12 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
560
560
|
popupsMountPoint = _this$props11.popupsMountPoint,
|
|
561
561
|
popupsBoundariesElement = _this$props11.popupsBoundariesElement,
|
|
562
562
|
popupsScrollableElement = _this$props11.popupsScrollableElement,
|
|
563
|
-
emojiProvider = _this$props11.emojiProvider
|
|
564
|
-
replacePlusMenuWithElementBrowser = _this$props11.replacePlusMenuWithElementBrowser;
|
|
563
|
+
emojiProvider = _this$props11.emojiProvider;
|
|
565
564
|
var dropdownEmoji = this.state.dropdownItems.some(function (_ref7) {
|
|
566
565
|
var name = _ref7.value.name;
|
|
567
566
|
return name === 'emoji';
|
|
568
567
|
});
|
|
569
|
-
var dropDownButtonRef =
|
|
568
|
+
var dropDownButtonRef = this.plusButtonRef;
|
|
570
569
|
var ref = dropdownEmoji ? dropDownButtonRef : this.emojiButtonRef;
|
|
571
570
|
if (!emojiPickerOpen || !ref || !emojiProvider) {
|
|
572
571
|
return null;
|
|
@@ -651,7 +650,6 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
651
650
|
_tableSelectorButton5,
|
|
652
651
|
_tableSelectorButton6,
|
|
653
652
|
_this$props$isDisable,
|
|
654
|
-
_this$props$replacePl,
|
|
655
653
|
_this$props$pluginInj3;
|
|
656
654
|
var _this$state2 = this.state,
|
|
657
655
|
buttons = _this$state2.buttons,
|
|
@@ -780,7 +778,6 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
780
778
|
onInsert: this.insertInsertMenuItem,
|
|
781
779
|
onOpenChange: this.onOpenChange,
|
|
782
780
|
togglePlusMenuVisibility: this.togglePlusMenuVisibility,
|
|
783
|
-
replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
|
|
784
781
|
showElementBrowserLink: this.props.showElementBrowserLink || false,
|
|
785
782
|
pluginInjectionApi: this.props.pluginInjectionApi
|
|
786
783
|
})), !((_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 */
|
|
@@ -820,8 +817,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
820
817
|
insertMenuItems: props.insertMenuItems,
|
|
821
818
|
schema: props.editorView.state.schema,
|
|
822
819
|
numberOfButtons: props.buttons,
|
|
823
|
-
formatMessage: props.intl.formatMessage
|
|
824
|
-
isNewMenuEnabled: props.replacePlusMenuWithElementBrowser
|
|
820
|
+
formatMessage: props.intl.formatMessage
|
|
825
821
|
}),
|
|
826
822
|
_createItems2 = _slicedToArray(_createItems, 2),
|
|
827
823
|
buttons = _createItems2[0],
|
|
@@ -9,9 +9,10 @@ import { jsx } from '@emotion/react';
|
|
|
9
9
|
import memoizeOne from 'memoize-one';
|
|
10
10
|
import { addLink, getAriaKeyshortcuts, toggleTable, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
11
11
|
import { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
|
|
12
|
+
import FieldTextIcon from '@atlaskit/icon-lab/core/field-text';
|
|
13
|
+
import StatusIcon from '@atlaskit/icon-lab/core/status';
|
|
12
14
|
import AngleBracketsIcon from '@atlaskit/icon/core/migration/angle-brackets--editor-code';
|
|
13
15
|
import CalendarIcon from '@atlaskit/icon/core/migration/calendar--editor-date';
|
|
14
|
-
import CheckboxCheckedIcon from '@atlaskit/icon/core/migration/checkbox-checked--editor-task';
|
|
15
16
|
import DecisionIcon from '@atlaskit/icon/core/migration/decision--editor-decision';
|
|
16
17
|
import EmojiIcon from '@atlaskit/icon/core/migration/emoji--editor-emoji';
|
|
17
18
|
import GridIcon from '@atlaskit/icon/core/migration/grid--editor-table';
|
|
@@ -23,8 +24,10 @@ import MentionIcon from '@atlaskit/icon/core/migration/mention--editor-mention';
|
|
|
23
24
|
import HorizontalRuleIcon from '@atlaskit/icon/core/migration/minus--editor-horizontal-rule';
|
|
24
25
|
import QuotationMarkIcon from '@atlaskit/icon/core/migration/quotation-mark--quote';
|
|
25
26
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/migration/show-more-horizontal--editor-more';
|
|
27
|
+
import TaskIcon from '@atlaskit/icon/core/task';
|
|
28
|
+
import CheckboxCheckedIconLegacy from '@atlaskit/icon/glyph/editor/task';
|
|
26
29
|
import PlaceholderTextIcon from '@atlaskit/icon/glyph/media-services/text';
|
|
27
|
-
import
|
|
30
|
+
import StatusIconLegacy from '@atlaskit/icon/glyph/status';
|
|
28
31
|
import ChevronDownIcon from '@atlaskit/icon/utility/migration/chevron-down';
|
|
29
32
|
import ExpandNodeIcon from '@atlaskit/icon/utility/migration/chevron-right--chevron-right-circle';
|
|
30
33
|
import { shallowEquals } from './shallow-equals';
|
|
@@ -62,7 +65,14 @@ export var action = mem(function (init) {
|
|
|
62
65
|
disabled: init.disabled,
|
|
63
66
|
name: 'action',
|
|
64
67
|
shortcut: '[]',
|
|
65
|
-
Icon:
|
|
68
|
+
Icon: function Icon() {
|
|
69
|
+
return jsx(TaskIcon, {
|
|
70
|
+
label: "",
|
|
71
|
+
color: "currentColor",
|
|
72
|
+
spacing: "spacious",
|
|
73
|
+
LEGACY_fallbackIcon: CheckboxCheckedIconLegacy
|
|
74
|
+
});
|
|
75
|
+
},
|
|
66
76
|
'aria-keyshortcuts': '[ ] Space'
|
|
67
77
|
});
|
|
68
78
|
});
|
|
@@ -236,8 +246,11 @@ export var placeholder = mem(function (init) {
|
|
|
236
246
|
disabled: init.disabled,
|
|
237
247
|
name: 'placeholder text',
|
|
238
248
|
Icon: function Icon() {
|
|
239
|
-
return jsx(
|
|
240
|
-
label: ""
|
|
249
|
+
return jsx(FieldTextIcon, {
|
|
250
|
+
label: "",
|
|
251
|
+
spacing: "spacious",
|
|
252
|
+
color: "currentColor",
|
|
253
|
+
LEGACY_fallbackIcon: PlaceholderTextIcon
|
|
241
254
|
});
|
|
242
255
|
}
|
|
243
256
|
});
|
|
@@ -248,7 +261,14 @@ export var status = mem(function (init) {
|
|
|
248
261
|
tooltipDescription: init.tooltipDescription,
|
|
249
262
|
disabled: init.disabled,
|
|
250
263
|
name: 'status',
|
|
251
|
-
Icon:
|
|
264
|
+
Icon: function Icon() {
|
|
265
|
+
return jsx(StatusIcon, {
|
|
266
|
+
label: "",
|
|
267
|
+
color: "currentColor",
|
|
268
|
+
spacing: "spacious",
|
|
269
|
+
LEGACY_fallbackIcon: StatusIconLegacy
|
|
270
|
+
});
|
|
271
|
+
}
|
|
252
272
|
});
|
|
253
273
|
});
|
|
254
274
|
export var more = mem(function (init) {
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export interface BlockInsertMenuProps {
|
|
|
15
15
|
popupsBoundariesElement?: HTMLElement;
|
|
16
16
|
popupsMountPoint?: HTMLElement;
|
|
17
17
|
popupsScrollableElement?: HTMLElement;
|
|
18
|
-
replacePlusMenuWithElementBrowser: boolean;
|
|
19
18
|
spacing: 'none' | 'default';
|
|
20
19
|
showElementBrowserLink: boolean;
|
|
21
20
|
onRef(el: HTMLElement): void;
|
|
@@ -42,12 +42,11 @@ export interface Props {
|
|
|
42
42
|
insertMenuItems?: MenuItem[];
|
|
43
43
|
showElementBrowserLink?: boolean;
|
|
44
44
|
showSeparator?: boolean;
|
|
45
|
-
replacePlusMenuWithElementBrowser?: boolean;
|
|
46
45
|
onShowMediaPicker?: () => void;
|
|
47
46
|
onInsertBlockType?: (name: string) => Command;
|
|
48
47
|
onInsertMacroFromMacroBrowser?: (macroProvider: MacroProvider, node?: PMNode, isEditing?: boolean) => (view: EditorView) => void;
|
|
49
48
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
50
|
-
pluginInjectionApi
|
|
49
|
+
pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
|
|
51
50
|
mentionsDisabled?: boolean;
|
|
52
51
|
editorAppearance?: EditorAppearance;
|
|
53
52
|
}
|
|
@@ -15,7 +15,6 @@ export interface BlockInsertMenuProps {
|
|
|
15
15
|
popupsBoundariesElement?: HTMLElement;
|
|
16
16
|
popupsMountPoint?: HTMLElement;
|
|
17
17
|
popupsScrollableElement?: HTMLElement;
|
|
18
|
-
replacePlusMenuWithElementBrowser: boolean;
|
|
19
18
|
spacing: 'none' | 'default';
|
|
20
19
|
showElementBrowserLink: boolean;
|
|
21
20
|
onRef(el: HTMLElement): void;
|
|
@@ -42,12 +42,11 @@ export interface Props {
|
|
|
42
42
|
insertMenuItems?: MenuItem[];
|
|
43
43
|
showElementBrowserLink?: boolean;
|
|
44
44
|
showSeparator?: boolean;
|
|
45
|
-
replacePlusMenuWithElementBrowser?: boolean;
|
|
46
45
|
onShowMediaPicker?: () => void;
|
|
47
46
|
onInsertBlockType?: (name: string) => Command;
|
|
48
47
|
onInsertMacroFromMacroBrowser?: (macroProvider: MacroProvider, node?: PMNode, isEditing?: boolean) => (view: EditorView) => void;
|
|
49
48
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
50
|
-
pluginInjectionApi
|
|
49
|
+
pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
|
|
51
50
|
mentionsDisabled?: boolean;
|
|
52
51
|
editorAppearance?: EditorAppearance;
|
|
53
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-insert-block",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Insert block plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,12 +32,12 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/button": "^20.1.0",
|
|
35
|
-
"@atlaskit/editor-common": "^89.
|
|
35
|
+
"@atlaskit/editor-common": "^89.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
37
37
|
"@atlaskit/editor-plugin-block-type": "^3.14.0",
|
|
38
38
|
"@atlaskit/editor-plugin-code-block": "^3.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-date": "^2.3.0",
|
|
40
|
-
"@atlaskit/editor-plugin-emoji": "^2.
|
|
40
|
+
"@atlaskit/editor-plugin-emoji": "^2.6.0",
|
|
41
41
|
"@atlaskit/editor-plugin-expand": "^2.6.0",
|
|
42
42
|
"@atlaskit/editor-plugin-extension": "^1.14.0",
|
|
43
43
|
"@atlaskit/editor-plugin-feature-flags": "^1.2.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/editor-plugin-layout": "^1.7.0",
|
|
47
47
|
"@atlaskit/editor-plugin-media": "^1.31.0",
|
|
48
48
|
"@atlaskit/editor-plugin-mentions": "^2.6.0",
|
|
49
|
-
"@atlaskit/editor-plugin-panel": "^2.
|
|
49
|
+
"@atlaskit/editor-plugin-panel": "^2.4.0",
|
|
50
50
|
"@atlaskit/editor-plugin-placeholder-text": "^1.7.0",
|
|
51
51
|
"@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
|
|
52
52
|
"@atlaskit/editor-plugin-quick-insert": "^1.3.0",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"@atlaskit/emoji": "^67.7.0",
|
|
61
61
|
"@atlaskit/heading": "2.4.5",
|
|
62
62
|
"@atlaskit/icon": "^22.18.0",
|
|
63
|
+
"@atlaskit/icon-lab": "^0.2.0",
|
|
63
64
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
64
65
|
"@atlaskit/primitives": "^12.1.0",
|
|
65
66
|
"@atlaskit/theme": "^13.0.0",
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.BlockInsertMenuLegacy = void 0;
|
|
8
|
-
var _react = _interopRequireDefault(require("react"));
|
|
9
|
-
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
10
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
|
-
var _dropdownButton = require("./dropdown-button");
|
|
12
|
-
var BlockInsertMenuLegacy = exports.BlockInsertMenuLegacy = function BlockInsertMenuLegacy(props) {
|
|
13
|
-
var items = props.items;
|
|
14
|
-
var dropdownItems = _react.default.useMemo(function () {
|
|
15
|
-
return [{
|
|
16
|
-
items: items
|
|
17
|
-
}];
|
|
18
|
-
}, [items]);
|
|
19
|
-
return /*#__PURE__*/_react.default.createElement(_uiMenu.DropdownMenuWithKeyboardNavigation, {
|
|
20
|
-
items: dropdownItems,
|
|
21
|
-
onItemActivated: props.onItemActivated,
|
|
22
|
-
onOpenChange: props.onOpenChange,
|
|
23
|
-
mountTo: props.popupsMountPoint,
|
|
24
|
-
boundariesElement: props.popupsBoundariesElement,
|
|
25
|
-
scrollableElement: props.popupsScrollableElement,
|
|
26
|
-
isOpen: props.open,
|
|
27
|
-
fitHeight: 188,
|
|
28
|
-
fitWidth: 175,
|
|
29
|
-
zIndex: _editorSharedStyles.akEditorMenuZIndex
|
|
30
|
-
}, /*#__PURE__*/_react.default.createElement(_dropdownButton.DropDownButton, {
|
|
31
|
-
"aria-expanded": props.open,
|
|
32
|
-
"aria-haspopup": true,
|
|
33
|
-
handleRef: props.onRef,
|
|
34
|
-
selected: props.open,
|
|
35
|
-
disabled: props.disabled,
|
|
36
|
-
onClick: props.onClick,
|
|
37
|
-
onKeyDown: props.onKeyDown,
|
|
38
|
-
spacing: props.spacing,
|
|
39
|
-
label: props.label,
|
|
40
|
-
"aria-keyshortcuts": "/"
|
|
41
|
-
}));
|
|
42
|
-
};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.sortItems = void 0;
|
|
7
|
-
var endPositionNames = ['macro-browser', 'slash-onboarding'];
|
|
8
|
-
var isMacro = function isMacro(item) {
|
|
9
|
-
return typeof item.content === 'string' && item.content.includes('macro');
|
|
10
|
-
};
|
|
11
|
-
var sortItems = exports.sortItems = function sortItems(items) {
|
|
12
|
-
return items.sort(function (a, b) {
|
|
13
|
-
if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
|
|
14
|
-
return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
|
|
15
|
-
}
|
|
16
|
-
if (endPositionNames.includes(b.value.name)) {
|
|
17
|
-
return -1;
|
|
18
|
-
}
|
|
19
|
-
if (endPositionNames.includes(a.value.name)) {
|
|
20
|
-
return 1;
|
|
21
|
-
}
|
|
22
|
-
if (isMacro(a) && !isMacro(b)) {
|
|
23
|
-
return 1;
|
|
24
|
-
}
|
|
25
|
-
if (isMacro(b) && !isMacro(a)) {
|
|
26
|
-
return -1;
|
|
27
|
-
}
|
|
28
|
-
return a.content < b.content ? -1 : 1;
|
|
29
|
-
});
|
|
30
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { DropDownButton } from './dropdown-button';
|
|
5
|
-
export const BlockInsertMenuLegacy = props => {
|
|
6
|
-
const {
|
|
7
|
-
items
|
|
8
|
-
} = props;
|
|
9
|
-
const dropdownItems = React.useMemo(() => [{
|
|
10
|
-
items
|
|
11
|
-
}], [items]);
|
|
12
|
-
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
13
|
-
items: dropdownItems,
|
|
14
|
-
onItemActivated: props.onItemActivated,
|
|
15
|
-
onOpenChange: props.onOpenChange,
|
|
16
|
-
mountTo: props.popupsMountPoint,
|
|
17
|
-
boundariesElement: props.popupsBoundariesElement,
|
|
18
|
-
scrollableElement: props.popupsScrollableElement,
|
|
19
|
-
isOpen: props.open,
|
|
20
|
-
fitHeight: 188,
|
|
21
|
-
fitWidth: 175,
|
|
22
|
-
zIndex: akEditorMenuZIndex
|
|
23
|
-
}, /*#__PURE__*/React.createElement(DropDownButton, {
|
|
24
|
-
"aria-expanded": props.open,
|
|
25
|
-
"aria-haspopup": true,
|
|
26
|
-
handleRef: props.onRef,
|
|
27
|
-
selected: props.open,
|
|
28
|
-
disabled: props.disabled,
|
|
29
|
-
onClick: props.onClick,
|
|
30
|
-
onKeyDown: props.onKeyDown,
|
|
31
|
-
spacing: props.spacing,
|
|
32
|
-
label: props.label,
|
|
33
|
-
"aria-keyshortcuts": "/"
|
|
34
|
-
}));
|
|
35
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
const endPositionNames = ['macro-browser', 'slash-onboarding'];
|
|
2
|
-
const isMacro = item => typeof item.content === 'string' && item.content.includes('macro');
|
|
3
|
-
export const sortItems = items => {
|
|
4
|
-
return items.sort((a, b) => {
|
|
5
|
-
if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
|
|
6
|
-
return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
|
|
7
|
-
}
|
|
8
|
-
if (endPositionNames.includes(b.value.name)) {
|
|
9
|
-
return -1;
|
|
10
|
-
}
|
|
11
|
-
if (endPositionNames.includes(a.value.name)) {
|
|
12
|
-
return 1;
|
|
13
|
-
}
|
|
14
|
-
if (isMacro(a) && !isMacro(b)) {
|
|
15
|
-
return 1;
|
|
16
|
-
}
|
|
17
|
-
if (isMacro(b) && !isMacro(a)) {
|
|
18
|
-
return -1;
|
|
19
|
-
}
|
|
20
|
-
return a.content < b.content ? -1 : 1;
|
|
21
|
-
});
|
|
22
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
|
-
import { DropDownButton } from './dropdown-button';
|
|
5
|
-
export var BlockInsertMenuLegacy = function BlockInsertMenuLegacy(props) {
|
|
6
|
-
var items = props.items;
|
|
7
|
-
var dropdownItems = React.useMemo(function () {
|
|
8
|
-
return [{
|
|
9
|
-
items: items
|
|
10
|
-
}];
|
|
11
|
-
}, [items]);
|
|
12
|
-
return /*#__PURE__*/React.createElement(DropdownMenu, {
|
|
13
|
-
items: dropdownItems,
|
|
14
|
-
onItemActivated: props.onItemActivated,
|
|
15
|
-
onOpenChange: props.onOpenChange,
|
|
16
|
-
mountTo: props.popupsMountPoint,
|
|
17
|
-
boundariesElement: props.popupsBoundariesElement,
|
|
18
|
-
scrollableElement: props.popupsScrollableElement,
|
|
19
|
-
isOpen: props.open,
|
|
20
|
-
fitHeight: 188,
|
|
21
|
-
fitWidth: 175,
|
|
22
|
-
zIndex: akEditorMenuZIndex
|
|
23
|
-
}, /*#__PURE__*/React.createElement(DropDownButton, {
|
|
24
|
-
"aria-expanded": props.open,
|
|
25
|
-
"aria-haspopup": true,
|
|
26
|
-
handleRef: props.onRef,
|
|
27
|
-
selected: props.open,
|
|
28
|
-
disabled: props.disabled,
|
|
29
|
-
onClick: props.onClick,
|
|
30
|
-
onKeyDown: props.onKeyDown,
|
|
31
|
-
spacing: props.spacing,
|
|
32
|
-
label: props.label,
|
|
33
|
-
"aria-keyshortcuts": "/"
|
|
34
|
-
}));
|
|
35
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var endPositionNames = ['macro-browser', 'slash-onboarding'];
|
|
2
|
-
var isMacro = function isMacro(item) {
|
|
3
|
-
return typeof item.content === 'string' && item.content.includes('macro');
|
|
4
|
-
};
|
|
5
|
-
export var sortItems = function sortItems(items) {
|
|
6
|
-
return items.sort(function (a, b) {
|
|
7
|
-
if (endPositionNames.includes(a.value.name) && endPositionNames.includes(b.value.name)) {
|
|
8
|
-
return endPositionNames.indexOf(a.value.name) - endPositionNames.indexOf(b.value.name);
|
|
9
|
-
}
|
|
10
|
-
if (endPositionNames.includes(b.value.name)) {
|
|
11
|
-
return -1;
|
|
12
|
-
}
|
|
13
|
-
if (endPositionNames.includes(a.value.name)) {
|
|
14
|
-
return 1;
|
|
15
|
-
}
|
|
16
|
-
if (isMacro(a) && !isMacro(b)) {
|
|
17
|
-
return 1;
|
|
18
|
-
}
|
|
19
|
-
if (isMacro(b) && !isMacro(a)) {
|
|
20
|
-
return -1;
|
|
21
|
-
}
|
|
22
|
-
return a.content < b.content ? -1 : 1;
|
|
23
|
-
});
|
|
24
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
import type { BlockMenuItem } from './create-items';
|
|
4
|
-
export interface BlockInsertMenuLegacyProps {
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
spacing: 'none' | 'default';
|
|
7
|
-
label: string;
|
|
8
|
-
open: boolean;
|
|
9
|
-
items: BlockMenuItem[];
|
|
10
|
-
popupsMountPoint?: HTMLElement;
|
|
11
|
-
popupsBoundariesElement?: HTMLElement;
|
|
12
|
-
popupsScrollableElement?: HTMLElement;
|
|
13
|
-
onClick: React.MouseEventHandler;
|
|
14
|
-
onKeyDown?: React.KeyboardEventHandler;
|
|
15
|
-
onRef(el: HTMLElement): void;
|
|
16
|
-
onItemActivated(attrs: {
|
|
17
|
-
item: MenuItem;
|
|
18
|
-
}): void;
|
|
19
|
-
onOpenChange(attrs: any): void;
|
|
20
|
-
}
|
|
21
|
-
export declare const BlockInsertMenuLegacy: (props: BlockInsertMenuLegacyProps) => JSX.Element;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
3
|
-
import type { BlockMenuItem } from './create-items';
|
|
4
|
-
export interface BlockInsertMenuLegacyProps {
|
|
5
|
-
disabled: boolean;
|
|
6
|
-
spacing: 'none' | 'default';
|
|
7
|
-
label: string;
|
|
8
|
-
open: boolean;
|
|
9
|
-
items: BlockMenuItem[];
|
|
10
|
-
popupsMountPoint?: HTMLElement;
|
|
11
|
-
popupsBoundariesElement?: HTMLElement;
|
|
12
|
-
popupsScrollableElement?: HTMLElement;
|
|
13
|
-
onClick: React.MouseEventHandler;
|
|
14
|
-
onKeyDown?: React.KeyboardEventHandler;
|
|
15
|
-
onRef(el: HTMLElement): void;
|
|
16
|
-
onItemActivated(attrs: {
|
|
17
|
-
item: MenuItem;
|
|
18
|
-
}): void;
|
|
19
|
-
onOpenChange(attrs: any): void;
|
|
20
|
-
}
|
|
21
|
-
export declare const BlockInsertMenuLegacy: (props: BlockInsertMenuLegacyProps) => JSX.Element;
|