@atlaskit/editor-plugin-quick-insert 19.0.3 → 19.0.5

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-quick-insert
2
2
 
3
+ ## 19.0.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [`89497a944a054`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/89497a944a054) -
8
+ Keep the block control Quick Insert button available after editor appearance changes behind
9
+ `platform_editor_block_control_migration`.
10
+ - Updated dependencies
11
+
12
+ ## 19.0.4
13
+
14
+ ### Patch Changes
15
+
16
+ - [`50f3c586dbc63`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/50f3c586dbc63) -
17
+ Clean up feature gate `platform_editor_fix_space_triggering_ai`
18
+ - Updated dependencies
19
+
3
20
  ## 19.0.3
4
21
 
5
22
  ### Patch Changes
@@ -155,7 +155,7 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
155
155
  dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent;
156
156
  return quickInsertPluginFactory((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command') ? (defaultItems || []).filter(function (item) {
157
157
  return item !== undefined;
158
- }) : defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, options === null || options === void 0 ? void 0 : options.emptyStateHandler, onInsert, options === null || options === void 0 ? void 0 : options.itemFilter, api);
158
+ }) : 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);
159
159
  }
160
160
  }, {
161
161
  name: 'quickInsertOpenExperience',
@@ -177,7 +177,11 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
177
177
  var editorView = _ref7.editorView,
178
178
  popupsMountPoint = _ref7.popupsMountPoint,
179
179
  wrapperElement = _ref7.wrapperElement;
180
- refs.editorView = editorView || undefined;
180
+ // using contentComponent to set editorView can cause it to become stale when editor is reconfigured
181
+ // (e.g. page appearance change)
182
+ if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
183
+ refs.editorView = editorView || undefined;
184
+ }
181
185
  refs.popupsMountPoint = popupsMountPoint || undefined;
182
186
  refs.wrapperElement = wrapperElement || undefined;
183
187
  if (!editorView || (0, _coreUtils.isSSR)()) {
@@ -342,10 +346,10 @@ var setProviderState = function setProviderState(providerState) {
342
346
  return true;
343
347
  };
344
348
  };
345
- function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, emptyStateHandler) {
346
- var onInsert = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
347
- var itemFilter = arguments.length > 7 ? arguments[7] : undefined;
348
- var api = arguments.length > 8 ? arguments[8] : undefined;
349
+ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, refs, emptyStateHandler) {
350
+ var onInsert = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : function () {};
351
+ var itemFilter = arguments.length > 8 ? arguments[8] : undefined;
352
+ var api = arguments.length > 9 ? arguments[9] : undefined;
349
353
  return new _safePlugin.SafePlugin({
350
354
  key: _pluginKey.pluginKey,
351
355
  state: {
@@ -379,6 +383,9 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
379
383
  }
380
384
  },
381
385
  view: function view(editorView) {
386
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration')) {
387
+ refs.editorView = editorView;
388
+ }
382
389
  var quickInsertItemsAnalyticsScheduler;
383
390
  var isDestroyed = false;
384
391
  var providerHandler = /*#__PURE__*/function () {
@@ -457,6 +464,9 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
457
464
  return {
458
465
  destroy: function destroy() {
459
466
  var _quickInsertItemsAnal;
467
+ if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && refs.editorView === editorView) {
468
+ refs.editorView = undefined;
469
+ }
460
470
  isDestroyed = true;
461
471
  (_quickInsertItemsAnal = quickInsertItemsAnalyticsScheduler) === null || _quickInsertItemsAnal === void 0 || _quickInsertItemsAnal.destroy();
462
472
  providerFactory.unsubscribe('quickInsertProvider', providerHandler);
@@ -9,7 +9,6 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
9
9
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
10
10
  var _getActiveQuickInsertCategories = require("@atlaskit/editor-common/quick-insert/get-active-quick-insert-categories");
11
11
  var _utils = require("@atlaskit/editor-common/utils");
12
- var _fg = require("@atlaskit/platform-feature-flags/fg");
13
12
  var isRegisteredLayoutQuickInsertItem = function isRegisteredLayoutQuickInsertItem(item) {
14
13
  var _item$keywords, _item$keywords2;
15
14
  return Boolean(item.id && item.id !== 'layout' && ((_item$keywords = item.keywords) === null || _item$keywords === void 0 ? void 0 : _item$keywords.includes('layout')) && ((_item$keywords2 = item.keywords) === null || _item$keywords2 === void 0 ? void 0 : _item$keywords2.includes('column')));
@@ -74,7 +73,7 @@ var getQuickInsertSuggestions = exports.getQuickInsertSuggestions = function get
74
73
  return item.featured;
75
74
  });
76
75
  }
77
- return (0, _quickInsert.find)(((0, _fg.fg)('platform_editor_fix_space_triggering_ai') ? query === null || query === void 0 ? void 0 : query.trimEnd() : query) || '', category === 'all' || !category ? items : items.filter(function (item) {
76
+ return (0, _quickInsert.find)((query === null || query === void 0 ? void 0 : query.trimEnd()) || '', category === 'all' || !category ? items : items.filter(function (item) {
78
77
  return (0, _getActiveQuickInsertCategories.getActiveQuickInsertCategories)(item.category, item.categories).includes(category);
79
78
  }), prioritySortingFn);
80
79
  };
@@ -137,7 +137,7 @@ export const quickInsertPlugin = ({
137
137
  getIntl,
138
138
  dispatch,
139
139
  dispatchAnalyticsEvent
140
- }) => quickInsertPluginFactory(isExperimentEnabled('platform_editor_slash_command') ? (defaultItems || []).filter(item => item !== undefined) : defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, options === null || options === void 0 ? void 0 : options.emptyStateHandler, onInsert, options === null || options === void 0 ? void 0 : options.itemFilter, api)
140
+ }) => quickInsertPluginFactory(isExperimentEnabled('platform_editor_slash_command') ? (defaultItems || []).filter(item => item !== undefined) : 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)
141
141
  }, {
142
142
  name: 'quickInsertOpenExperience',
143
143
  plugin: () => getQuickInsertOpenExperiencePlugin({
@@ -157,7 +157,11 @@ export const quickInsertPlugin = ({
157
157
  popupsMountPoint,
158
158
  wrapperElement
159
159
  }) {
160
- refs.editorView = editorView || undefined;
160
+ // using contentComponent to set editorView can cause it to become stale when editor is reconfigured
161
+ // (e.g. page appearance change)
162
+ if (!isExperimentEnabled('platform_editor_block_control_migration')) {
163
+ refs.editorView = editorView || undefined;
164
+ }
161
165
  refs.popupsMountPoint = popupsMountPoint || undefined;
162
166
  refs.wrapperElement = wrapperElement || undefined;
163
167
  if (!editorView || isSSR()) {
@@ -304,7 +308,7 @@ const setProviderState = providerState => (state, dispatch) => {
304
308
  }
305
309
  return true;
306
310
  };
307
- function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, emptyStateHandler, onInsert = () => {}, itemFilter, api) {
311
+ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, refs, emptyStateHandler, onInsert = () => {}, itemFilter, api) {
308
312
  return new SafePlugin({
309
313
  key: pluginKey,
310
314
  state: {
@@ -339,6 +343,9 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
339
343
  }
340
344
  },
341
345
  view(editorView) {
346
+ if (isExperimentEnabled('platform_editor_block_control_migration')) {
347
+ refs.editorView = editorView;
348
+ }
342
349
  let quickInsertItemsAnalyticsScheduler;
343
350
  let isDestroyed = false;
344
351
  const providerHandler = async (_name, providerPromise) => {
@@ -377,6 +384,9 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
377
384
  return {
378
385
  destroy() {
379
386
  var _quickInsertItemsAnal;
387
+ if (isExperimentEnabled('platform_editor_block_control_migration') && refs.editorView === editorView) {
388
+ refs.editorView = undefined;
389
+ }
380
390
  isDestroyed = true;
381
391
  (_quickInsertItemsAnal = quickInsertItemsAnalyticsScheduler) === null || _quickInsertItemsAnal === void 0 ? void 0 : _quickInsertItemsAnal.destroy();
382
392
  providerFactory.unsubscribe('quickInsertProvider', providerHandler);
@@ -1,7 +1,6 @@
1
1
  import { find } from '@atlaskit/editor-common/quick-insert';
2
2
  import { getActiveQuickInsertCategories } from '@atlaskit/editor-common/quick-insert/get-active-quick-insert-categories';
3
3
  import { dedupe } from '@atlaskit/editor-common/utils';
4
- import { fg } from '@atlaskit/platform-feature-flags/fg';
5
4
  const isRegisteredLayoutQuickInsertItem = item => {
6
5
  var _item$keywords, _item$keywords2;
7
6
  return Boolean(item.id && item.id !== 'layout' && ((_item$keywords = item.keywords) === null || _item$keywords === void 0 ? void 0 : _item$keywords.includes('layout')) && ((_item$keywords2 = item.keywords) === null || _item$keywords2 === void 0 ? void 0 : _item$keywords2.includes('column')));
@@ -56,5 +55,5 @@ export const getQuickInsertSuggestions = (searchOptions, lazyDefaultItems = () =
56
55
  if (featuredItems) {
57
56
  return items.filter(item => item.featured);
58
57
  }
59
- return find((fg('platform_editor_fix_space_triggering_ai') ? query === null || query === void 0 ? void 0 : query.trimEnd() : query) || '', category === 'all' || !category ? items : items.filter(item => getActiveQuickInsertCategories(item.category, item.categories).includes(category)), prioritySortingFn);
58
+ return find((query === null || query === void 0 ? void 0 : query.trimEnd()) || '', category === 'all' || !category ? items : items.filter(item => getActiveQuickInsertCategories(item.category, item.categories).includes(category)), prioritySortingFn);
60
59
  };
@@ -148,7 +148,7 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
148
148
  dispatchAnalyticsEvent = _ref6.dispatchAnalyticsEvent;
149
149
  return quickInsertPluginFactory(isExperimentEnabled('platform_editor_slash_command') ? (defaultItems || []).filter(function (item) {
150
150
  return item !== undefined;
151
- }) : defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, options === null || options === void 0 ? void 0 : options.emptyStateHandler, onInsert, options === null || options === void 0 ? void 0 : options.itemFilter, api);
151
+ }) : 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);
152
152
  }
153
153
  }, {
154
154
  name: 'quickInsertOpenExperience',
@@ -170,7 +170,11 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
170
170
  var editorView = _ref7.editorView,
171
171
  popupsMountPoint = _ref7.popupsMountPoint,
172
172
  wrapperElement = _ref7.wrapperElement;
173
- refs.editorView = editorView || undefined;
173
+ // using contentComponent to set editorView can cause it to become stale when editor is reconfigured
174
+ // (e.g. page appearance change)
175
+ if (!isExperimentEnabled('platform_editor_block_control_migration')) {
176
+ refs.editorView = editorView || undefined;
177
+ }
174
178
  refs.popupsMountPoint = popupsMountPoint || undefined;
175
179
  refs.wrapperElement = wrapperElement || undefined;
176
180
  if (!editorView || isSSR()) {
@@ -335,10 +339,10 @@ var setProviderState = function setProviderState(providerState) {
335
339
  return true;
336
340
  };
337
341
  };
338
- function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, emptyStateHandler) {
339
- var onInsert = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : function () {};
340
- var itemFilter = arguments.length > 7 ? arguments[7] : undefined;
341
- var api = arguments.length > 8 ? arguments[8] : undefined;
342
+ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispatch, dispatchAnalyticsEvent, refs, emptyStateHandler) {
343
+ var onInsert = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : function () {};
344
+ var itemFilter = arguments.length > 8 ? arguments[8] : undefined;
345
+ var api = arguments.length > 9 ? arguments[9] : undefined;
342
346
  return new SafePlugin({
343
347
  key: pluginKey,
344
348
  state: {
@@ -372,6 +376,9 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
372
376
  }
373
377
  },
374
378
  view: function view(editorView) {
379
+ if (isExperimentEnabled('platform_editor_block_control_migration')) {
380
+ refs.editorView = editorView;
381
+ }
375
382
  var quickInsertItemsAnalyticsScheduler;
376
383
  var isDestroyed = false;
377
384
  var providerHandler = /*#__PURE__*/function () {
@@ -450,6 +457,9 @@ function quickInsertPluginFactory(defaultItems, providerFactory, getIntl, dispat
450
457
  return {
451
458
  destroy: function destroy() {
452
459
  var _quickInsertItemsAnal;
460
+ if (isExperimentEnabled('platform_editor_block_control_migration') && refs.editorView === editorView) {
461
+ refs.editorView = undefined;
462
+ }
453
463
  isDestroyed = true;
454
464
  (_quickInsertItemsAnal = quickInsertItemsAnalyticsScheduler) === null || _quickInsertItemsAnal === void 0 || _quickInsertItemsAnal.destroy();
455
465
  providerFactory.unsubscribe('quickInsertProvider', providerHandler);
@@ -2,7 +2,6 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { find } from '@atlaskit/editor-common/quick-insert';
3
3
  import { getActiveQuickInsertCategories } from '@atlaskit/editor-common/quick-insert/get-active-quick-insert-categories';
4
4
  import { dedupe } from '@atlaskit/editor-common/utils';
5
- import { fg } from '@atlaskit/platform-feature-flags/fg';
6
5
  var isRegisteredLayoutQuickInsertItem = function isRegisteredLayoutQuickInsertItem(item) {
7
6
  var _item$keywords, _item$keywords2;
8
7
  return Boolean(item.id && item.id !== 'layout' && ((_item$keywords = item.keywords) === null || _item$keywords === void 0 ? void 0 : _item$keywords.includes('layout')) && ((_item$keywords2 = item.keywords) === null || _item$keywords2 === void 0 ? void 0 : _item$keywords2.includes('column')));
@@ -67,7 +66,7 @@ export var getQuickInsertSuggestions = function getQuickInsertSuggestions(search
67
66
  return item.featured;
68
67
  });
69
68
  }
70
- return find((fg('platform_editor_fix_space_triggering_ai') ? query === null || query === void 0 ? void 0 : query.trimEnd() : query) || '', category === 'all' || !category ? items : items.filter(function (item) {
69
+ return find((query === null || query === void 0 ? void 0 : query.trimEnd()) || '', category === 'all' || !category ? items : items.filter(function (item) {
71
70
  return getActiveQuickInsertCategories(item.category, item.categories).includes(category);
72
71
  }), prioritySortingFn);
73
72
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-quick-insert",
3
- "version": "19.0.3",
3
+ "version": "19.0.5",
4
4
  "description": "Quick insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -51,7 +51,7 @@
51
51
  "@emotion/react": "^11.7.1"
52
52
  },
53
53
  "peerDependencies": {
54
- "@atlaskit/editor-common": "^123.3.0",
54
+ "@atlaskit/editor-common": "^123.4.0",
55
55
  "react": "^18.2.0 || ^19.2.0",
56
56
  "react-dom": "^18.2.0 || ^19.2.0",
57
57
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
@@ -68,9 +68,6 @@
68
68
  "platform_editor_ease_of_use_metrics": {
69
69
  "type": "boolean"
70
70
  },
71
- "platform_editor_fix_space_triggering_ai": {
72
- "type": "boolean"
73
- },
74
71
  "platform_dst_modal-dialog-use-modal-title": {
75
72
  "type": "boolean",
76
73
  "referenceOnly": true