@atlaskit/editor-plugin-insert-block 1.14.5 → 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.
Files changed (36) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/plugin.js +10 -6
  3. package/dist/cjs/ui/ElementRail/index.js +3 -3
  4. package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +9 -27
  5. package/dist/cjs/ui/ToolbarInsertBlock/create-items.js +2 -4
  6. package/dist/cjs/ui/ToolbarInsertBlock/index.js +7 -9
  7. package/dist/cjs/ui/ToolbarInsertBlock/item.js +26 -6
  8. package/dist/es2019/plugin.js +10 -6
  9. package/dist/es2019/ui/ElementRail/index.js +3 -3
  10. package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +9 -27
  11. package/dist/es2019/ui/ToolbarInsertBlock/create-items.js +2 -4
  12. package/dist/es2019/ui/ToolbarInsertBlock/index.js +8 -9
  13. package/dist/es2019/ui/ToolbarInsertBlock/item.js +22 -6
  14. package/dist/esm/plugin.js +10 -6
  15. package/dist/esm/ui/ElementRail/index.js +3 -3
  16. package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +9 -27
  17. package/dist/esm/ui/ToolbarInsertBlock/create-items.js +2 -4
  18. package/dist/esm/ui/ToolbarInsertBlock/index.js +7 -9
  19. package/dist/esm/ui/ToolbarInsertBlock/item.js +26 -6
  20. package/dist/types/plugin.d.ts +0 -1
  21. package/dist/types/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -1
  22. package/dist/types/ui/ToolbarInsertBlock/types.d.ts +1 -2
  23. package/dist/types-ts4.5/plugin.d.ts +0 -1
  24. package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu.d.ts +0 -1
  25. package/dist/types-ts4.5/ui/ToolbarInsertBlock/types.d.ts +1 -2
  26. package/package.json +5 -4
  27. package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -42
  28. package/dist/cjs/ui/ToolbarInsertBlock/sort-items.js +0 -30
  29. package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
  30. package/dist/es2019/ui/ToolbarInsertBlock/sort-items.js +0 -22
  31. package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
  32. package/dist/esm/ui/ToolbarInsertBlock/sort-items.js +0 -24
  33. package/dist/types/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -21
  34. package/dist/types/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
  35. package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -21
  36. 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.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
+
19
+ ## 1.14.6
20
+
21
+ ### Patch Changes
22
+
23
+ - [#141109](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/141109)
24
+ [`466f39066bd56`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/466f39066bd56) -
25
+ Enforce appearance check for all experiment code
26
+
3
27
  ## 1.14.5
4
28
 
5
29
  ### Patch Changes
@@ -60,7 +60,7 @@ function handleInsertBlockType(insertCodeBlock, insertPanel, insertBlockQuote) {
60
60
  };
61
61
  }
62
62
  var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_ref) {
63
- var _api$primaryToolbar;
63
+ var _api$primaryToolbar, _options$UNSAFE_edito3;
64
64
  var _ref$config = _ref.config,
65
65
  options = _ref$config === void 0 ? {} : _ref$config,
66
66
  api = _ref.api;
@@ -129,7 +129,10 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
129
129
  }
130
130
  },
131
131
  pmPlugins: function pmPlugins() {
132
- if (!(0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
132
+ var _options$UNSAFE_edito;
133
+ if (
134
+ // @ts-ignore
135
+ !['full-page', 'full-width'].includes((_options$UNSAFE_edito = options.UNSAFE_editorAppearance) !== null && _options$UNSAFE_edito !== void 0 ? _options$UNSAFE_edito : '') || !(0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
133
136
  [];
134
137
  }
135
138
  return [{
@@ -213,11 +216,11 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
213
216
  // If we decide to ship the feature, we will consider a separate plugin if needed.
214
217
  // Experiment one-pager: https://hello.atlassian.net/wiki/spaces/ETM/pages/3983684902/Experiment+Drive+element+usage+via+element+templates
215
218
  quickInsert: function quickInsert(intl) {
216
- var _options$UNSAFE_edito;
219
+ var _options$UNSAFE_edito2;
217
220
  var locale = intl.locale;
218
221
  var isEligible = locale.startsWith('en') &&
219
222
  // @ts-ignore
220
- ['full-page', 'full-width'].includes((_options$UNSAFE_edito = options.UNSAFE_editorAppearance) !== null && _options$UNSAFE_edito !== void 0 ? _options$UNSAFE_edito : '');
223
+ ['full-page', 'full-width'].includes((_options$UNSAFE_edito2 = options.UNSAFE_editorAppearance) !== null && _options$UNSAFE_edito2 !== void 0 ? _options$UNSAFE_edito2 : '');
221
224
  if (isEligible && (0, _experiments.editorExperiment)('element-level-templates', true, {
222
225
  exposure: true
223
226
  })) {
@@ -235,7 +238,9 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
235
238
  },
236
239
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
237
240
  };
238
- if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
241
+ if (
242
+ // @ts-ignore
243
+ ['full-page', 'full-width'].includes((_options$UNSAFE_edito3 = options.UNSAFE_editorAppearance) !== null && _options$UNSAFE_edito3 !== void 0 ? _options$UNSAFE_edito3 : '') && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true)) {
239
244
  plugin.pluginsOptions.contextPanel = function (state) {
240
245
  // api.getSharedState() will have an outdated reference to editorState on first mount of this component
241
246
  // so instead just rely on plugin key as we don't need to be reactive to changes here
@@ -327,7 +332,6 @@ function ToolbarInsertBlockWithInjectionApi(_ref3) {
327
332
  insertMenuItems: options.insertMenuItems,
328
333
  editorActions: editorActions,
329
334
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
330
- replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
331
335
  showElementBrowserLink: options.showElementBrowserLink,
332
336
  showSeparator: !isLastItem && toolbarSize <= _types.ToolbarSize.S,
333
337
  registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
@@ -112,14 +112,14 @@ var InsertMenuRail = exports.InsertMenuRail = function InsertMenuRail(_ref) {
112
112
  (_api$emoji = api.emoji) === null || _api$emoji === void 0 || _api$emoji.actions.openTypeAhead(inputMethod);
113
113
  break;
114
114
  case 'codeblock':
115
- (_api$codeBlock = api.codeBlock) === null || _api$codeBlock === void 0 || _api$codeBlock.actions.insertCodeBlock(inputMethod);
115
+ (_api$codeBlock = api.codeBlock) === null || _api$codeBlock === void 0 || _api$codeBlock.actions.insertCodeBlock(inputMethod)(state, dispatch);
116
116
  break;
117
117
  case 'blockquote':
118
118
  // @ts-expect-error
119
- (_api$blockType = api.blockType) === null || _api$blockType === void 0 || _api$blockType.actions.insertBlockQuote(inputMethod);
119
+ (_api$blockType = api.blockType) === null || _api$blockType === void 0 || _api$blockType.actions.insertBlockQuote(inputMethod)(state, dispatch);
120
120
  break;
121
121
  case 'panel':
122
- (_api$panel = api.panel) === null || _api$panel === void 0 || _api$panel.actions.insertPanel(inputMethod);
122
+ (_api$panel = api.panel) === null || _api$panel === void 0 || _api$panel.actions.insertPanel(inputMethod)(state, dispatch);
123
123
  break;
124
124
  case 'action':
125
125
  // @ts-expect-error
@@ -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
- if (props.replacePlusMenuWithElementBrowser) {
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
- onItemActivated: props.onItemActivated,
58
- onOpenChange: props.onOpenChange,
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 = (!isNewMenuEnabled ? (0, _sortItems.sortItems)(remainingItems) : remainingItems).map(buttonToDropdownItem(formatMessage(_messages2.messages.insertMenu)));
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);
@@ -213,11 +213,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
213
213
  (_this$unregisterToggl = (_this2 = _this).unregisterToggleDropdownMenuOptions) === null || _this$unregisterToggl === void 0 || _this$unregisterToggl.call(_this2);
214
214
  });
215
215
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
216
+ var _this$props$editorApp;
216
217
  /**
217
218
  * For insert menu in right rail experiment
218
219
  * - Clean up ticket ED-24801
219
220
  */
220
- if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true, {
221
+ if (['full-page', 'full-width'].includes((_this$props$editorApp = _this.props.editorAppearance) !== null && _this$props$editorApp !== void 0 ? _this$props$editorApp : '') && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true, {
221
222
  exposure: true
222
223
  })) {
223
224
  var pluginInjectionApi = _this.props.pluginInjectionApi;
@@ -245,11 +246,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
245
246
  });
246
247
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleOpenByKeyboard", function (event) {
247
248
  if (event.key === 'Enter' || event.key === ' ') {
249
+ var _this$props$editorApp2;
248
250
  /**
249
251
  * For insert menu in right rail experiment
250
252
  * - Clean up ticket ED-24801
251
253
  */
252
- if ((0, _experiments.editorExperiment)('insert-menu-in-right-rail', true, {
254
+ if (['full-page', 'full-width'].includes((_this$props$editorApp2 = _this.props.editorAppearance) !== null && _this$props$editorApp2 !== void 0 ? _this$props$editorApp2 : '') && (0, _experiments.editorExperiment)('insert-menu-in-right-rail', true, {
253
255
  exposure: true
254
256
  })) {
255
257
  var _this$props$pluginInj;
@@ -567,13 +569,12 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
567
569
  popupsMountPoint = _this$props11.popupsMountPoint,
568
570
  popupsBoundariesElement = _this$props11.popupsBoundariesElement,
569
571
  popupsScrollableElement = _this$props11.popupsScrollableElement,
570
- emojiProvider = _this$props11.emojiProvider,
571
- replacePlusMenuWithElementBrowser = _this$props11.replacePlusMenuWithElementBrowser;
572
+ emojiProvider = _this$props11.emojiProvider;
572
573
  var dropdownEmoji = this.state.dropdownItems.some(function (_ref7) {
573
574
  var name = _ref7.value.name;
574
575
  return name === 'emoji';
575
576
  });
576
- var dropDownButtonRef = replacePlusMenuWithElementBrowser ? this.plusButtonRef : this.dropdownButtonRef;
577
+ var dropDownButtonRef = this.plusButtonRef;
577
578
  var ref = dropdownEmoji ? dropDownButtonRef : this.emojiButtonRef;
578
579
  if (!emojiPickerOpen || !ref || !emojiProvider) {
579
580
  return null;
@@ -658,7 +659,6 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
658
659
  _tableSelectorButton5,
659
660
  _tableSelectorButton6,
660
661
  _this$props$isDisable,
661
- _this$props$replacePl,
662
662
  _this$props$pluginInj3;
663
663
  var _this$state2 = this.state,
664
664
  buttons = _this$state2.buttons,
@@ -787,7 +787,6 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
787
787
  onInsert: this.insertInsertMenuItem,
788
788
  onOpenChange: this.onOpenChange,
789
789
  togglePlusMenuVisibility: this.togglePlusMenuVisibility,
790
- replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
791
790
  showElementBrowserLink: this.props.showElementBrowserLink || false,
792
791
  pluginInjectionApi: this.props.pluginInjectionApi
793
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 */
@@ -827,8 +826,7 @@ var ToolbarInsertBlock = exports.ToolbarInsertBlock = /*#__PURE__*/function (_Re
827
826
  insertMenuItems: props.insertMenuItems,
828
827
  schema: props.editorView.state.schema,
829
828
  numberOfButtons: props.buttons,
830
- formatMessage: props.intl.formatMessage,
831
- isNewMenuEnabled: props.replacePlusMenuWithElementBrowser
829
+ formatMessage: props.intl.formatMessage
832
830
  }),
833
831
  _createItems2 = (0, _slicedToArray2.default)(_createItems, 2),
834
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 _status = _interopRequireDefault(require("@atlaskit/icon/glyph/status"));
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: _checkboxCheckedEditorTask.default,
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)(_text.default, {
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: _status.default
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) {
@@ -51,7 +51,7 @@ export const insertBlockPlugin = ({
51
51
  config: options = {},
52
52
  api
53
53
  }) => {
54
- var _api$primaryToolbar;
54
+ var _api$primaryToolbar, _options$UNSAFE_edito3;
55
55
  const toggleDropdownMenuOptionsRef = {
56
56
  current: null
57
57
  };
@@ -118,7 +118,10 @@ export const insertBlockPlugin = ({
118
118
  }
119
119
  },
120
120
  pmPlugins: () => {
121
- if (!editorExperiment('insert-menu-in-right-rail', true)) {
121
+ var _options$UNSAFE_edito;
122
+ if (
123
+ // @ts-ignore
124
+ !['full-page', 'full-width'].includes((_options$UNSAFE_edito = options.UNSAFE_editorAppearance) !== null && _options$UNSAFE_edito !== void 0 ? _options$UNSAFE_edito : '') || !editorExperiment('insert-menu-in-right-rail', true)) {
122
125
  [];
123
126
  }
124
127
  return [{
@@ -204,13 +207,13 @@ export const insertBlockPlugin = ({
204
207
  // If we decide to ship the feature, we will consider a separate plugin if needed.
205
208
  // Experiment one-pager: https://hello.atlassian.net/wiki/spaces/ETM/pages/3983684902/Experiment+Drive+element+usage+via+element+templates
206
209
  quickInsert: intl => {
207
- var _options$UNSAFE_edito;
210
+ var _options$UNSAFE_edito2;
208
211
  const {
209
212
  locale
210
213
  } = intl;
211
214
  const isEligible = locale.startsWith('en') &&
212
215
  // @ts-ignore
213
- ['full-page', 'full-width'].includes((_options$UNSAFE_edito = options.UNSAFE_editorAppearance) !== null && _options$UNSAFE_edito !== void 0 ? _options$UNSAFE_edito : '');
216
+ ['full-page', 'full-width'].includes((_options$UNSAFE_edito2 = options.UNSAFE_editorAppearance) !== null && _options$UNSAFE_edito2 !== void 0 ? _options$UNSAFE_edito2 : '');
214
217
  if (isEligible && editorExperiment('element-level-templates', true, {
215
218
  exposure: true
216
219
  })) {
@@ -228,7 +231,9 @@ export const insertBlockPlugin = ({
228
231
  },
229
232
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
230
233
  };
231
- if (editorExperiment('insert-menu-in-right-rail', true)) {
234
+ if (
235
+ // @ts-ignore
236
+ ['full-page', 'full-width'].includes((_options$UNSAFE_edito3 = options.UNSAFE_editorAppearance) !== null && _options$UNSAFE_edito3 !== void 0 ? _options$UNSAFE_edito3 : '') && editorExperiment('insert-menu-in-right-rail', true)) {
232
237
  plugin.pluginsOptions.contextPanel = state => {
233
238
  // api.getSharedState() will have an outdated reference to editorState on first mount of this component
234
239
  // so instead just rely on plugin key as we don't need to be reactive to changes here
@@ -322,7 +327,6 @@ function ToolbarInsertBlockWithInjectionApi({
322
327
  insertMenuItems: options.insertMenuItems,
323
328
  editorActions: editorActions,
324
329
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
325
- replacePlusMenuWithElementBrowser: options.replacePlusMenuWithElementBrowser,
326
330
  showElementBrowserLink: options.showElementBrowserLink,
327
331
  showSeparator: !isLastItem && toolbarSize <= ToolbarSize.S,
328
332
  registerToggleDropdownMenuOptions: registerToggleDropdownMenuOptions
@@ -106,14 +106,14 @@ export const InsertMenuRail = ({
106
106
  (_api$emoji = api.emoji) === null || _api$emoji === void 0 ? void 0 : _api$emoji.actions.openTypeAhead(inputMethod);
107
107
  break;
108
108
  case 'codeblock':
109
- (_api$codeBlock = api.codeBlock) === null || _api$codeBlock === void 0 ? void 0 : _api$codeBlock.actions.insertCodeBlock(inputMethod);
109
+ (_api$codeBlock = api.codeBlock) === null || _api$codeBlock === void 0 ? void 0 : _api$codeBlock.actions.insertCodeBlock(inputMethod)(state, dispatch);
110
110
  break;
111
111
  case 'blockquote':
112
112
  // @ts-expect-error
113
- (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : _api$blockType.actions.insertBlockQuote(inputMethod);
113
+ (_api$blockType = api.blockType) === null || _api$blockType === void 0 ? void 0 : _api$blockType.actions.insertBlockQuote(inputMethod)(state, dispatch);
114
114
  break;
115
115
  case 'panel':
116
- (_api$panel = api.panel) === null || _api$panel === void 0 ? void 0 : _api$panel.actions.insertPanel(inputMethod);
116
+ (_api$panel = api.panel) === null || _api$panel === void 0 ? void 0 : _api$panel.actions.insertPanel(inputMethod)(state, dispatch);
117
117
  break;
118
118
  case 'action':
119
119
  // @ts-expect-error
@@ -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
- if (props.replacePlusMenuWithElementBrowser) {
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
- onItemActivated: props.onItemActivated,
51
- onOpenChange: props.onOpenChange,
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 = (!isNewMenuEnabled ? sortItems(remainingItems) : remainingItems).map(buttonToDropdownItem(formatMessage(messages.insertMenu)));
206
+ const dropdownItems = remainingItems.map(buttonToDropdownItem(formatMessage(messages.insertMenu)));
209
207
  return [buttonItems, dropdownItems];
210
208
  };
211
209
  export const createItems = memoizeOne(createInsertBlockItems, shallowEquals);
@@ -211,11 +211,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
211
211
  (_this$unregisterToggl = this.unregisterToggleDropdownMenuOptions) === null || _this$unregisterToggl === void 0 ? void 0 : _this$unregisterToggl.call(this);
212
212
  });
213
213
  _defineProperty(this, "handleClick", () => {
214
+ var _this$props$editorApp;
214
215
  /**
215
216
  * For insert menu in right rail experiment
216
217
  * - Clean up ticket ED-24801
217
218
  */
218
- if (editorExperiment('insert-menu-in-right-rail', true, {
219
+ if (['full-page', 'full-width'].includes((_this$props$editorApp = this.props.editorAppearance) !== null && _this$props$editorApp !== void 0 ? _this$props$editorApp : '') && editorExperiment('insert-menu-in-right-rail', true, {
219
220
  exposure: true
220
221
  })) {
221
222
  const {
@@ -246,11 +247,12 @@ export class ToolbarInsertBlock extends React.PureComponent {
246
247
  });
247
248
  _defineProperty(this, "handleOpenByKeyboard", event => {
248
249
  if (event.key === 'Enter' || event.key === ' ') {
250
+ var _this$props$editorApp2;
249
251
  /**
250
252
  * For insert menu in right rail experiment
251
253
  * - Clean up ticket ED-24801
252
254
  */
253
- if (editorExperiment('insert-menu-in-right-rail', true, {
255
+ if (['full-page', 'full-width'].includes((_this$props$editorApp2 = this.props.editorAppearance) !== null && _this$props$editorApp2 !== void 0 ? _this$props$editorApp2 : '') && editorExperiment('insert-menu-in-right-rail', true, {
254
256
  exposure: true
255
257
  })) {
256
258
  var _this$props$pluginInj;
@@ -584,8 +586,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
584
586
  insertMenuItems: props.insertMenuItems,
585
587
  schema: props.editorView.state.schema,
586
588
  numberOfButtons: props.buttons,
587
- formatMessage: props.intl.formatMessage,
588
- isNewMenuEnabled: props.replacePlusMenuWithElementBrowser
589
+ formatMessage: props.intl.formatMessage
589
590
  });
590
591
  return {
591
592
  ...state,
@@ -627,15 +628,14 @@ export class ToolbarInsertBlock extends React.PureComponent {
627
628
  popupsMountPoint,
628
629
  popupsBoundariesElement,
629
630
  popupsScrollableElement,
630
- emojiProvider,
631
- replacePlusMenuWithElementBrowser
631
+ emojiProvider
632
632
  } = this.props;
633
633
  const dropdownEmoji = this.state.dropdownItems.some(({
634
634
  value: {
635
635
  name
636
636
  }
637
637
  }) => name === 'emoji');
638
- const dropDownButtonRef = replacePlusMenuWithElementBrowser ? this.plusButtonRef : this.dropdownButtonRef;
638
+ const dropDownButtonRef = this.plusButtonRef;
639
639
  const ref = dropdownEmoji ? dropDownButtonRef : this.emojiButtonRef;
640
640
  if (!emojiPickerOpen || !ref || !emojiProvider) {
641
641
  return null;
@@ -703,7 +703,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
703
703
  });
704
704
  }
705
705
  render() {
706
- var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$replacePl, _this$props$pluginInj7;
706
+ var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$pluginInj7;
707
707
  const {
708
708
  buttons,
709
709
  dropdownItems,
@@ -822,7 +822,6 @@ export class ToolbarInsertBlock extends React.PureComponent {
822
822
  onInsert: this.insertInsertMenuItem,
823
823
  onOpenChange: this.onOpenChange,
824
824
  togglePlusMenuVisibility: this.togglePlusMenuVisibility,
825
- replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
826
825
  showElementBrowserLink: this.props.showElementBrowserLink || false,
827
826
  pluginInjectionApi: this.props.pluginInjectionApi
828
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 StatusIcon from '@atlaskit/icon/glyph/status';
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: CheckboxCheckedIcon,
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(PlaceholderTextIcon, {
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,