@atlaskit/editor-plugin-quick-insert 24.0.3 → 25.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/quickInsertPlugin.js +34 -51
- package/dist/es2019/quickInsertPlugin.js +0 -16
- package/dist/esm/quickInsertPlugin.js +34 -51
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-quick-insert
|
|
2
2
|
|
|
3
|
+
## 25.0.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`1cb97ba88fb58`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1cb97ba88fb58) -
|
|
8
|
+
Clean up experiment `platform_editor_insert_menu_ai` (keep control).
|
|
9
|
+
|
|
10
|
+
Breaking changes (`@atlaskit/editor-common`): removed `getEmptyItem` from `TypeAheadHandler`, and
|
|
11
|
+
removed the unused messages `typeAheadListMessages.emptySearchResultsSuggestionNew`,
|
|
12
|
+
`typeAheadListMessages.emptySearchResultsSuggestionAskRovoOnly` and
|
|
13
|
+
`toolbarInsertBlockMessages.askRovo`.
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 24.0.4
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 24.0.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -14,7 +14,6 @@ var _reactIntl = require("react-intl");
|
|
|
14
14
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
15
15
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
16
16
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
17
|
-
var _getActiveQuickInsertCategories = require("@atlaskit/editor-common/quick-insert/get-active-quick-insert-categories");
|
|
18
17
|
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
19
18
|
var _typeAhead = require("@atlaskit/editor-common/type-ahead");
|
|
20
19
|
var _showMoreHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/show-more-horizontal"));
|
|
@@ -60,22 +59,6 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
60
59
|
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems);
|
|
61
60
|
return Promise.resolve(items);
|
|
62
61
|
},
|
|
63
|
-
getEmptyItem: function getEmptyItem(_ref3) {
|
|
64
|
-
var editorState = _ref3.editorState;
|
|
65
|
-
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_insert_menu_ai')) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
var quickInsertState = _pluginKey.pluginKey.getState(editorState);
|
|
69
|
-
var matches = (0, _search.getQuickInsertSuggestions)({
|
|
70
|
-
query: '',
|
|
71
|
-
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems,
|
|
72
|
-
prioritySortingFn: options === null || options === void 0 ? void 0 : options.prioritySortingFn,
|
|
73
|
-
itemFilter: function itemFilter(item) {
|
|
74
|
-
return (0, _getActiveQuickInsertCategories.getActiveQuickInsertCategories)(item.category, item.categories).includes('AI');
|
|
75
|
-
}
|
|
76
|
-
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems);
|
|
77
|
-
return matches[0];
|
|
78
|
-
},
|
|
79
62
|
selectItem: function selectItem(state, item, insert) {
|
|
80
63
|
var quickInsertItem = item;
|
|
81
64
|
var result = quickInsertItem.action(insert, state);
|
|
@@ -84,8 +67,8 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
84
67
|
}
|
|
85
68
|
return result;
|
|
86
69
|
},
|
|
87
|
-
getMoreOptionsButtonConfig: options !== null && options !== void 0 && options.enableElementBrowser ? function (
|
|
88
|
-
var formatMessage =
|
|
70
|
+
getMoreOptionsButtonConfig: options !== null && options !== void 0 && options.enableElementBrowser ? function (_ref3) {
|
|
71
|
+
var formatMessage = _ref3.formatMessage;
|
|
89
72
|
return {
|
|
90
73
|
title: formatMessage(_messages.toolbarInsertBlockMessages.viewMore),
|
|
91
74
|
ariaLabel: formatMessage(_messages.toolbarInsertBlockMessages.viewMoreAriaLabel),
|
|
@@ -125,8 +108,8 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
125
108
|
}));
|
|
126
109
|
}
|
|
127
110
|
var openElementBrowser = function openElementBrowser(options) {
|
|
128
|
-
return function (
|
|
129
|
-
var tr =
|
|
111
|
+
return function (_ref4) {
|
|
112
|
+
var tr = _ref4.tr;
|
|
130
113
|
if ((0, _fg.fg)('platform_editor_ease_of_use_metrics')) {
|
|
131
114
|
var _api$metrics;
|
|
132
115
|
api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 || _api$metrics.commands.handleIntentToStartEdit({
|
|
@@ -148,11 +131,11 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
148
131
|
return [{
|
|
149
132
|
name: 'quickInsert',
|
|
150
133
|
// It's important that this plugin is above TypeAheadPlugin
|
|
151
|
-
plugin: function plugin(
|
|
152
|
-
var providerFactory =
|
|
153
|
-
getIntl =
|
|
154
|
-
dispatch =
|
|
155
|
-
dispatchAnalyticsEvent =
|
|
134
|
+
plugin: function plugin(_ref5) {
|
|
135
|
+
var providerFactory = _ref5.providerFactory,
|
|
136
|
+
getIntl = _ref5.getIntl,
|
|
137
|
+
dispatch = _ref5.dispatch,
|
|
138
|
+
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
156
139
|
return quickInsertPluginFactory((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command') ? (defaultItems || []).filter(function (item) {
|
|
157
140
|
return item !== undefined;
|
|
158
141
|
}) : defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, refs, options === null || options === void 0 ? void 0 : options.emptyStateHandler, onInsert, options === null || options === void 0 ? void 0 : options.itemFilter, api);
|
|
@@ -173,10 +156,10 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
173
156
|
pluginsOptions: {
|
|
174
157
|
typeAhead: typeAhead
|
|
175
158
|
},
|
|
176
|
-
contentComponent: function contentComponent(
|
|
177
|
-
var editorView =
|
|
178
|
-
popupsMountPoint =
|
|
179
|
-
wrapperElement =
|
|
159
|
+
contentComponent: function contentComponent(_ref6) {
|
|
160
|
+
var editorView = _ref6.editorView,
|
|
161
|
+
popupsMountPoint = _ref6.popupsMountPoint,
|
|
162
|
+
wrapperElement = _ref6.wrapperElement;
|
|
180
163
|
// using contentComponent to set editorView can cause it to become stale when editor is reconfigured
|
|
181
164
|
// (e.g. page appearance change)
|
|
182
165
|
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
|
|
@@ -229,9 +212,9 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
229
212
|
},
|
|
230
213
|
getSuggestions: function getSuggestions(searchOptions) {
|
|
231
214
|
var _api$quickInsert$shar, _api$quickInsert, _options$prioritySort;
|
|
232
|
-
var
|
|
233
|
-
lazyDefaultItems =
|
|
234
|
-
providedItems =
|
|
215
|
+
var _ref7 = (_api$quickInsert$shar = api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.sharedState.currentState()) !== null && _api$quickInsert$shar !== void 0 ? _api$quickInsert$shar : {},
|
|
216
|
+
lazyDefaultItems = _ref7.lazyDefaultItems,
|
|
217
|
+
providedItems = _ref7.providedItems;
|
|
235
218
|
searchOptions = _objectSpread(_objectSpread({}, searchOptions), {}, {
|
|
236
219
|
prioritySortingFn: (0, _search.withLayoutQuickInsertPrioritySorting)((_options$prioritySort = options === null || options === void 0 ? void 0 : options.prioritySortingFn) !== null && _options$prioritySort !== void 0 ? _options$prioritySort : searchOptions.prioritySortingFn)
|
|
237
220
|
});
|
|
@@ -252,8 +235,8 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
252
235
|
},
|
|
253
236
|
commands: {
|
|
254
237
|
openElementBrowser: openElementBrowser,
|
|
255
|
-
openElementBrowserModal: function openElementBrowserModal(
|
|
256
|
-
var tr =
|
|
238
|
+
openElementBrowserModal: function openElementBrowserModal(_ref8) {
|
|
239
|
+
var tr = _ref8.tr;
|
|
257
240
|
if ((0, _fg.fg)('platform_editor_ease_of_use_metrics')) {
|
|
258
241
|
var _api$metrics2;
|
|
259
242
|
api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 || _api$metrics2.commands.handleIntentToStartEdit({
|
|
@@ -268,11 +251,11 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
268
251
|
});
|
|
269
252
|
},
|
|
270
253
|
addQuickInsertItem: function addQuickInsertItem(item) {
|
|
271
|
-
return function (
|
|
254
|
+
return function (_ref9) {
|
|
272
255
|
var _api$quickInsert$shar2, _api$quickInsert2;
|
|
273
|
-
var tr =
|
|
274
|
-
var
|
|
275
|
-
lazyDefaultItems =
|
|
256
|
+
var tr = _ref9.tr;
|
|
257
|
+
var _ref0 = (_api$quickInsert$shar2 = api === null || api === void 0 || (_api$quickInsert2 = api.quickInsert) === null || _api$quickInsert2 === void 0 ? void 0 : _api$quickInsert2.sharedState.currentState()) !== null && _api$quickInsert$shar2 !== void 0 ? _api$quickInsert$shar2 : {},
|
|
258
|
+
lazyDefaultItems = _ref0.lazyDefaultItems;
|
|
276
259
|
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
277
260
|
var memoisedNewItems = (0, _quickInsert.memoProcessQuickInsertItems)([item], intl);
|
|
278
261
|
return tr.setMeta(_pluginKey.pluginKey, {
|
|
@@ -283,12 +266,12 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
283
266
|
};
|
|
284
267
|
},
|
|
285
268
|
updateQuickInsertItem: function updateQuickInsertItem(key, item) {
|
|
286
|
-
return function (
|
|
269
|
+
return function (_ref1) {
|
|
287
270
|
var _api$quickInsert$shar3, _api$quickInsert3;
|
|
288
|
-
var tr =
|
|
289
|
-
var
|
|
290
|
-
providedItems =
|
|
291
|
-
lazyDefaultItems =
|
|
271
|
+
var tr = _ref1.tr;
|
|
272
|
+
var _ref10 = (_api$quickInsert$shar3 = api === null || api === void 0 || (_api$quickInsert3 = api.quickInsert) === null || _api$quickInsert3 === void 0 ? void 0 : _api$quickInsert3.sharedState.currentState()) !== null && _api$quickInsert$shar3 !== void 0 ? _api$quickInsert$shar3 : {},
|
|
273
|
+
providedItems = _ref10.providedItems,
|
|
274
|
+
lazyDefaultItems = _ref10.lazyDefaultItems;
|
|
292
275
|
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
293
276
|
var newItem = (0, _quickInsert.memoProcessQuickInsertItems)([item], intl);
|
|
294
277
|
var replaceByKey = function replaceByKey(items) {
|
|
@@ -313,12 +296,12 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
|
|
|
313
296
|
};
|
|
314
297
|
},
|
|
315
298
|
removeQuickInsertItem: function removeQuickInsertItem(key) {
|
|
316
|
-
return function (
|
|
299
|
+
return function (_ref11) {
|
|
317
300
|
var _api$quickInsert$shar4, _api$quickInsert4, _providedItems$filter;
|
|
318
|
-
var tr =
|
|
319
|
-
var
|
|
320
|
-
providedItems =
|
|
321
|
-
lazyDefaultItems =
|
|
301
|
+
var tr = _ref11.tr;
|
|
302
|
+
var _ref12 = (_api$quickInsert$shar4 = api === null || api === void 0 || (_api$quickInsert4 = api.quickInsert) === null || _api$quickInsert4 === void 0 ? void 0 : _api$quickInsert4.sharedState.currentState()) !== null && _api$quickInsert$shar4 !== void 0 ? _api$quickInsert$shar4 : {},
|
|
303
|
+
providedItems = _ref12.providedItems,
|
|
304
|
+
lazyDefaultItems = _ref12.lazyDefaultItems;
|
|
322
305
|
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
323
306
|
return tr.setMeta(_pluginKey.pluginKey, {
|
|
324
307
|
providedItems: (_providedItems$filter = providedItems === null || providedItems === void 0 ? void 0 : providedItems.filter(function (item) {
|
|
@@ -389,7 +372,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
389
372
|
var quickInsertItemsAnalyticsScheduler;
|
|
390
373
|
var isDestroyed = false;
|
|
391
374
|
var providerHandler = /*#__PURE__*/function () {
|
|
392
|
-
var
|
|
375
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(_name, providerPromise) {
|
|
393
376
|
var provider, providedItems, _api$uiControlRegistr3, directComponents, components, _t, _t2;
|
|
394
377
|
return _regenerator.default.wrap(function (_context) {
|
|
395
378
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -457,7 +440,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
457
440
|
}, _callee, null, [[1, 8]]);
|
|
458
441
|
}));
|
|
459
442
|
return function providerHandler(_x, _x2) {
|
|
460
|
-
return
|
|
443
|
+
return _ref13.apply(this, arguments);
|
|
461
444
|
};
|
|
462
445
|
}();
|
|
463
446
|
providerFactory.subscribe('quickInsertProvider', providerHandler);
|
|
@@ -3,7 +3,6 @@ import { useIntl } from 'react-intl';
|
|
|
3
3
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
5
|
import { memoProcessQuickInsertItems } from '@atlaskit/editor-common/quick-insert';
|
|
6
|
-
import { getActiveQuickInsertCategories } from '@atlaskit/editor-common/quick-insert/get-active-quick-insert-categories';
|
|
7
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
8
7
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
9
8
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
@@ -49,21 +48,6 @@ export const quickInsertPlugin = ({
|
|
|
49
48
|
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems);
|
|
50
49
|
return Promise.resolve(items);
|
|
51
50
|
},
|
|
52
|
-
getEmptyItem({
|
|
53
|
-
editorState
|
|
54
|
-
}) {
|
|
55
|
-
if (!isExperimentEnabled('platform_editor_insert_menu_ai')) {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
const quickInsertState = pluginKey.getState(editorState);
|
|
59
|
-
const matches = getQuickInsertSuggestions({
|
|
60
|
-
query: '',
|
|
61
|
-
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems,
|
|
62
|
-
prioritySortingFn: options === null || options === void 0 ? void 0 : options.prioritySortingFn,
|
|
63
|
-
itemFilter: item => getActiveQuickInsertCategories(item.category, item.categories).includes('AI')
|
|
64
|
-
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems);
|
|
65
|
-
return matches[0];
|
|
66
|
-
},
|
|
67
51
|
selectItem: (state, item, insert) => {
|
|
68
52
|
const quickInsertItem = item;
|
|
69
53
|
const result = quickInsertItem.action(insert, state);
|
|
@@ -9,7 +9,6 @@ import { useIntl } from 'react-intl';
|
|
|
9
9
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
10
10
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
11
11
|
import { memoProcessQuickInsertItems } from '@atlaskit/editor-common/quick-insert';
|
|
12
|
-
import { getActiveQuickInsertCategories } from '@atlaskit/editor-common/quick-insert/get-active-quick-insert-categories';
|
|
13
12
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
14
13
|
import { TypeAheadAvailableNodes } from '@atlaskit/editor-common/type-ahead';
|
|
15
14
|
import ShowMoreHorizontalIcon from '@atlaskit/icon/core/show-more-horizontal';
|
|
@@ -53,22 +52,6 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
53
52
|
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems);
|
|
54
53
|
return Promise.resolve(items);
|
|
55
54
|
},
|
|
56
|
-
getEmptyItem: function getEmptyItem(_ref3) {
|
|
57
|
-
var editorState = _ref3.editorState;
|
|
58
|
-
if (!isExperimentEnabled('platform_editor_insert_menu_ai')) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
var quickInsertState = pluginKey.getState(editorState);
|
|
62
|
-
var matches = getQuickInsertSuggestions({
|
|
63
|
-
query: '',
|
|
64
|
-
disableDefaultItems: options === null || options === void 0 ? void 0 : options.disableDefaultItems,
|
|
65
|
-
prioritySortingFn: options === null || options === void 0 ? void 0 : options.prioritySortingFn,
|
|
66
|
-
itemFilter: function itemFilter(item) {
|
|
67
|
-
return getActiveQuickInsertCategories(item.category, item.categories).includes('AI');
|
|
68
|
-
}
|
|
69
|
-
}, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.lazyDefaultItems, quickInsertState === null || quickInsertState === void 0 ? void 0 : quickInsertState.providedItems);
|
|
70
|
-
return matches[0];
|
|
71
|
-
},
|
|
72
55
|
selectItem: function selectItem(state, item, insert) {
|
|
73
56
|
var quickInsertItem = item;
|
|
74
57
|
var result = quickInsertItem.action(insert, state);
|
|
@@ -77,8 +60,8 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
77
60
|
}
|
|
78
61
|
return result;
|
|
79
62
|
},
|
|
80
|
-
getMoreOptionsButtonConfig: options !== null && options !== void 0 && options.enableElementBrowser ? function (
|
|
81
|
-
var formatMessage =
|
|
63
|
+
getMoreOptionsButtonConfig: options !== null && options !== void 0 && options.enableElementBrowser ? function (_ref3) {
|
|
64
|
+
var formatMessage = _ref3.formatMessage;
|
|
82
65
|
return {
|
|
83
66
|
title: formatMessage(messages.viewMore),
|
|
84
67
|
ariaLabel: formatMessage(messages.viewMoreAriaLabel),
|
|
@@ -118,8 +101,8 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
118
101
|
}));
|
|
119
102
|
}
|
|
120
103
|
var openElementBrowser = function openElementBrowser(options) {
|
|
121
|
-
return function (
|
|
122
|
-
var tr =
|
|
104
|
+
return function (_ref4) {
|
|
105
|
+
var tr = _ref4.tr;
|
|
123
106
|
if (fg('platform_editor_ease_of_use_metrics')) {
|
|
124
107
|
var _api$metrics;
|
|
125
108
|
api === null || api === void 0 || (_api$metrics = api.metrics) === null || _api$metrics === void 0 || _api$metrics.commands.handleIntentToStartEdit({
|
|
@@ -141,11 +124,11 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
141
124
|
return [{
|
|
142
125
|
name: 'quickInsert',
|
|
143
126
|
// It's important that this plugin is above TypeAheadPlugin
|
|
144
|
-
plugin: function plugin(
|
|
145
|
-
var providerFactory =
|
|
146
|
-
getIntl =
|
|
147
|
-
dispatch =
|
|
148
|
-
dispatchAnalyticsEvent =
|
|
127
|
+
plugin: function plugin(_ref5) {
|
|
128
|
+
var providerFactory = _ref5.providerFactory,
|
|
129
|
+
getIntl = _ref5.getIntl,
|
|
130
|
+
dispatch = _ref5.dispatch,
|
|
131
|
+
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
149
132
|
return quickInsertPluginFactory(isExperimentEnabled('platform_editor_slash_command') ? (defaultItems || []).filter(function (item) {
|
|
150
133
|
return item !== undefined;
|
|
151
134
|
}) : defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, refs, options === null || options === void 0 ? void 0 : options.emptyStateHandler, onInsert, options === null || options === void 0 ? void 0 : options.itemFilter, api);
|
|
@@ -166,10 +149,10 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
166
149
|
pluginsOptions: {
|
|
167
150
|
typeAhead: typeAhead
|
|
168
151
|
},
|
|
169
|
-
contentComponent: function contentComponent(
|
|
170
|
-
var editorView =
|
|
171
|
-
popupsMountPoint =
|
|
172
|
-
wrapperElement =
|
|
152
|
+
contentComponent: function contentComponent(_ref6) {
|
|
153
|
+
var editorView = _ref6.editorView,
|
|
154
|
+
popupsMountPoint = _ref6.popupsMountPoint,
|
|
155
|
+
wrapperElement = _ref6.wrapperElement;
|
|
173
156
|
// using contentComponent to set editorView can cause it to become stale when editor is reconfigured
|
|
174
157
|
// (e.g. page appearance change)
|
|
175
158
|
if (!isExperimentEnabled('platform_editor_block_control_migration')) {
|
|
@@ -222,9 +205,9 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
222
205
|
},
|
|
223
206
|
getSuggestions: function getSuggestions(searchOptions) {
|
|
224
207
|
var _api$quickInsert$shar, _api$quickInsert, _options$prioritySort;
|
|
225
|
-
var
|
|
226
|
-
lazyDefaultItems =
|
|
227
|
-
providedItems =
|
|
208
|
+
var _ref7 = (_api$quickInsert$shar = api === null || api === void 0 || (_api$quickInsert = api.quickInsert) === null || _api$quickInsert === void 0 ? void 0 : _api$quickInsert.sharedState.currentState()) !== null && _api$quickInsert$shar !== void 0 ? _api$quickInsert$shar : {},
|
|
209
|
+
lazyDefaultItems = _ref7.lazyDefaultItems,
|
|
210
|
+
providedItems = _ref7.providedItems;
|
|
228
211
|
searchOptions = _objectSpread(_objectSpread({}, searchOptions), {}, {
|
|
229
212
|
prioritySortingFn: withLayoutQuickInsertPrioritySorting((_options$prioritySort = options === null || options === void 0 ? void 0 : options.prioritySortingFn) !== null && _options$prioritySort !== void 0 ? _options$prioritySort : searchOptions.prioritySortingFn)
|
|
230
213
|
});
|
|
@@ -245,8 +228,8 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
245
228
|
},
|
|
246
229
|
commands: {
|
|
247
230
|
openElementBrowser: openElementBrowser,
|
|
248
|
-
openElementBrowserModal: function openElementBrowserModal(
|
|
249
|
-
var tr =
|
|
231
|
+
openElementBrowserModal: function openElementBrowserModal(_ref8) {
|
|
232
|
+
var tr = _ref8.tr;
|
|
250
233
|
if (fg('platform_editor_ease_of_use_metrics')) {
|
|
251
234
|
var _api$metrics2;
|
|
252
235
|
api === null || api === void 0 || (_api$metrics2 = api.metrics) === null || _api$metrics2 === void 0 || _api$metrics2.commands.handleIntentToStartEdit({
|
|
@@ -261,11 +244,11 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
261
244
|
});
|
|
262
245
|
},
|
|
263
246
|
addQuickInsertItem: function addQuickInsertItem(item) {
|
|
264
|
-
return function (
|
|
247
|
+
return function (_ref9) {
|
|
265
248
|
var _api$quickInsert$shar2, _api$quickInsert2;
|
|
266
|
-
var tr =
|
|
267
|
-
var
|
|
268
|
-
lazyDefaultItems =
|
|
249
|
+
var tr = _ref9.tr;
|
|
250
|
+
var _ref0 = (_api$quickInsert$shar2 = api === null || api === void 0 || (_api$quickInsert2 = api.quickInsert) === null || _api$quickInsert2 === void 0 ? void 0 : _api$quickInsert2.sharedState.currentState()) !== null && _api$quickInsert$shar2 !== void 0 ? _api$quickInsert$shar2 : {},
|
|
251
|
+
lazyDefaultItems = _ref0.lazyDefaultItems;
|
|
269
252
|
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
270
253
|
var memoisedNewItems = memoProcessQuickInsertItems([item], intl);
|
|
271
254
|
return tr.setMeta(pluginKey, {
|
|
@@ -276,12 +259,12 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
276
259
|
};
|
|
277
260
|
},
|
|
278
261
|
updateQuickInsertItem: function updateQuickInsertItem(key, item) {
|
|
279
|
-
return function (
|
|
262
|
+
return function (_ref1) {
|
|
280
263
|
var _api$quickInsert$shar3, _api$quickInsert3;
|
|
281
|
-
var tr =
|
|
282
|
-
var
|
|
283
|
-
providedItems =
|
|
284
|
-
lazyDefaultItems =
|
|
264
|
+
var tr = _ref1.tr;
|
|
265
|
+
var _ref10 = (_api$quickInsert$shar3 = api === null || api === void 0 || (_api$quickInsert3 = api.quickInsert) === null || _api$quickInsert3 === void 0 ? void 0 : _api$quickInsert3.sharedState.currentState()) !== null && _api$quickInsert$shar3 !== void 0 ? _api$quickInsert$shar3 : {},
|
|
266
|
+
providedItems = _ref10.providedItems,
|
|
267
|
+
lazyDefaultItems = _ref10.lazyDefaultItems;
|
|
285
268
|
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
286
269
|
var newItem = memoProcessQuickInsertItems([item], intl);
|
|
287
270
|
var replaceByKey = function replaceByKey(items) {
|
|
@@ -306,12 +289,12 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
|
|
|
306
289
|
};
|
|
307
290
|
},
|
|
308
291
|
removeQuickInsertItem: function removeQuickInsertItem(key) {
|
|
309
|
-
return function (
|
|
292
|
+
return function (_ref11) {
|
|
310
293
|
var _api$quickInsert$shar4, _api$quickInsert4, _providedItems$filter;
|
|
311
|
-
var tr =
|
|
312
|
-
var
|
|
313
|
-
providedItems =
|
|
314
|
-
lazyDefaultItems =
|
|
294
|
+
var tr = _ref11.tr;
|
|
295
|
+
var _ref12 = (_api$quickInsert$shar4 = api === null || api === void 0 || (_api$quickInsert4 = api.quickInsert) === null || _api$quickInsert4 === void 0 ? void 0 : _api$quickInsert4.sharedState.currentState()) !== null && _api$quickInsert$shar4 !== void 0 ? _api$quickInsert$shar4 : {},
|
|
296
|
+
providedItems = _ref12.providedItems,
|
|
297
|
+
lazyDefaultItems = _ref12.lazyDefaultItems;
|
|
315
298
|
var defaultItems = lazyDefaultItems ? lazyDefaultItems() : [];
|
|
316
299
|
return tr.setMeta(pluginKey, {
|
|
317
300
|
providedItems: (_providedItems$filter = providedItems === null || providedItems === void 0 ? void 0 : providedItems.filter(function (item) {
|
|
@@ -382,7 +365,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
382
365
|
var quickInsertItemsAnalyticsScheduler;
|
|
383
366
|
var isDestroyed = false;
|
|
384
367
|
var providerHandler = /*#__PURE__*/function () {
|
|
385
|
-
var
|
|
368
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_name, providerPromise) {
|
|
386
369
|
var provider, providedItems, _api$uiControlRegistr3, directComponents, components, _t, _t2;
|
|
387
370
|
return _regeneratorRuntime.wrap(function (_context) {
|
|
388
371
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -450,7 +433,7 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
|
|
|
450
433
|
}, _callee, null, [[1, 8]]);
|
|
451
434
|
}));
|
|
452
435
|
return function providerHandler(_x, _x2) {
|
|
453
|
-
return
|
|
436
|
+
return _ref13.apply(this, arguments);
|
|
454
437
|
};
|
|
455
438
|
}();
|
|
456
439
|
providerFactory.subscribe('quickInsertProvider', providerHandler);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-quick-insert",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.0",
|
|
4
4
|
"description": "Quick insert plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@atlaskit/button": "^25.4.0",
|
|
30
30
|
"@atlaskit/css": "^1.1.0",
|
|
31
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
32
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
33
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
34
|
-
"@atlaskit/editor-plugin-metrics": "^
|
|
35
|
-
"@atlaskit/editor-plugin-type-ahead": "^
|
|
36
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
31
|
+
"@atlaskit/editor-plugin-analytics": "^25.0.0",
|
|
32
|
+
"@atlaskit/editor-plugin-connectivity": "^25.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^27.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-metrics": "^26.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-type-ahead": "^26.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^19.0.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
38
38
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
39
39
|
"@atlaskit/editor-ui-control-model": "^2.10.0",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
45
45
|
"@atlaskit/primitives": "^22.5.0",
|
|
46
46
|
"@atlaskit/textfield": "^10.2.0",
|
|
47
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^224.0.0",
|
|
48
48
|
"@atlaskit/tokens": "^20.3.0",
|
|
49
49
|
"@atlaskit/tooltip": "^24.4.0",
|
|
50
50
|
"@babel/runtime": "^7.0.0",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"@emotion/react": "^11.7.1"
|
|
53
53
|
},
|
|
54
54
|
"peerDependencies": {
|
|
55
|
-
"@atlaskit/editor-common": "^
|
|
55
|
+
"@atlaskit/editor-common": "^129.0.0",
|
|
56
56
|
"react": "^18.2.0 || ^19.2.0",
|
|
57
57
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
58
58
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|