@atlaskit/editor-plugin-insert-block 4.2.2 → 4.3.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 (36) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/insertBlockPlugin.js +2 -1
  3. package/dist/cjs/ui/toolbar-components/EmojiButton.js +2 -1
  4. package/dist/cjs/ui/toolbar-components/ImageButton.js +2 -1
  5. package/dist/cjs/ui/toolbar-components/LayoutButton.js +2 -1
  6. package/dist/cjs/ui/toolbar-components/MediaButton.js +2 -1
  7. package/dist/cjs/ui/toolbar-components/MentionButton.js +2 -1
  8. package/dist/cjs/ui/toolbar-components/TableButton.js +2 -1
  9. package/dist/cjs/ui/toolbar-components/TableSizePicker.js +3 -1
  10. package/dist/cjs/ui/toolbar-components/TaskListButton.js +2 -1
  11. package/dist/cjs/ui/toolbar-components.js +5 -11
  12. package/dist/es2019/insertBlockPlugin.js +2 -1
  13. package/dist/es2019/ui/toolbar-components/EmojiButton.js +2 -1
  14. package/dist/es2019/ui/toolbar-components/ImageButton.js +2 -1
  15. package/dist/es2019/ui/toolbar-components/LayoutButton.js +2 -1
  16. package/dist/es2019/ui/toolbar-components/MediaButton.js +2 -1
  17. package/dist/es2019/ui/toolbar-components/MentionButton.js +2 -1
  18. package/dist/es2019/ui/toolbar-components/TableButton.js +2 -1
  19. package/dist/es2019/ui/toolbar-components/TableSizePicker.js +5 -2
  20. package/dist/es2019/ui/toolbar-components/TaskListButton.js +2 -1
  21. package/dist/es2019/ui/toolbar-components.js +5 -12
  22. package/dist/esm/insertBlockPlugin.js +2 -1
  23. package/dist/esm/ui/toolbar-components/EmojiButton.js +2 -1
  24. package/dist/esm/ui/toolbar-components/ImageButton.js +2 -1
  25. package/dist/esm/ui/toolbar-components/LayoutButton.js +2 -1
  26. package/dist/esm/ui/toolbar-components/MediaButton.js +2 -1
  27. package/dist/esm/ui/toolbar-components/MentionButton.js +2 -1
  28. package/dist/esm/ui/toolbar-components/TableButton.js +2 -1
  29. package/dist/esm/ui/toolbar-components/TableSizePicker.js +4 -2
  30. package/dist/esm/ui/toolbar-components/TaskListButton.js +2 -1
  31. package/dist/esm/ui/toolbar-components.js +6 -12
  32. package/dist/types/types/index.d.ts +8 -0
  33. package/dist/types/ui/toolbar-components.d.ts +2 -1
  34. package/dist/types-ts4.5/types/index.d.ts +8 -0
  35. package/dist/types-ts4.5/ui/toolbar-components.d.ts +2 -1
  36. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 4.3.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`286abb4d35eba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/286abb4d35eba) -
8
+ [ux] [ED-28960] Finish full page primary toolbar migration
9
+
10
+ - Align with design update (separator, gap, height, icon size)
11
+ - Add keyboard shortcut to focus toolbar and arrow key navigation
12
+ - Address accessibility
13
+
14
+ - Updated dependencies
15
+
16
+ ## 4.3.0
17
+
18
+ ### Minor Changes
19
+
20
+ - [`d4b3d46926b3b`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d4b3d46926b3b) -
21
+ [ux] ED-29014 add new option to insert block plugin to only show the plus button in the toolbar.
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies
26
+
3
27
  ## 4.2.2
4
28
 
5
29
  ### Patch Changes
@@ -166,7 +166,8 @@ var insertBlockPlugin = exports.insertBlockPlugin = function insertBlockPlugin(_
166
166
  var _api$toolbar;
167
167
  api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents((0, _toolbarComponents.getToolbarComponents)({
168
168
  api: api,
169
- tableSelectorSupported: options.tableSelectorSupported
169
+ tableSelectorSupported: options.tableSelectorSupported,
170
+ toolbarShowPlusInsertOnly: options.toolbarShowPlusInsertOnly
170
171
  }));
171
172
  } else {
172
173
  var _api$primaryToolbar;
@@ -121,7 +121,8 @@ var EmojiButton = exports.EmojiButton = function EmojiButton(_ref) {
121
121
  content: formatMessage(_messages.toolbarInsertBlockMessages.emoji)
122
122
  }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
123
123
  iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.EmojiIcon, {
124
- label: formatMessage(_messages.toolbarInsertBlockMessages.emoji)
124
+ label: formatMessage(_messages.toolbarInsertBlockMessages.emoji),
125
+ size: "small"
125
126
  }),
126
127
  ariaKeyshortcuts: "Shift+;",
127
128
  ref: emojiButtonRef,
@@ -39,7 +39,8 @@ var ImageButton = exports.ImageButton = function ImageButton(_ref) {
39
39
  content: formatMessage(_messages.toolbarInsertBlockMessages.image)
40
40
  }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
41
41
  iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ImageIcon, {
42
- label: formatMessage(_messages.toolbarInsertBlockMessages.image)
42
+ label: formatMessage(_messages.toolbarInsertBlockMessages.image),
43
+ size: "small"
43
44
  }),
44
45
  onClick: onClick,
45
46
  isDisabled: !imageUploadEnabled || isOffline
@@ -32,7 +32,8 @@ var LayoutButton = exports.LayoutButton = function LayoutButton(_ref) {
32
32
  content: formatMessage(_messages.toolbarInsertBlockMessages.columns)
33
33
  }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
34
34
  iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.LayoutIcon, {
35
- label: formatMessage(_messages.toolbarInsertBlockMessages.columns)
35
+ label: formatMessage(_messages.toolbarInsertBlockMessages.columns),
36
+ size: "small"
36
37
  }),
37
38
  onClick: onClick
38
39
  }));
@@ -62,7 +62,8 @@ var MediaButton = exports.MediaButton = function MediaButton(_ref) {
62
62
  content: formatMessage(_messages.toolbarInsertBlockMessages.addMediaFiles)
63
63
  }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
64
64
  iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.ImageIcon, {
65
- label: formatMessage(_messages.toolbarInsertBlockMessages.addMediaFiles)
65
+ label: formatMessage(_messages.toolbarInsertBlockMessages.addMediaFiles),
66
+ size: "small"
66
67
  }),
67
68
  onClick: onClick,
68
69
  ref: mediaButtonRef,
@@ -37,7 +37,8 @@ var MentionButton = exports.MentionButton = function MentionButton(_ref) {
37
37
  content: formatMessage(_messages.toolbarInsertBlockMessages.mention)
38
38
  }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
39
39
  iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.MentionIcon, {
40
- label: formatMessage(_messages.toolbarInsertBlockMessages.mention)
40
+ label: formatMessage(_messages.toolbarInsertBlockMessages.mention),
41
+ size: "small"
41
42
  }),
42
43
  onClick: onClick,
43
44
  ariaKeyshortcuts: "Shift+2 Space",
@@ -44,7 +44,8 @@ var TableButton = exports.TableButton = function TableButton(_ref) {
44
44
  content: formatMessage(_messages.toolbarInsertBlockMessages.table)
45
45
  }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
46
46
  iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.TableIcon, {
47
- label: formatMessage(_messages.toolbarInsertBlockMessages.table)
47
+ label: formatMessage(_messages.toolbarInsertBlockMessages.table),
48
+ size: "small"
48
49
  }),
49
50
  onClick: onClick,
50
51
  ariaKeyshortcuts: (0, _keymaps.formatShortcut)(_keymaps.toggleTable)
@@ -23,6 +23,8 @@ var TableSizePicker = exports.TableSizePicker = function TableSizePicker(_ref) {
23
23
  formatMessage = _useIntl.formatMessage;
24
24
  var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
25
25
  editorView = _useEditorToolbar.editorView;
26
+ var _useToolbarUI = (0, _editorToolbar.useToolbarUI)(),
27
+ popupsMountPoint = _useToolbarUI.popupsMountPoint;
26
28
  var _useState = (0, _react.useState)(false),
27
29
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
28
30
  tableSizePickerOpen = _useState2[0],
@@ -66,7 +68,7 @@ var TableSizePicker = exports.TableSizePicker = function TableSizePicker(_ref) {
66
68
  target: tableSizePickerRef.current,
67
69
  onUnmount: onUnmount,
68
70
  onSelection: handleSelectedTableSize,
69
- popupsMountPoint: tableSizePickerRef.current,
71
+ popupsMountPoint: popupsMountPoint,
70
72
  handleClickOutside: handleTableSelectorClickOutside,
71
73
  handleEscapeKeydown: handleTableSelectorPressEscape,
72
74
  isOpenedByKeyboard: isOpenedByKeyboard
@@ -32,7 +32,8 @@ var TaskListButton = exports.TaskListButton = function TaskListButton(_ref) {
32
32
  content: formatMessage(_messages.toolbarInsertBlockMessages.action)
33
33
  }, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
34
34
  iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.TaskIcon, {
35
- label: formatMessage(_messages.toolbarInsertBlockMessages.action)
35
+ label: formatMessage(_messages.toolbarInsertBlockMessages.action),
36
+ size: "small"
36
37
  }),
37
38
  onClick: onClick,
38
39
  ariaKeyshortcuts: "[ ] Space"
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getToolbarComponents = void 0;
8
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
8
9
  var _react = _interopRequireDefault(require("react"));
9
10
  var _toolbar = require("@atlaskit/editor-common/toolbar");
10
11
  var _EmojiButton = require("./toolbar-components/EmojiButton");
@@ -17,16 +18,9 @@ var _TableSizePicker = require("./toolbar-components/TableSizePicker");
17
18
  var _TaskListButton = require("./toolbar-components/TaskListButton");
18
19
  var getToolbarComponents = exports.getToolbarComponents = function getToolbarComponents(_ref) {
19
20
  var api = _ref.api,
20
- tableSelectorSupported = _ref.tableSelectorSupported;
21
- return [{
22
- type: _toolbar.INSERT_BLOCK_SECTION.type,
23
- key: _toolbar.INSERT_BLOCK_SECTION.key,
24
- parents: [{
25
- type: 'toolbar',
26
- key: _toolbar.TOOLBARS.PRIMARY_TOOLBAR,
27
- rank: _toolbar.TOOLBAR_RANK[_toolbar.INSERT_BLOCK_SECTION.key]
28
- }]
29
- }, {
21
+ tableSelectorSupported = _ref.tableSelectorSupported,
22
+ toolbarShowPlusInsertOnly = _ref.toolbarShowPlusInsertOnly;
23
+ return (0, _toConsumableArray2.default)(toolbarShowPlusInsertOnly ? [] : [{
30
24
  type: _toolbar.TASK_LIST_GROUP.type,
31
25
  key: _toolbar.TASK_LIST_GROUP.key,
32
26
  parents: [{
@@ -168,5 +162,5 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
168
162
  tableSelectorSupported: tableSelectorSupported
169
163
  });
170
164
  }
171
- }];
165
+ }]);
172
166
  };
@@ -151,7 +151,8 @@ export const insertBlockPlugin = ({
151
151
  var _api$toolbar;
152
152
  api === null || api === void 0 ? void 0 : (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 ? void 0 : _api$toolbar.actions.registerComponents(getToolbarComponents({
153
153
  api,
154
- tableSelectorSupported: options.tableSelectorSupported
154
+ tableSelectorSupported: options.tableSelectorSupported,
155
+ toolbarShowPlusInsertOnly: options.toolbarShowPlusInsertOnly
155
156
  }));
156
157
  } else {
157
158
  var _api$primaryToolbar;
@@ -109,7 +109,8 @@ export const EmojiButton = ({
109
109
  content: formatMessage(messages.emoji)
110
110
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
111
111
  iconBefore: /*#__PURE__*/React.createElement(EmojiIcon, {
112
- label: formatMessage(messages.emoji)
112
+ label: formatMessage(messages.emoji),
113
+ size: "small"
113
114
  }),
114
115
  ariaKeyshortcuts: "Shift+;",
115
116
  ref: emojiButtonRef,
@@ -38,7 +38,8 @@ export const ImageButton = ({
38
38
  content: formatMessage(messages.image)
39
39
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
40
40
  iconBefore: /*#__PURE__*/React.createElement(ImageIcon, {
41
- label: formatMessage(messages.image)
41
+ label: formatMessage(messages.image),
42
+ size: "small"
42
43
  }),
43
44
  onClick: onClick,
44
45
  isDisabled: !imageUploadEnabled || isOffline
@@ -30,7 +30,8 @@ export const LayoutButton = ({
30
30
  content: formatMessage(messages.columns)
31
31
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
32
32
  iconBefore: /*#__PURE__*/React.createElement(LayoutIcon, {
33
- label: formatMessage(messages.columns)
33
+ label: formatMessage(messages.columns),
34
+ size: "small"
34
35
  }),
35
36
  onClick: onClick
36
37
  }));
@@ -57,7 +57,8 @@ export const MediaButton = ({
57
57
  content: formatMessage(messages.addMediaFiles)
58
58
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
59
59
  iconBefore: /*#__PURE__*/React.createElement(ImageIcon, {
60
- label: formatMessage(messages.addMediaFiles)
60
+ label: formatMessage(messages.addMediaFiles),
61
+ size: "small"
61
62
  }),
62
63
  onClick: onClick,
63
64
  ref: mediaButtonRef,
@@ -33,7 +33,8 @@ export const MentionButton = ({
33
33
  content: formatMessage(messages.mention)
34
34
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
35
35
  iconBefore: /*#__PURE__*/React.createElement(MentionIcon, {
36
- label: formatMessage(messages.mention)
36
+ label: formatMessage(messages.mention),
37
+ size: "small"
37
38
  }),
38
39
  onClick: onClick,
39
40
  ariaKeyshortcuts: "Shift+2 Space",
@@ -42,7 +42,8 @@ export const TableButton = ({
42
42
  content: formatMessage(messages.table)
43
43
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
44
44
  iconBefore: /*#__PURE__*/React.createElement(TableIcon, {
45
- label: formatMessage(messages.table)
45
+ label: formatMessage(messages.table),
46
+ size: "small"
46
47
  }),
47
48
  onClick: onClick,
48
49
  ariaKeyshortcuts: formatShortcut(toggleTable)
@@ -4,7 +4,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
5
5
  import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
6
6
  import { TableSelectorPopup } from '@atlaskit/editor-common/ui';
7
- import { MoreItemsIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
7
+ import { MoreItemsIcon, ToolbarButton, ToolbarTooltip, useToolbarUI } from '@atlaskit/editor-toolbar';
8
8
  import { isDetachedElement } from './utils/utils';
9
9
  export const TableSizePicker = ({
10
10
  api,
@@ -16,6 +16,9 @@ export const TableSizePicker = ({
16
16
  const {
17
17
  editorView
18
18
  } = useEditorToolbar();
19
+ const {
20
+ popupsMountPoint
21
+ } = useToolbarUI();
19
22
  const [tableSizePickerOpen, setTableSizePickerOpen] = useState(false);
20
23
  const [isOpenedByKeyboard, setIsOpenedByKeyboard] = useState(false);
21
24
  const tableSizePickerRef = useRef(null);
@@ -53,7 +56,7 @@ export const TableSizePicker = ({
53
56
  target: tableSizePickerRef.current,
54
57
  onUnmount: onUnmount,
55
58
  onSelection: handleSelectedTableSize,
56
- popupsMountPoint: tableSizePickerRef.current,
59
+ popupsMountPoint: popupsMountPoint,
57
60
  handleClickOutside: handleTableSelectorClickOutside,
58
61
  handleEscapeKeydown: handleTableSelectorPressEscape,
59
62
  isOpenedByKeyboard: isOpenedByKeyboard
@@ -30,7 +30,8 @@ export const TaskListButton = ({
30
30
  content: formatMessage(messages.action)
31
31
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
32
32
  iconBefore: /*#__PURE__*/React.createElement(TaskIcon, {
33
- label: formatMessage(messages.action)
33
+ label: formatMessage(messages.action),
34
+ size: "small"
34
35
  }),
35
36
  onClick: onClick,
36
37
  ariaKeyshortcuts: "[ ] Space"
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { INSERT_BLOCK_SECTION, TASK_LIST_GROUP, MEDIA_GROUP, TOOLBAR_RANK, TOOLBARS, INSERT_BLOCK_SECTION_RANK, TASK_LIST_BUTTON, TASK_LIST_GROUP_RANK, MEDIA_BUTTON, MENTION_GROUP, MEDIA_GROUP_RANK, MENTION_BUTTON, MENTION_GROUP_RANK, EMOJI_GROUP, EMOJI_BUTTON, EMOJI_GROUP_RANK, LAYOUT_GROUP, LAYOUT_BUTTON, LAYOUT_GROUP_RANK, TABLE_GROUP_RANK, TABLE_BUTTON, TABLE_GROUP, TABLE_SIZE_PICKER } from '@atlaskit/editor-common/toolbar';
2
+ import { INSERT_BLOCK_SECTION, TASK_LIST_GROUP, MEDIA_GROUP, INSERT_BLOCK_SECTION_RANK, TASK_LIST_BUTTON, TASK_LIST_GROUP_RANK, MEDIA_BUTTON, MENTION_GROUP, MEDIA_GROUP_RANK, MENTION_BUTTON, MENTION_GROUP_RANK, EMOJI_GROUP, EMOJI_BUTTON, EMOJI_GROUP_RANK, LAYOUT_GROUP, LAYOUT_BUTTON, LAYOUT_GROUP_RANK, TABLE_GROUP_RANK, TABLE_BUTTON, TABLE_GROUP, TABLE_SIZE_PICKER } from '@atlaskit/editor-common/toolbar';
3
3
  import { EmojiButton } from './toolbar-components/EmojiButton';
4
4
  import { ImageButton } from './toolbar-components/ImageButton';
5
5
  import { LayoutButton } from './toolbar-components/LayoutButton';
@@ -10,17 +10,10 @@ import { TableSizePicker } from './toolbar-components/TableSizePicker';
10
10
  import { TaskListButton } from './toolbar-components/TaskListButton';
11
11
  export const getToolbarComponents = ({
12
12
  api,
13
- tableSelectorSupported
13
+ tableSelectorSupported,
14
+ toolbarShowPlusInsertOnly
14
15
  }) => {
15
- return [{
16
- type: INSERT_BLOCK_SECTION.type,
17
- key: INSERT_BLOCK_SECTION.key,
18
- parents: [{
19
- type: 'toolbar',
20
- key: TOOLBARS.PRIMARY_TOOLBAR,
21
- rank: TOOLBAR_RANK[INSERT_BLOCK_SECTION.key]
22
- }]
23
- }, {
16
+ return [...(toolbarShowPlusInsertOnly ? [] : [{
24
17
  type: TASK_LIST_GROUP.type,
25
18
  key: TASK_LIST_GROUP.key,
26
19
  parents: [{
@@ -148,5 +141,5 @@ export const getToolbarComponents = ({
148
141
  api: api,
149
142
  tableSelectorSupported: tableSelectorSupported
150
143
  })
151
- }];
144
+ }])];
152
145
  };
@@ -156,7 +156,8 @@ export var insertBlockPlugin = function insertBlockPlugin(_ref) {
156
156
  var _api$toolbar;
157
157
  api === null || api === void 0 || (_api$toolbar = api.toolbar) === null || _api$toolbar === void 0 || _api$toolbar.actions.registerComponents(getToolbarComponents({
158
158
  api: api,
159
- tableSelectorSupported: options.tableSelectorSupported
159
+ tableSelectorSupported: options.tableSelectorSupported,
160
+ toolbarShowPlusInsertOnly: options.toolbarShowPlusInsertOnly
160
161
  }));
161
162
  } else {
162
163
  var _api$primaryToolbar;
@@ -112,7 +112,8 @@ export var EmojiButton = function EmojiButton(_ref) {
112
112
  content: formatMessage(messages.emoji)
113
113
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
114
114
  iconBefore: /*#__PURE__*/React.createElement(EmojiIcon, {
115
- label: formatMessage(messages.emoji)
115
+ label: formatMessage(messages.emoji),
116
+ size: "small"
116
117
  }),
117
118
  ariaKeyshortcuts: "Shift+;",
118
119
  ref: emojiButtonRef,
@@ -32,7 +32,8 @@ export var ImageButton = function ImageButton(_ref) {
32
32
  content: formatMessage(messages.image)
33
33
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
34
34
  iconBefore: /*#__PURE__*/React.createElement(ImageIcon, {
35
- label: formatMessage(messages.image)
35
+ label: formatMessage(messages.image),
36
+ size: "small"
36
37
  }),
37
38
  onClick: onClick,
38
39
  isDisabled: !imageUploadEnabled || isOffline
@@ -25,7 +25,8 @@ export var LayoutButton = function LayoutButton(_ref) {
25
25
  content: formatMessage(messages.columns)
26
26
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
27
27
  iconBefore: /*#__PURE__*/React.createElement(LayoutIcon, {
28
- label: formatMessage(messages.columns)
28
+ label: formatMessage(messages.columns),
29
+ size: "small"
29
30
  }),
30
31
  onClick: onClick
31
32
  }));
@@ -54,7 +54,8 @@ export var MediaButton = function MediaButton(_ref) {
54
54
  content: formatMessage(messages.addMediaFiles)
55
55
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
56
56
  iconBefore: /*#__PURE__*/React.createElement(ImageIcon, {
57
- label: formatMessage(messages.addMediaFiles)
57
+ label: formatMessage(messages.addMediaFiles),
58
+ size: "small"
58
59
  }),
59
60
  onClick: onClick,
60
61
  ref: mediaButtonRef,
@@ -30,7 +30,8 @@ export var MentionButton = function MentionButton(_ref) {
30
30
  content: formatMessage(messages.mention)
31
31
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
32
32
  iconBefore: /*#__PURE__*/React.createElement(MentionIcon, {
33
- label: formatMessage(messages.mention)
33
+ label: formatMessage(messages.mention),
34
+ size: "small"
34
35
  }),
35
36
  onClick: onClick,
36
37
  ariaKeyshortcuts: "Shift+2 Space",
@@ -37,7 +37,8 @@ export var TableButton = function TableButton(_ref) {
37
37
  content: formatMessage(messages.table)
38
38
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
39
39
  iconBefore: /*#__PURE__*/React.createElement(TableIcon, {
40
- label: formatMessage(messages.table)
40
+ label: formatMessage(messages.table),
41
+ size: "small"
41
42
  }),
42
43
  onClick: onClick,
43
44
  ariaKeyshortcuts: formatShortcut(toggleTable)
@@ -5,7 +5,7 @@ import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
7
7
  import { TableSelectorPopup } from '@atlaskit/editor-common/ui';
8
- import { MoreItemsIcon, ToolbarButton, ToolbarTooltip } from '@atlaskit/editor-toolbar';
8
+ import { MoreItemsIcon, ToolbarButton, ToolbarTooltip, useToolbarUI } from '@atlaskit/editor-toolbar';
9
9
  import { isDetachedElement } from './utils/utils';
10
10
  export var TableSizePicker = function TableSizePicker(_ref) {
11
11
  var api = _ref.api,
@@ -14,6 +14,8 @@ export var TableSizePicker = function TableSizePicker(_ref) {
14
14
  formatMessage = _useIntl.formatMessage;
15
15
  var _useEditorToolbar = useEditorToolbar(),
16
16
  editorView = _useEditorToolbar.editorView;
17
+ var _useToolbarUI = useToolbarUI(),
18
+ popupsMountPoint = _useToolbarUI.popupsMountPoint;
17
19
  var _useState = useState(false),
18
20
  _useState2 = _slicedToArray(_useState, 2),
19
21
  tableSizePickerOpen = _useState2[0],
@@ -57,7 +59,7 @@ export var TableSizePicker = function TableSizePicker(_ref) {
57
59
  target: tableSizePickerRef.current,
58
60
  onUnmount: onUnmount,
59
61
  onSelection: handleSelectedTableSize,
60
- popupsMountPoint: tableSizePickerRef.current,
62
+ popupsMountPoint: popupsMountPoint,
61
63
  handleClickOutside: handleTableSelectorClickOutside,
62
64
  handleEscapeKeydown: handleTableSelectorPressEscape,
63
65
  isOpenedByKeyboard: isOpenedByKeyboard
@@ -25,7 +25,8 @@ export var TaskListButton = function TaskListButton(_ref) {
25
25
  content: formatMessage(messages.action)
26
26
  }, /*#__PURE__*/React.createElement(ToolbarButton, {
27
27
  iconBefore: /*#__PURE__*/React.createElement(TaskIcon, {
28
- label: formatMessage(messages.action)
28
+ label: formatMessage(messages.action),
29
+ size: "small"
29
30
  }),
30
31
  onClick: onClick,
31
32
  ariaKeyshortcuts: "[ ] Space"
@@ -1,5 +1,6 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import React from 'react';
2
- import { INSERT_BLOCK_SECTION, TASK_LIST_GROUP, MEDIA_GROUP, TOOLBAR_RANK, TOOLBARS, INSERT_BLOCK_SECTION_RANK, TASK_LIST_BUTTON, TASK_LIST_GROUP_RANK, MEDIA_BUTTON, MENTION_GROUP, MEDIA_GROUP_RANK, MENTION_BUTTON, MENTION_GROUP_RANK, EMOJI_GROUP, EMOJI_BUTTON, EMOJI_GROUP_RANK, LAYOUT_GROUP, LAYOUT_BUTTON, LAYOUT_GROUP_RANK, TABLE_GROUP_RANK, TABLE_BUTTON, TABLE_GROUP, TABLE_SIZE_PICKER } from '@atlaskit/editor-common/toolbar';
3
+ import { INSERT_BLOCK_SECTION, TASK_LIST_GROUP, MEDIA_GROUP, INSERT_BLOCK_SECTION_RANK, TASK_LIST_BUTTON, TASK_LIST_GROUP_RANK, MEDIA_BUTTON, MENTION_GROUP, MEDIA_GROUP_RANK, MENTION_BUTTON, MENTION_GROUP_RANK, EMOJI_GROUP, EMOJI_BUTTON, EMOJI_GROUP_RANK, LAYOUT_GROUP, LAYOUT_BUTTON, LAYOUT_GROUP_RANK, TABLE_GROUP_RANK, TABLE_BUTTON, TABLE_GROUP, TABLE_SIZE_PICKER } from '@atlaskit/editor-common/toolbar';
3
4
  import { EmojiButton } from './toolbar-components/EmojiButton';
4
5
  import { ImageButton } from './toolbar-components/ImageButton';
5
6
  import { LayoutButton } from './toolbar-components/LayoutButton';
@@ -10,16 +11,9 @@ import { TableSizePicker } from './toolbar-components/TableSizePicker';
10
11
  import { TaskListButton } from './toolbar-components/TaskListButton';
11
12
  export var getToolbarComponents = function getToolbarComponents(_ref) {
12
13
  var api = _ref.api,
13
- tableSelectorSupported = _ref.tableSelectorSupported;
14
- return [{
15
- type: INSERT_BLOCK_SECTION.type,
16
- key: INSERT_BLOCK_SECTION.key,
17
- parents: [{
18
- type: 'toolbar',
19
- key: TOOLBARS.PRIMARY_TOOLBAR,
20
- rank: TOOLBAR_RANK[INSERT_BLOCK_SECTION.key]
21
- }]
22
- }, {
14
+ tableSelectorSupported = _ref.tableSelectorSupported,
15
+ toolbarShowPlusInsertOnly = _ref.toolbarShowPlusInsertOnly;
16
+ return _toConsumableArray(toolbarShowPlusInsertOnly ? [] : [{
23
17
  type: TASK_LIST_GROUP.type,
24
18
  key: TASK_LIST_GROUP.key,
25
19
  parents: [{
@@ -161,5 +155,5 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
161
155
  tableSelectorSupported: tableSelectorSupported
162
156
  });
163
157
  }
164
- }];
158
+ }]);
165
159
  };
@@ -69,6 +69,14 @@ export interface InsertBlockPluginOptions {
69
69
  showElementBrowserLink?: boolean;
70
70
  tableSelectorSupported?: boolean;
71
71
  appearance?: EditorAppearance;
72
+ /**
73
+ * To hide the individual insert block buttons in the toolbar
74
+ * and only show the plus button
75
+ * @default undefined Shows the insert block buttons and the plus button
76
+ *
77
+ * Only applies when platform_editor_toolbar_aifc is enabled
78
+ */
79
+ toolbarShowPlusInsertOnly?: boolean;
72
80
  }
73
81
  /**
74
82
  * @private
@@ -4,6 +4,7 @@ import type { InsertBlockPlugin } from '../insertBlockPluginType';
4
4
  type GetToolbarComponentsProps = {
5
5
  api?: ExtractInjectionAPI<InsertBlockPlugin>;
6
6
  tableSelectorSupported?: boolean;
7
+ toolbarShowPlusInsertOnly?: boolean;
7
8
  };
8
- export declare const getToolbarComponents: ({ api, tableSelectorSupported, }: GetToolbarComponentsProps) => RegisterComponent[];
9
+ export declare const getToolbarComponents: ({ api, tableSelectorSupported, toolbarShowPlusInsertOnly, }: GetToolbarComponentsProps) => RegisterComponent[];
9
10
  export {};
@@ -69,6 +69,14 @@ export interface InsertBlockPluginOptions {
69
69
  showElementBrowserLink?: boolean;
70
70
  tableSelectorSupported?: boolean;
71
71
  appearance?: EditorAppearance;
72
+ /**
73
+ * To hide the individual insert block buttons in the toolbar
74
+ * and only show the plus button
75
+ * @default undefined Shows the insert block buttons and the plus button
76
+ *
77
+ * Only applies when platform_editor_toolbar_aifc is enabled
78
+ */
79
+ toolbarShowPlusInsertOnly?: boolean;
72
80
  }
73
81
  /**
74
82
  * @private
@@ -4,6 +4,7 @@ import type { InsertBlockPlugin } from '../insertBlockPluginType';
4
4
  type GetToolbarComponentsProps = {
5
5
  api?: ExtractInjectionAPI<InsertBlockPlugin>;
6
6
  tableSelectorSupported?: boolean;
7
+ toolbarShowPlusInsertOnly?: boolean;
7
8
  };
8
- export declare const getToolbarComponents: ({ api, tableSelectorSupported, }: GetToolbarComponentsProps) => RegisterComponent[];
9
+ export declare const getToolbarComponents: ({ api, tableSelectorSupported, toolbarShowPlusInsertOnly, }: GetToolbarComponentsProps) => RegisterComponent[];
9
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "4.2.2",
3
+ "version": "4.3.1",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,7 +38,7 @@
38
38
  "@atlaskit/editor-plugin-code-block": "^5.0.0",
39
39
  "@atlaskit/editor-plugin-connectivity": "^3.1.0",
40
40
  "@atlaskit/editor-plugin-date": "^5.1.0",
41
- "@atlaskit/editor-plugin-emoji": "^4.2.0",
41
+ "@atlaskit/editor-plugin-emoji": "^4.3.0",
42
42
  "@atlaskit/editor-plugin-expand": "^4.2.0",
43
43
  "@atlaskit/editor-plugin-extension": "^6.1.0",
44
44
  "@atlaskit/editor-plugin-feature-flags": "^2.0.0",
@@ -56,7 +56,7 @@
56
56
  "@atlaskit/editor-plugin-rule": "^3.0.0",
57
57
  "@atlaskit/editor-plugin-status": "^4.1.0",
58
58
  "@atlaskit/editor-plugin-table": "^12.2.0",
59
- "@atlaskit/editor-plugin-tasks-and-decisions": "^6.3.0",
59
+ "@atlaskit/editor-plugin-tasks-and-decisions": "^6.4.0",
60
60
  "@atlaskit/editor-plugin-toolbar": "^0.3.0",
61
61
  "@atlaskit/editor-plugin-type-ahead": "^3.1.0",
62
62
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -65,12 +65,12 @@
65
65
  "@atlaskit/editor-toolbar-model": "^0.1.0",
66
66
  "@atlaskit/emoji": "^69.5.0",
67
67
  "@atlaskit/heading": "^5.2.0",
68
- "@atlaskit/icon": "^27.12.0",
68
+ "@atlaskit/icon": "^28.0.0",
69
69
  "@atlaskit/icon-lab": "^5.6.0",
70
70
  "@atlaskit/platform-feature-flags": "^1.1.0",
71
71
  "@atlaskit/primitives": "^14.11.0",
72
72
  "@atlaskit/theme": "^19.0.0",
73
- "@atlaskit/tmp-editor-statsig": "^11.3.0",
73
+ "@atlaskit/tmp-editor-statsig": "^11.4.0",
74
74
  "@atlaskit/tokens": "^6.0.0",
75
75
  "@atlaskit/tooltip": "^20.4.0",
76
76
  "@babel/runtime": "^7.0.0",
@@ -81,7 +81,7 @@
81
81
  "react-virtualized": "^9.8.0"
82
82
  },
83
83
  "peerDependencies": {
84
- "@atlaskit/editor-common": "^107.26.0",
84
+ "@atlaskit/editor-common": "^107.28.0",
85
85
  "react": "^18.2.0",
86
86
  "react-dom": "^18.2.0",
87
87
  "react-intl-next": "npm:react-intl@^5.18.1"