@atlaskit/editor-plugin-insert-block 7.0.6 → 7.0.8

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 (28) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/cjs/insertBlockPlugin.js +1 -8
  3. package/dist/cjs/ui/ElementBrowser/InsertMenu.js +1 -1
  4. package/dist/cjs/ui/toolbar-components/EmojiButton.js +5 -1
  5. package/dist/cjs/ui/toolbar-components/InsertButton.js +7 -2
  6. package/dist/cjs/ui/toolbar-components/MentionButton.js +6 -1
  7. package/dist/cjs/ui/toolbar-components/TableButton.js +6 -2
  8. package/dist/cjs/ui/toolbar-components/TaskListButton.js +6 -1
  9. package/dist/cjs/ui/toolbar-components.js +7 -271
  10. package/dist/es2019/insertBlockPlugin.js +2 -9
  11. package/dist/es2019/ui/ElementBrowser/InsertMenu.js +1 -1
  12. package/dist/es2019/ui/toolbar-components/EmojiButton.js +5 -1
  13. package/dist/es2019/ui/toolbar-components/InsertButton.js +7 -2
  14. package/dist/es2019/ui/toolbar-components/MentionButton.js +6 -1
  15. package/dist/es2019/ui/toolbar-components/TableButton.js +7 -3
  16. package/dist/es2019/ui/toolbar-components/TaskListButton.js +6 -1
  17. package/dist/es2019/ui/toolbar-components.js +1 -241
  18. package/dist/esm/insertBlockPlugin.js +2 -9
  19. package/dist/esm/ui/ElementBrowser/InsertMenu.js +1 -1
  20. package/dist/esm/ui/toolbar-components/EmojiButton.js +5 -1
  21. package/dist/esm/ui/toolbar-components/InsertButton.js +7 -2
  22. package/dist/esm/ui/toolbar-components/MentionButton.js +6 -1
  23. package/dist/esm/ui/toolbar-components/TableButton.js +7 -3
  24. package/dist/esm/ui/toolbar-components/TaskListButton.js +6 -1
  25. package/dist/esm/ui/toolbar-components.js +6 -270
  26. package/dist/types/ui/toolbar-components.d.ts +1 -19
  27. package/dist/types-ts4.5/ui/toolbar-components.d.ts +1 -19
  28. package/package.json +4 -7
@@ -1,4 +1,3 @@
1
- import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
1
  import React from 'react';
3
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, INSERT_GROUP, INSERT_BUTTON, INSERT_GROUP_RANK, CODE_BLOCK_GROUP, CODE_BLOCK_BUTTON, CODE_BLOCK_GROUP_RANK } from '@atlaskit/editor-common/toolbar';
4
3
  import { Show, ToolbarButtonGroup } from '@atlaskit/editor-toolbar';
@@ -14,270 +13,22 @@ import { MentionButton } from './toolbar-components/MentionButton';
14
13
  import { TableButton } from './toolbar-components/TableButton';
15
14
  import { TableSizePicker } from './toolbar-components/TableSizePicker';
16
15
  import { TaskListButton } from './toolbar-components/TaskListButton';
17
- export var getToolbarComponents = function getToolbarComponents(_ref) {
18
- var api = _ref.api,
19
- tableSelectorSupported = _ref.tableSelectorSupported,
20
- toolbarShowPlusInsertOnly = _ref.toolbarShowPlusInsertOnly,
21
- showElementBrowserLink = _ref.showElementBrowserLink,
22
- onInsertBlockType = _ref.onInsertBlockType,
23
- nativeStatusSupported = _ref.nativeStatusSupported,
24
- horizontalRuleEnabled = _ref.horizontalRuleEnabled,
25
- expandEnabled = _ref.expandEnabled,
26
- insertMenuItems = _ref.insertMenuItems;
27
- return _toConsumableArray(toolbarShowPlusInsertOnly ? [{
28
- type: INSERT_GROUP.type,
29
- key: INSERT_GROUP.key,
30
- parents: [{
31
- type: INSERT_BLOCK_SECTION.type,
32
- key: INSERT_BLOCK_SECTION.key,
33
- rank: INSERT_BLOCK_SECTION_RANK[INSERT_GROUP.key]
34
- }]
35
- }, {
36
- type: INSERT_BUTTON.type,
37
- key: INSERT_BUTTON.key,
38
- parents: [{
39
- type: INSERT_GROUP.type,
40
- key: INSERT_GROUP.key,
41
- rank: INSERT_GROUP_RANK[INSERT_BUTTON.key]
42
- }],
43
- component: function component() {
44
- return /*#__PURE__*/React.createElement(InsertButton, {
45
- api: api,
46
- showElementBrowserLink: showElementBrowserLink,
47
- tableSelectorSupported: tableSelectorSupported,
48
- onInsertBlockType: onInsertBlockType,
49
- nativeStatusSupported: nativeStatusSupported,
50
- horizontalRuleEnabled: horizontalRuleEnabled,
51
- expandEnabled: expandEnabled,
52
- insertMenuItems: insertMenuItems
53
- });
54
- }
55
- }] : [{
56
- type: TASK_LIST_GROUP.type,
57
- key: TASK_LIST_GROUP.key,
58
- parents: [{
59
- type: INSERT_BLOCK_SECTION.type,
60
- key: INSERT_BLOCK_SECTION.key,
61
- rank: INSERT_BLOCK_SECTION_RANK[TASK_LIST_GROUP.key]
62
- }],
63
- component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? function (_ref2) {
64
- var children = _ref2.children;
65
- return /*#__PURE__*/React.createElement(Show, {
66
- above: "lg"
67
- }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
68
- } : undefined
69
- }, {
70
- type: TASK_LIST_BUTTON.type,
71
- key: TASK_LIST_BUTTON.key,
72
- parents: [{
73
- type: TASK_LIST_GROUP.type,
74
- key: TASK_LIST_GROUP.key,
75
- rank: TASK_LIST_GROUP_RANK[TASK_LIST_BUTTON.key]
76
- }],
77
- component: function component() {
78
- return /*#__PURE__*/React.createElement(TaskListButton, {
79
- api: api
80
- });
81
- }
82
- }, {
83
- type: MEDIA_GROUP.type,
84
- key: MEDIA_GROUP.key,
85
- parents: [{
86
- type: INSERT_BLOCK_SECTION.type,
87
- key: INSERT_BLOCK_SECTION.key,
88
- rank: INSERT_BLOCK_SECTION_RANK[MEDIA_GROUP.key]
89
- }],
90
- component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? function (_ref3) {
91
- var children = _ref3.children;
92
- return /*#__PURE__*/React.createElement(Show, {
93
- above: "lg"
94
- }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
95
- } : undefined
96
- }, {
97
- type: MEDIA_BUTTON.type,
98
- key: MEDIA_BUTTON.key,
99
- parents: [{
100
- type: MEDIA_GROUP.type,
101
- key: MEDIA_GROUP.key,
102
- rank: MEDIA_GROUP_RANK[MEDIA_BUTTON.key]
103
- }],
104
- component: function component() {
105
- return !!(api !== null && api !== void 0 && api.imageUpload) ? /*#__PURE__*/React.createElement(ImageButton, {
106
- api: api
107
- }) : /*#__PURE__*/React.createElement(MediaButton, {
108
- api: api
109
- });
110
- }
111
- }, {
112
- type: MENTION_GROUP.type,
113
- key: MENTION_GROUP.key,
114
- parents: [{
115
- type: INSERT_BLOCK_SECTION.type,
116
- key: INSERT_BLOCK_SECTION.key,
117
- rank: INSERT_BLOCK_SECTION_RANK[MENTION_GROUP.key]
118
- }],
119
- component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? function (_ref4) {
120
- var children = _ref4.children;
121
- return /*#__PURE__*/React.createElement(Show, {
122
- above: "lg"
123
- }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
124
- } : undefined
125
- }, {
126
- type: MENTION_BUTTON.type,
127
- key: MENTION_BUTTON.key,
128
- parents: [{
129
- type: MENTION_GROUP.type,
130
- key: MENTION_GROUP.key,
131
- rank: MENTION_GROUP_RANK[MENTION_BUTTON.key]
132
- }],
133
- component: function component() {
134
- return /*#__PURE__*/React.createElement(MentionButton, {
135
- api: api
136
- });
137
- }
138
- }, {
139
- type: EMOJI_GROUP.type,
140
- key: EMOJI_GROUP.key,
141
- parents: [{
142
- type: INSERT_BLOCK_SECTION.type,
143
- key: INSERT_BLOCK_SECTION.key,
144
- rank: INSERT_BLOCK_SECTION_RANK[EMOJI_GROUP.key]
145
- }],
146
- component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? function (_ref5) {
147
- var children = _ref5.children;
148
- return /*#__PURE__*/React.createElement(Show, {
149
- above: "lg"
150
- }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
151
- } : undefined
152
- }, {
153
- type: EMOJI_BUTTON.type,
154
- key: EMOJI_BUTTON.key,
155
- parents: [{
156
- type: EMOJI_GROUP.type,
157
- key: EMOJI_GROUP.key,
158
- rank: EMOJI_GROUP_RANK[EMOJI_BUTTON.key]
159
- }],
160
- component: function component() {
161
- return /*#__PURE__*/React.createElement(EmojiButton, {
162
- api: api
163
- });
164
- }
165
- }, {
166
- type: LAYOUT_GROUP.type,
167
- key: LAYOUT_GROUP.key,
168
- parents: [{
169
- type: INSERT_BLOCK_SECTION.type,
170
- key: INSERT_BLOCK_SECTION.key,
171
- rank: INSERT_BLOCK_SECTION_RANK[LAYOUT_GROUP.key]
172
- }],
173
- component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? function (_ref6) {
174
- var children = _ref6.children;
175
- return /*#__PURE__*/React.createElement(Show, {
176
- above: "lg"
177
- }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
178
- } : undefined
179
- }, {
180
- type: LAYOUT_BUTTON.type,
181
- key: LAYOUT_BUTTON.key,
182
- parents: [{
183
- type: LAYOUT_GROUP.type,
184
- key: LAYOUT_GROUP.key,
185
- rank: LAYOUT_GROUP_RANK[LAYOUT_BUTTON.key]
186
- }],
187
- component: function component() {
188
- return /*#__PURE__*/React.createElement(LayoutButton, {
189
- api: api
190
- });
191
- }
192
- }, {
193
- type: TABLE_GROUP.type,
194
- key: TABLE_GROUP.key,
195
- parents: [{
196
- type: INSERT_BLOCK_SECTION.type,
197
- key: INSERT_BLOCK_SECTION.key,
198
- rank: INSERT_BLOCK_SECTION_RANK[TABLE_GROUP.key]
199
- }],
200
- component: expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? function (_ref7) {
201
- var children = _ref7.children;
202
- return /*#__PURE__*/React.createElement(Show, {
203
- above: "md"
204
- }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
205
- } : undefined
206
- }, {
207
- type: TABLE_BUTTON.type,
208
- key: TABLE_BUTTON.key,
209
- parents: [{
210
- type: TABLE_GROUP.type,
211
- key: TABLE_GROUP.key,
212
- rank: TABLE_GROUP_RANK[TABLE_BUTTON.key]
213
- }],
214
- component: function component() {
215
- return /*#__PURE__*/React.createElement(TableButton, {
216
- api: api
217
- });
218
- }
219
- }, {
220
- type: TABLE_SIZE_PICKER.type,
221
- key: TABLE_SIZE_PICKER.key,
222
- parents: [{
223
- type: TABLE_GROUP.type,
224
- key: TABLE_GROUP.key,
225
- rank: TABLE_GROUP_RANK[TABLE_SIZE_PICKER.key]
226
- }],
227
- component: function component() {
228
- return /*#__PURE__*/React.createElement(TableSizePicker, {
229
- api: api,
230
- tableSelectorSupported: tableSelectorSupported
231
- });
232
- }
233
- }, {
234
- type: INSERT_GROUP.type,
235
- key: INSERT_GROUP.key,
236
- parents: [{
237
- type: INSERT_BLOCK_SECTION.type,
238
- key: INSERT_BLOCK_SECTION.key,
239
- rank: INSERT_BLOCK_SECTION_RANK[INSERT_GROUP.key]
240
- }]
241
- }, {
242
- type: INSERT_BUTTON.type,
243
- key: INSERT_BUTTON.key,
244
- parents: [{
245
- type: INSERT_GROUP.type,
246
- key: INSERT_GROUP.key,
247
- rank: INSERT_GROUP_RANK[INSERT_BUTTON.key]
248
- }],
249
- component: function component() {
250
- return /*#__PURE__*/React.createElement(InsertButton, {
251
- api: api,
252
- showElementBrowserLink: showElementBrowserLink,
253
- tableSelectorSupported: tableSelectorSupported,
254
- onInsertBlockType: onInsertBlockType,
255
- nativeStatusSupported: nativeStatusSupported,
256
- horizontalRuleEnabled: horizontalRuleEnabled,
257
- expandEnabled: expandEnabled,
258
- insertMenuItems: insertMenuItems,
259
- numberOfButtons: 7 // TODO: ED-28759 - Default to 7 buttons - Remove this once we have a proper way to do toolbar responsiveness
260
- });
261
- }
262
- }]);
263
- };
264
-
265
16
  /**
266
17
  * Updated toolbar components function that uses the new configuration resolver.
267
18
  * This function replaces the hardcoded approach with a config-driven one.
268
19
  */
269
- export var getToolbarComponentsUpdated = function getToolbarComponentsUpdated(_ref8) {
20
+ export var getToolbarComponents = function getToolbarComponents(_ref) {
270
21
  var _config$taskList, _config$media, _config$codeBlock, _config$mention, _config$emoji, _config$layout, _config$table, _config$insert;
271
- var api = _ref8.api,
272
- options = _ref8.options,
273
- onInsertBlockType = _ref8.onInsertBlockType;
22
+ var api = _ref.api,
23
+ options = _ref.options,
24
+ onInsertBlockType = _ref.onInsertBlockType;
274
25
  var config = resolveToolbarConfig(options);
275
26
  var components = [];
276
27
 
277
28
  // Helper function to create responsive wrapper component
278
29
  var createResponsiveComponent = function createResponsiveComponent() {
279
- return expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? function (_ref9) {
280
- var children = _ref9.children;
30
+ return expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) ? function (_ref2) {
31
+ var children = _ref2.children;
281
32
  return /*#__PURE__*/React.createElement(Show, {
282
33
  above: "lg"
283
34
  }, /*#__PURE__*/React.createElement(ToolbarButtonGroup, null, children));
@@ -534,19 +285,4 @@ export var getToolbarComponentsUpdated = function getToolbarComponentsUpdated(_r
534
285
  });
535
286
  }
536
287
  return components;
537
- };
538
-
539
- /**
540
- * Main export that switches between old and new implementations based on experiment.
541
- * This allows for gradual rollout of the new config-driven approach.
542
- */
543
- export var getToolbarComponentsWithConfig = function getToolbarComponentsWithConfig(props) {
544
- if (expValEquals('platform_editor_toolbar_aifc_responsiveness_update', 'isEnabled', true) && 'options' in props) {
545
- // Use new config-driven approach
546
- return getToolbarComponentsUpdated(props);
547
- }
548
-
549
- // Use legacy approach
550
- var legacyProps = props;
551
- return getToolbarComponents(legacyProps);
552
288
  };
@@ -1,33 +1,15 @@
1
1
  import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
3
2
  import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
4
3
  import type { InsertBlockPlugin } from '../insertBlockPluginType';
5
4
  import type { InsertBlockPluginOptions } from '../types';
6
5
  type GetToolbarComponentsProps = {
7
- api?: ExtractInjectionAPI<InsertBlockPlugin>;
8
- expandEnabled?: boolean;
9
- horizontalRuleEnabled?: boolean;
10
- insertMenuItems?: MenuItem[];
11
- nativeStatusSupported?: boolean;
12
- onInsertBlockType?: (name: string) => Command;
13
- showElementBrowserLink?: boolean;
14
- tableSelectorSupported?: boolean;
15
- toolbarShowPlusInsertOnly?: boolean;
16
- };
17
- type GetToolbarComponentsUpdatedProps = {
18
6
  api?: ExtractInjectionAPI<InsertBlockPlugin>;
19
7
  onInsertBlockType?: (name: string) => Command;
20
8
  options: InsertBlockPluginOptions;
21
9
  };
22
- export declare const getToolbarComponents: ({ api, tableSelectorSupported, toolbarShowPlusInsertOnly, showElementBrowserLink, onInsertBlockType, nativeStatusSupported, horizontalRuleEnabled, expandEnabled, insertMenuItems, }: GetToolbarComponentsProps) => RegisterComponent[];
23
10
  /**
24
11
  * Updated toolbar components function that uses the new configuration resolver.
25
12
  * This function replaces the hardcoded approach with a config-driven one.
26
13
  */
27
- export declare const getToolbarComponentsUpdated: ({ api, options, onInsertBlockType, }: GetToolbarComponentsUpdatedProps) => RegisterComponent[];
28
- /**
29
- * Main export that switches between old and new implementations based on experiment.
30
- * This allows for gradual rollout of the new config-driven approach.
31
- */
32
- export declare const getToolbarComponentsWithConfig: (props: GetToolbarComponentsProps | GetToolbarComponentsUpdatedProps) => RegisterComponent[];
14
+ export declare const getToolbarComponents: ({ api, options, onInsertBlockType, }: GetToolbarComponentsProps) => RegisterComponent[];
33
15
  export {};
@@ -1,33 +1,15 @@
1
1
  import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
2
- import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
3
2
  import type { RegisterComponent } from '@atlaskit/editor-toolbar-model';
4
3
  import type { InsertBlockPlugin } from '../insertBlockPluginType';
5
4
  import type { InsertBlockPluginOptions } from '../types';
6
5
  type GetToolbarComponentsProps = {
7
- api?: ExtractInjectionAPI<InsertBlockPlugin>;
8
- expandEnabled?: boolean;
9
- horizontalRuleEnabled?: boolean;
10
- insertMenuItems?: MenuItem[];
11
- nativeStatusSupported?: boolean;
12
- onInsertBlockType?: (name: string) => Command;
13
- showElementBrowserLink?: boolean;
14
- tableSelectorSupported?: boolean;
15
- toolbarShowPlusInsertOnly?: boolean;
16
- };
17
- type GetToolbarComponentsUpdatedProps = {
18
6
  api?: ExtractInjectionAPI<InsertBlockPlugin>;
19
7
  onInsertBlockType?: (name: string) => Command;
20
8
  options: InsertBlockPluginOptions;
21
9
  };
22
- export declare const getToolbarComponents: ({ api, tableSelectorSupported, toolbarShowPlusInsertOnly, showElementBrowserLink, onInsertBlockType, nativeStatusSupported, horizontalRuleEnabled, expandEnabled, insertMenuItems, }: GetToolbarComponentsProps) => RegisterComponent[];
23
10
  /**
24
11
  * Updated toolbar components function that uses the new configuration resolver.
25
12
  * This function replaces the hardcoded approach with a config-driven one.
26
13
  */
27
- export declare const getToolbarComponentsUpdated: ({ api, options, onInsertBlockType, }: GetToolbarComponentsUpdatedProps) => RegisterComponent[];
28
- /**
29
- * Main export that switches between old and new implementations based on experiment.
30
- * This allows for gradual rollout of the new config-driven approach.
31
- */
32
- export declare const getToolbarComponentsWithConfig: (props: GetToolbarComponentsProps | GetToolbarComponentsUpdatedProps) => RegisterComponent[];
14
+ export declare const getToolbarComponents: ({ api, options, onInsertBlockType, }: GetToolbarComponentsProps) => RegisterComponent[];
33
15
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "7.0.6",
3
+ "version": "7.0.8",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/editor-plugin-type-ahead": "^6.2.0",
59
59
  "@atlaskit/editor-prosemirror": "7.0.0",
60
60
  "@atlaskit/editor-shared-styles": "^3.6.0",
61
- "@atlaskit/editor-toolbar": "^0.13.0",
61
+ "@atlaskit/editor-toolbar": "^0.14.0",
62
62
  "@atlaskit/editor-toolbar-model": "^0.2.0",
63
63
  "@atlaskit/emoji": "^69.5.0",
64
64
  "@atlaskit/heading": "^5.2.0",
@@ -67,7 +67,7 @@
67
67
  "@atlaskit/platform-feature-flags": "^1.1.0",
68
68
  "@atlaskit/primitives": "^14.15.0",
69
69
  "@atlaskit/theme": "^21.0.0",
70
- "@atlaskit/tmp-editor-statsig": "^13.2.0",
70
+ "@atlaskit/tmp-editor-statsig": "^13.4.0",
71
71
  "@atlaskit/tokens": "^6.4.0",
72
72
  "@atlaskit/tooltip": "^20.5.0",
73
73
  "@babel/runtime": "^7.0.0",
@@ -78,7 +78,7 @@
78
78
  "react-virtualized": "^9.8.0"
79
79
  },
80
80
  "peerDependencies": {
81
- "@atlaskit/editor-common": "^110.4.0",
81
+ "@atlaskit/editor-common": "^110.7.0",
82
82
  "react": "^18.2.0",
83
83
  "react-dom": "^18.2.0",
84
84
  "react-intl-next": "npm:react-intl@^5.18.1"
@@ -133,9 +133,6 @@
133
133
  "platform_editor_ease_of_use_metrics": {
134
134
  "type": "boolean"
135
135
  },
136
- "platform_editor_refactor_view_more_fix": {
137
- "type": "boolean"
138
- },
139
136
  "platform_editor_add_media_from_url_rollout": {
140
137
  "type": "boolean"
141
138
  },