@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.
Files changed (53) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/plugin.js +0 -1
  3. package/dist/cjs/ui/ElementBrowser/InsertMenu.js +10 -9
  4. package/dist/cjs/ui/ElementRail/MainToolBarIcon.js +15 -3
  5. package/dist/cjs/ui/ElementRail/index.js +2 -1
  6. package/dist/cjs/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
  7. package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
  8. package/dist/cjs/ui/ToolbarInsertBlock/create-items.js +2 -4
  9. package/dist/cjs/ui/ToolbarInsertBlock/index.js +11 -11
  10. package/dist/cjs/ui/ToolbarInsertBlock/item.js +26 -6
  11. package/dist/es2019/plugin.js +0 -1
  12. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +10 -9
  13. package/dist/es2019/ui/ElementRail/MainToolBarIcon.js +15 -3
  14. package/dist/es2019/ui/ElementRail/index.js +2 -1
  15. package/dist/es2019/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
  16. package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
  17. package/dist/es2019/ui/ToolbarInsertBlock/create-items.js +2 -4
  18. package/dist/es2019/ui/ToolbarInsertBlock/index.js +11 -11
  19. package/dist/es2019/ui/ToolbarInsertBlock/item.js +22 -6
  20. package/dist/esm/plugin.js +0 -1
  21. package/dist/esm/ui/ElementBrowser/InsertMenu.js +10 -9
  22. package/dist/esm/ui/ElementRail/MainToolBarIcon.js +15 -3
  23. package/dist/esm/ui/ElementRail/index.js +2 -1
  24. package/dist/esm/ui/ToolbarInsertBlock/block-insert-element-browser.js +2 -1
  25. package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu.js +10 -27
  26. package/dist/esm/ui/ToolbarInsertBlock/create-items.js +2 -4
  27. package/dist/esm/ui/ToolbarInsertBlock/index.js +11 -11
  28. package/dist/esm/ui/ToolbarInsertBlock/item.js +26 -6
  29. package/dist/types/plugin.d.ts +0 -1
  30. package/dist/types/ui/ElementBrowser/InsertMenu.d.ts +1 -1
  31. package/dist/types/ui/ElementBrowser/types.d.ts +1 -0
  32. package/dist/types/ui/ElementRail/MainToolBarIcon.d.ts +2 -1
  33. package/dist/types/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
  34. package/dist/types/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -1
  35. package/dist/types/ui/ToolbarInsertBlock/types.d.ts +1 -2
  36. package/dist/types-ts4.5/plugin.d.ts +0 -1
  37. package/dist/types-ts4.5/ui/ElementBrowser/InsertMenu.d.ts +1 -1
  38. package/dist/types-ts4.5/ui/ElementBrowser/types.d.ts +1 -0
  39. package/dist/types-ts4.5/ui/ElementRail/MainToolBarIcon.d.ts +2 -1
  40. package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-element-browser.d.ts +1 -0
  41. package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu.d.ts +1 -1
  42. package/dist/types-ts4.5/ui/ToolbarInsertBlock/types.d.ts +1 -2
  43. package/package.json +8 -7
  44. package/dist/cjs/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -42
  45. package/dist/cjs/ui/ToolbarInsertBlock/sort-items.js +0 -30
  46. package/dist/es2019/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
  47. package/dist/es2019/ui/ToolbarInsertBlock/sort-items.js +0 -22
  48. package/dist/esm/ui/ToolbarInsertBlock/block-insert-menu-legacy.js +0 -35
  49. package/dist/esm/ui/ToolbarInsertBlock/sort-items.js +0 -24
  50. package/dist/types/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -21
  51. package/dist/types/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
  52. package/dist/types-ts4.5/ui/ToolbarInsertBlock/block-insert-menu-legacy.d.ts +0 -21
  53. package/dist/types-ts4.5/ui/ToolbarInsertBlock/sort-items.d.ts +0 -2
@@ -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 = replacePlusMenuWithElementBrowser ? this.plusButtonRef : this.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$replacePl, _this$props$pluginInj7;
706
+ var _tableButton, _tableButton2, _tableButton3, _tableButton4, _tableButton5, _tableButton6, _tableButton7, _tableSelectorButton, _tableSelectorButton2, _tableSelectorButton3, _tableSelectorButton4, _tableSelectorButton5, _tableSelectorButton6, _this$props$isDisable, _this$props$isDisable2, _this$props$pluginInj7;
709
707
  const {
710
708
  buttons,
711
709
  dropdownItems,
@@ -740,6 +738,7 @@ export class ToolbarInsertBlock extends React.PureComponent {
740
738
  toolbarButtons.push(btn);
741
739
  }
742
740
  }
741
+ const isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
743
742
  return (
744
743
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
745
744
  jsx("span", {
@@ -803,13 +802,14 @@ export class ToolbarInsertBlock extends React.PureComponent {
803
802
  onKeyDown: this.handleTableSelectorOpenByKeyboard
804
803
  })), jsx("span", {
805
804
  css: wrapperStyle
806
- }, this.renderPopup(), this.renderTableSelectorPopup(), editorExperiment('insert-menu-in-right-rail', true) && ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '') ? jsx(RightRailIcon, {
807
- onClick: this.handleClick
805
+ }, this.renderPopup(), this.renderTableSelectorPopup(), isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true) ? jsx(RightRailIcon, {
806
+ onClick: this.handleClick,
807
+ isDisabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false
808
808
  }) : jsx(BlockInsertMenu, {
809
809
  popupsMountPoint: this.props.popupsMountPoint,
810
810
  popupsBoundariesElement: this.props.popupsBoundariesElement,
811
811
  popupsScrollableElement: this.props.popupsScrollableElement,
812
- disabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
812
+ disabled: (_this$props$isDisable2 = this.props.isDisabled) !== null && _this$props$isDisable2 !== void 0 ? _this$props$isDisable2 : false,
813
813
  editorView: this.props.editorView,
814
814
  spacing: this.props.isReducedSpacing ? 'none' : 'default',
815
815
  label: this.props.intl.formatMessage(messages.insertMenu),
@@ -824,9 +824,9 @@ export class ToolbarInsertBlock extends React.PureComponent {
824
824
  onInsert: this.insertInsertMenuItem,
825
825
  onOpenChange: this.onOpenChange,
826
826
  togglePlusMenuVisibility: this.togglePlusMenuVisibility,
827
- replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
828
827
  showElementBrowserLink: this.props.showElementBrowserLink || false,
829
- pluginInjectionApi: this.props.pluginInjectionApi
828
+ pluginInjectionApi: this.props.pluginInjectionApi,
829
+ isFullPageAppearance: isFullPageAppearance
830
830
  })), !((_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 */
831
831
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
832
832
  jsx("span", {
@@ -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,
@@ -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
@@ -28,7 +28,8 @@ var InsertMenu = function InsertMenu(_ref) {
28
28
  showElementBrowserLink = _ref.showElementBrowserLink,
29
29
  onInsert = _ref.onInsert,
30
30
  toggleVisiblity = _ref.toggleVisiblity,
31
- pluginInjectionApi = _ref.pluginInjectionApi;
31
+ pluginInjectionApi = _ref.pluginInjectionApi,
32
+ isFullPageAppearance = _ref.isFullPageAppearance;
32
33
  var _useState = useState(0),
33
34
  _useState2 = _slicedToArray(_useState, 2),
34
35
  itemCount = _useState2[0],
@@ -64,7 +65,7 @@ var InsertMenu = function InsertMenu(_ref) {
64
65
  if (!editorView.hasFocus()) {
65
66
  editorView.focus();
66
67
  }
67
- if (editorExperiment('insert-menu-in-right-rail', true)) {
68
+ if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
68
69
  var _pluginInjectionApi$q;
69
70
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q === void 0 || _pluginInjectionApi$q.actions.insertItem(item,
70
71
  // @ts-expect-error
@@ -73,7 +74,7 @@ var InsertMenu = function InsertMenu(_ref) {
73
74
  var _pluginInjectionApi$q2;
74
75
  pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q2 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q2 === void 0 || _pluginInjectionApi$q2.actions.insertItem(item, INPUT_METHOD.TOOLBAR)(editorView.state, editorView.dispatch);
75
76
  }
76
- }, [editorView, toggleVisiblity, pluginInjectionApi]);
77
+ }, [editorView, toggleVisiblity, pluginInjectionApi, isFullPageAppearance]);
77
78
  var getItems = useCallback(function (query, category) {
78
79
  var result;
79
80
  /**
@@ -94,9 +95,9 @@ var InsertMenu = function InsertMenu(_ref) {
94
95
  category: category,
95
96
  featuredItems: true,
96
97
  // @ts-ignore
97
- templateItems: editorExperiment('element-level-templates', true)
98
+ templateItems: isFullPageAppearance && editorExperiment('element-level-templates', true)
98
99
  })) !== null && _pluginInjectionApi$q5 !== void 0 ? _pluginInjectionApi$q5 : [];
99
- if (editorExperiment('element-level-templates', true)) {
100
+ if (isFullPageAppearance && editorExperiment('element-level-templates', true)) {
100
101
  // Make sure template options appear as top 5 items
101
102
  featuredQuickInsertSuggestions.sort(function (a, b) {
102
103
  var _b$priority, _a$priority;
@@ -110,12 +111,12 @@ var InsertMenu = function InsertMenu(_ref) {
110
111
  }
111
112
  setItemCount(result.length);
112
113
  return result;
113
- }, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.actions, quickInsertDropdownItems]);
114
+ }, [pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$q7 = pluginInjectionApi.quickInsert) === null || _pluginInjectionApi$q7 === void 0 ? void 0 : _pluginInjectionApi$q7.actions, quickInsertDropdownItems, isFullPageAppearance]);
114
115
  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;
115
116
  return (
116
117
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
117
118
  jsx("div", {
118
- css: insertMenuWrapper(itemCount)
119
+ css: insertMenuWrapper(itemCount, isFullPageAppearance)
119
120
  }, jsx(ElementBrowserWrapper, {
120
121
  handleClickOutside: toggleVisiblity,
121
122
  handleEscapeKeydown: toggleVisiblity,
@@ -159,8 +160,8 @@ var getInsertMenuHeight = function getInsertMenuHeight(_ref3) {
159
160
  }
160
161
  return 560; // For showing 6 Elements.
161
162
  };
162
- var insertMenuWrapper = function insertMenuWrapper(itemCount) {
163
- if (editorExperiment('insert-menu-in-right-rail', true)) {
163
+ var insertMenuWrapper = function insertMenuWrapper(itemCount, isFullPageAppearance) {
164
+ if (isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true)) {
164
165
  return css({
165
166
  display: 'flex',
166
167
  flexDirection: 'column',
@@ -37,8 +37,19 @@ var buttonStyles = xcss({
37
37
  outline: "2px solid ".concat("var(--ds-border-focused, #388BFF)")
38
38
  }
39
39
  });
40
+ var 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 var RightRailIcon = function RightRailIcon(_ref) {
41
- var onClick = _ref.onClick;
51
+ var onClick = _ref.onClick,
52
+ isDisabled = _ref.isDisabled;
42
53
  var _useIntl = useIntl(),
43
54
  formatMessage = _useIntl.formatMessage;
44
55
  return /*#__PURE__*/React.createElement(Box, {
@@ -53,8 +64,9 @@ export var RightRailIcon = function RightRailIcon(_ref) {
53
64
  }, /*#__PURE__*/React.createElement(Pressable, {
54
65
  type: "button",
55
66
  "aria-label": formatMessage(toolbarInsertBlockMessages.insertMenu),
56
- xcss: [buttonStyles],
57
- onClick: onClick
67
+ xcss: [buttonStyles, isDisabled ? disabledStyles : undefined],
68
+ onClick: onClick,
69
+ isDisabled: isDisabled
58
70
  }, /*#__PURE__*/React.createElement(EditorAddIcon, {
59
71
  label: formatMessage(toolbarInsertBlockMessages.insertMenu),
60
72
  size: "medium"
@@ -219,6 +219,7 @@ export var InsertMenuRail = function InsertMenuRail(_ref) {
219
219
  onInsert: onInsert,
220
220
  toggleVisiblity: function toggleVisiblity() {},
221
221
  showElementBrowserLink: true,
222
- pluginInjectionApi: api
222
+ pluginInjectionApi: api,
223
+ isFullPageAppearance: true
223
224
  }));
224
225
  };
@@ -19,7 +19,8 @@ export var BlockInsertElementBrowser = function 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 var BlockInsertMenu = function BlockInsertMenu(props) {
6
5
  if (props.items.length === 0) {
@@ -20,40 +19,24 @@ export var BlockInsertMenu = function 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,
40
+ isFullPageAppearance: props.isFullPageAppearance
58
41
  });
59
42
  };
@@ -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 = (!isNewMenuEnabled ? sortItems(remainingItems) : remainingItems).map(buttonToDropdownItem(formatMessage(messages.insertMenu)));
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 = replacePlusMenuWithElementBrowser ? this.plusButtonRef : this.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,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
651
650
  _tableSelectorButton5,
652
651
  _tableSelectorButton6,
653
652
  _this$props$isDisable,
654
- _this$props$replacePl,
653
+ _this$props$isDisable2,
655
654
  _this$props$pluginInj3;
656
655
  var _this$state2 = this.state,
657
656
  buttons = _this$state2.buttons,
@@ -696,6 +695,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
696
695
  } finally {
697
696
  _iterator.f();
698
697
  }
698
+ var isFullPageAppearance = ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '');
699
699
  return (
700
700
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
701
701
  jsx("span", {
@@ -759,13 +759,14 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
759
759
  onKeyDown: this.handleTableSelectorOpenByKeyboard
760
760
  })), jsx("span", {
761
761
  css: wrapperStyle
762
- }, this.renderPopup(), this.renderTableSelectorPopup(), editorExperiment('insert-menu-in-right-rail', true) && ['full-page', 'full-width'].includes(editorAppearance !== null && editorAppearance !== void 0 ? editorAppearance : '') ? jsx(RightRailIcon, {
763
- onClick: this.handleClick
762
+ }, this.renderPopup(), this.renderTableSelectorPopup(), isFullPageAppearance && editorExperiment('insert-menu-in-right-rail', true) ? jsx(RightRailIcon, {
763
+ onClick: this.handleClick,
764
+ isDisabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false
764
765
  }) : jsx(BlockInsertMenu, {
765
766
  popupsMountPoint: this.props.popupsMountPoint,
766
767
  popupsBoundariesElement: this.props.popupsBoundariesElement,
767
768
  popupsScrollableElement: this.props.popupsScrollableElement,
768
- disabled: (_this$props$isDisable = this.props.isDisabled) !== null && _this$props$isDisable !== void 0 ? _this$props$isDisable : false,
769
+ disabled: (_this$props$isDisable2 = this.props.isDisabled) !== null && _this$props$isDisable2 !== void 0 ? _this$props$isDisable2 : false,
769
770
  editorView: this.props.editorView,
770
771
  spacing: this.props.isReducedSpacing ? 'none' : 'default',
771
772
  label: this.props.intl.formatMessage(messages.insertMenu),
@@ -780,9 +781,9 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
780
781
  onInsert: this.insertInsertMenuItem,
781
782
  onOpenChange: this.onOpenChange,
782
783
  togglePlusMenuVisibility: this.togglePlusMenuVisibility,
783
- replacePlusMenuWithElementBrowser: (_this$props$replacePl = this.props.replacePlusMenuWithElementBrowser) !== null && _this$props$replacePl !== void 0 ? _this$props$replacePl : false,
784
784
  showElementBrowserLink: this.props.showElementBrowserLink || false,
785
- pluginInjectionApi: this.props.pluginInjectionApi
785
+ pluginInjectionApi: this.props.pluginInjectionApi,
786
+ isFullPageAppearance: isFullPageAppearance
786
787
  })), !((_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 */
787
788
  // eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values, @atlaskit/design-system/consistent-css-prop-usage -- Ignored via go/DSP-18766
788
789
  jsx("span", {
@@ -820,8 +821,7 @@ export var ToolbarInsertBlock = /*#__PURE__*/function (_React$PureComponent) {
820
821
  insertMenuItems: props.insertMenuItems,
821
822
  schema: props.editorView.state.schema,
822
823
  numberOfButtons: props.buttons,
823
- formatMessage: props.intl.formatMessage,
824
- isNewMenuEnabled: props.replacePlusMenuWithElementBrowser
824
+ formatMessage: props.intl.formatMessage
825
825
  }),
826
826
  _createItems2 = _slicedToArray(_createItems, 2),
827
827
  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 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';
@@ -62,7 +65,14 @@ export var action = mem(function (init) {
62
65
  disabled: init.disabled,
63
66
  name: 'action',
64
67
  shortcut: '[]',
65
- Icon: CheckboxCheckedIcon,
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(PlaceholderTextIcon, {
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: StatusIcon
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) {
@@ -6,7 +6,6 @@ export interface InsertBlockOptions {
6
6
  insertMenuItems?: any;
7
7
  horizontalRuleEnabled?: boolean;
8
8
  nativeStatusSupported?: boolean;
9
- replacePlusMenuWithElementBrowser?: boolean;
10
9
  showElementBrowserLink?: boolean;
11
10
  tableSelectorSupported?: boolean;
12
11
  }
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { InsertMenuProps } from './types';
3
- declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, }: InsertMenuProps) => jsx.JSX.Element;
3
+ declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, isFullPageAppearance, }: InsertMenuProps) => jsx.JSX.Element;
4
4
  export default InsertMenu;
@@ -12,6 +12,7 @@ export interface InsertMenuProps {
12
12
  toggleVisiblity: SimpleEventHandler<MouseEvent | KeyboardEvent>;
13
13
  onInsert: OnInsert;
14
14
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
15
+ isFullPageAppearance?: boolean;
15
16
  }
16
17
  export type SvgGetterParams = {
17
18
  name: string;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  type Props = {
3
3
  onClick: () => void;
4
+ isDisabled: boolean;
4
5
  };
5
- export declare const RightRailIcon: ({ onClick }: Props) => JSX.Element;
6
+ export declare const RightRailIcon: ({ onClick, isDisabled }: Props) => JSX.Element;
6
7
  export {};
@@ -23,6 +23,7 @@ export interface BlockInsertElementBrowserProps {
23
23
  onInsert: OnInsert;
24
24
  togglePlusMenuVisibility: SimpleEventHandler<MouseEvent | KeyboardEvent>;
25
25
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
26
+ isFullPageAppearance?: boolean;
26
27
  }
27
28
  export declare const BlockInsertElementBrowser: (props: BlockInsertElementBrowserProps) => JSX.Element;
28
29
  export {};
@@ -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;
@@ -29,5 +28,6 @@ export interface BlockInsertMenuProps {
29
28
  togglePlusMenuVisibility(): void;
30
29
  onKeyDown?: React.KeyboardEventHandler;
31
30
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
31
+ isFullPageAppearance?: boolean;
32
32
  }
33
33
  export declare const BlockInsertMenu: (props: BlockInsertMenuProps) => JSX.Element | null;
@@ -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?: ExtractInjectionAPI<InsertBlockPlugin>;
49
+ pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
51
50
  mentionsDisabled?: boolean;
52
51
  editorAppearance?: EditorAppearance;
53
52
  }
@@ -6,7 +6,6 @@ export interface InsertBlockOptions {
6
6
  insertMenuItems?: any;
7
7
  horizontalRuleEnabled?: boolean;
8
8
  nativeStatusSupported?: boolean;
9
- replacePlusMenuWithElementBrowser?: boolean;
10
9
  showElementBrowserLink?: boolean;
11
10
  tableSelectorSupported?: boolean;
12
11
  }
@@ -1,4 +1,4 @@
1
1
  import { jsx } from '@emotion/react';
2
2
  import type { InsertMenuProps } from './types';
3
- declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, }: InsertMenuProps) => jsx.JSX.Element;
3
+ declare const InsertMenu: ({ editorView, dropdownItems, showElementBrowserLink, onInsert, toggleVisiblity, pluginInjectionApi, isFullPageAppearance, }: InsertMenuProps) => jsx.JSX.Element;
4
4
  export default InsertMenu;
@@ -12,6 +12,7 @@ export interface InsertMenuProps {
12
12
  toggleVisiblity: SimpleEventHandler<MouseEvent | KeyboardEvent>;
13
13
  onInsert: OnInsert;
14
14
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
15
+ isFullPageAppearance?: boolean;
15
16
  }
16
17
  export type SvgGetterParams = {
17
18
  name: string;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  type Props = {
3
3
  onClick: () => void;
4
+ isDisabled: boolean;
4
5
  };
5
- export declare const RightRailIcon: ({ onClick }: Props) => JSX.Element;
6
+ export declare const RightRailIcon: ({ onClick, isDisabled }: Props) => JSX.Element;
6
7
  export {};
@@ -23,6 +23,7 @@ export interface BlockInsertElementBrowserProps {
23
23
  onInsert: OnInsert;
24
24
  togglePlusMenuVisibility: SimpleEventHandler<MouseEvent | KeyboardEvent>;
25
25
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
26
+ isFullPageAppearance?: boolean;
26
27
  }
27
28
  export declare const BlockInsertElementBrowser: (props: BlockInsertElementBrowserProps) => JSX.Element;
28
29
  export {};
@@ -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;
@@ -29,5 +28,6 @@ export interface BlockInsertMenuProps {
29
28
  togglePlusMenuVisibility(): void;
30
29
  onKeyDown?: React.KeyboardEventHandler;
31
30
  pluginInjectionApi: ExtractInjectionAPI<InsertBlockPlugin> | undefined;
31
+ isFullPageAppearance?: boolean;
32
32
  }
33
33
  export declare const BlockInsertMenu: (props: BlockInsertMenuProps) => JSX.Element | null;