@atlaskit/editor-plugin-quick-insert 23.0.1 → 24.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @atlaskit/editor-plugin-quick-insert
2
2
 
3
+ ## 24.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 24.0.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`a71ad686528a4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a71ad686528a4) -
14
+ Behind `platform_editor_slash_command`: add `isRecommendedItem` and `maxRecommendedItems` plugin
15
+ options for curating the Recommended section of the `/` menu; provider and extension items are
16
+ matched by their source key.
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 23.0.1
4
23
 
5
24
  ### Patch Changes
@@ -103,7 +103,8 @@ var quickInsertPlugin = exports.quickInsertPlugin = function quickInsertPlugin(_
103
103
  api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register((0, _getQuickInsertComponents.getQuickInsertComponents)({
104
104
  api: api,
105
105
  includeElementBrowserItems: (options === null || options === void 0 ? void 0 : options.enableElementBrowser) === true,
106
- isRecommendedItem: options === null || options === void 0 ? void 0 : options.isRecommendedItem
106
+ isRecommendedItem: options === null || options === void 0 ? void 0 : options.isRecommendedItem,
107
+ maxRecommendedItems: options === null || options === void 0 ? void 0 : options.maxRecommendedItems
107
108
  }));
108
109
  }
109
110
  if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_block_control_migration') && (options === null || options === void 0 ? void 0 : options.blockControlButtonEnabled) !== false) {
@@ -67,10 +67,12 @@ var createSectionComponent = function createSectionComponent(message) {
67
67
  var getQuickInsertComponents = exports.getQuickInsertComponents = function getQuickInsertComponents(_ref2) {
68
68
  var api = _ref2.api,
69
69
  includeElementBrowserItems = _ref2.includeElementBrowserItems,
70
- isRecommendedItem = _ref2.isRecommendedItem;
70
+ isRecommendedItem = _ref2.isRecommendedItem,
71
+ maxRecommendedItems = _ref2.maxRecommendedItems;
71
72
  var recommendedSnapshot = (0, _getRecommendedComponents.createRecommendedSnapshotCache)({
72
73
  api: api,
73
- isRecommendedItem: isRecommendedItem
74
+ isRecommendedItem: isRecommendedItem,
75
+ maxRecommendedItems: maxRecommendedItems
74
76
  });
75
77
  var recommendedSlots = Array.from({
76
78
  length: _getRecommendedComponents.MAX_RECOMMENDED_ITEMS
@@ -3,8 +3,9 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isRecommendedSlotKey = exports.getRecommendedComponents = exports.createRecommendedSnapshotCache = exports.RECOMMENDED_SLOT_KEY_PREFIX = exports.MAX_RECOMMENDED_ITEMS = void 0;
6
+ exports.resolveMaxRecommendedItems = exports.isRecommendedSlotKey = exports.getRecommendedComponents = exports.createRecommendedSnapshotCache = exports.RECOMMENDED_SLOT_KEY_PREFIX = exports.MAX_RECOMMENDED_ITEMS = void 0;
7
7
  var _monitoring = require("@atlaskit/editor-common/monitoring");
8
+ var _getProviderMenuItemKey = require("@atlaskit/editor-common/quick-insert/get-provider-menu-item-key");
8
9
  var _isRecommendedItem = require("@atlaskit/editor-common/quick-insert/is-recommended-item");
9
10
  var _keys = require("@atlaskit/editor-common/quick-insert/keys");
10
11
  var _typeAheadIsMenuFooterSectionKey = require("@atlaskit/editor-common/type-ahead-is-menu-footer-section-key");
@@ -20,20 +21,35 @@ var isRecommendationCandidate = function isRecommendationCandidate(component) {
20
21
  return (0, _typeAheadIsMenuFooterSectionKey.isMenuFooterSectionKey)(parent.key);
21
22
  });
22
23
  };
24
+
25
+ /** Normalises a consumer-supplied limit to the number of available recommended slots. */
26
+ var resolveMaxRecommendedItems = exports.resolveMaxRecommendedItems = function resolveMaxRecommendedItems(maxRecommendedItems) {
27
+ if (maxRecommendedItems === undefined || !Number.isFinite(maxRecommendedItems)) {
28
+ return MAX_RECOMMENDED_ITEMS;
29
+ }
30
+ if (maxRecommendedItems > MAX_RECOMMENDED_ITEMS) {
31
+ void (0, _monitoring.logException)(new Error('Quick Insert maxRecommendedItems exceeds the available slots'), {
32
+ location: 'editor-plugin-quick-insert/getRecommendedComponents'
33
+ });
34
+ }
35
+ return Math.min(Math.max(Math.floor(maxRecommendedItems), 1), MAX_RECOMMENDED_ITEMS);
36
+ };
23
37
  var getRecommendedComponents = exports.getRecommendedComponents = function getRecommendedComponents(_ref) {
24
38
  var components = _ref.components,
25
39
  context = _ref.context,
26
40
  _ref$isRecommendedIte = _ref.isRecommendedItem,
27
- isRecommendedItem = _ref$isRecommendedIte === void 0 ? _isRecommendedItem.defaultIsRecommendedItem : _ref$isRecommendedIte;
41
+ isRecommendedItem = _ref$isRecommendedIte === void 0 ? _isRecommendedItem.defaultIsRecommendedItem : _ref$isRecommendedIte,
42
+ maxRecommendedItems = _ref.maxRecommendedItems;
28
43
  return components.filter(isRecommendationCandidate).flatMap(function (component, index) {
29
44
  var _component$isHidden;
45
+ // Provider items are namespaced in the registry; consumers rank them by their source key.
30
46
  var result = isRecommendedItem({
31
- itemKey: component.key
47
+ itemKey: _getProviderMenuItemKey.quickInsertProviderMenuItemKey.getSourceKey(component.key)
32
48
  });
33
49
  if (result === null) {
34
50
  return [];
35
51
  }
36
- if (Number.isNaN(result)) {
52
+ if (Number.isNaN(result.rank)) {
37
53
  void (0, _monitoring.logException)(new Error('Invalid Quick Insert recommended item rank'), {
38
54
  location: 'editor-plugin-quick-insert/getRecommendedComponents'
39
55
  });
@@ -47,11 +63,11 @@ var getRecommendedComponents = exports.getRecommendedComponents = function getRe
47
63
  return [{
48
64
  component: component,
49
65
  index: index,
50
- rank: result
66
+ rank: result.rank
51
67
  }];
52
68
  }).sort(function (first, second) {
53
69
  return first.rank === second.rank ? first.index - second.index : first.rank - second.rank;
54
- }).slice(0, MAX_RECOMMENDED_ITEMS).map(function (_ref2) {
70
+ }).slice(0, resolveMaxRecommendedItems(maxRecommendedItems)).map(function (_ref2) {
55
71
  var component = _ref2.component;
56
72
  return component;
57
73
  });
@@ -61,7 +77,8 @@ var getRecommendedComponents = exports.getRecommendedComponents = function getRe
61
77
 
62
78
  var createRecommendedSnapshotCache = exports.createRecommendedSnapshotCache = function createRecommendedSnapshotCache(_ref3) {
63
79
  var api = _ref3.api,
64
- isRecommendedItem = _ref3.isRecommendedItem;
80
+ isRecommendedItem = _ref3.isRecommendedItem,
81
+ maxRecommendedItems = _ref3.maxRecommendedItems;
65
82
  var snapshot;
66
83
  var getSnapshot = function getSnapshot(surfaceContext) {
67
84
  var _surfaceContext$get, _snapshot;
@@ -76,7 +93,8 @@ var createRecommendedSnapshotCache = exports.createRecommendedSnapshotCache = fu
76
93
  items: getRecommendedComponents({
77
94
  components: (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(_keys.MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [],
78
95
  context: surfaceContext,
79
- isRecommendedItem: isRecommendedItem
96
+ isRecommendedItem: isRecommendedItem,
97
+ maxRecommendedItems: maxRecommendedItems
80
98
  })
81
99
  };
82
100
  }
@@ -90,7 +90,8 @@ export const quickInsertPlugin = ({
90
90
  api === null || api === void 0 ? void 0 : (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 ? void 0 : _api$uiControlRegistr.actions.register(getQuickInsertComponents({
91
91
  api,
92
92
  includeElementBrowserItems: (options === null || options === void 0 ? void 0 : options.enableElementBrowser) === true,
93
- isRecommendedItem: options === null || options === void 0 ? void 0 : options.isRecommendedItem
93
+ isRecommendedItem: options === null || options === void 0 ? void 0 : options.isRecommendedItem,
94
+ maxRecommendedItems: options === null || options === void 0 ? void 0 : options.maxRecommendedItems
94
95
  }));
95
96
  }
96
97
  if (isExperimentEnabled('platform_editor_block_control_migration') && (options === null || options === void 0 ? void 0 : options.blockControlButtonEnabled) !== false) {
@@ -58,11 +58,13 @@ const createSectionComponent = message => {
58
58
  export const getQuickInsertComponents = ({
59
59
  api,
60
60
  includeElementBrowserItems,
61
- isRecommendedItem
61
+ isRecommendedItem,
62
+ maxRecommendedItems
62
63
  }) => {
63
64
  const recommendedSnapshot = createRecommendedSnapshotCache({
64
65
  api,
65
- isRecommendedItem
66
+ isRecommendedItem,
67
+ maxRecommendedItems
66
68
  });
67
69
  const recommendedSlots = Array.from({
68
70
  length: MAX_RECOMMENDED_ITEMS
@@ -1,4 +1,5 @@
1
1
  import { logException } from '@atlaskit/editor-common/monitoring';
2
+ import { quickInsertProviderMenuItemKey } from '@atlaskit/editor-common/quick-insert/get-provider-menu-item-key';
2
3
  import { defaultIsRecommendedItem } from '@atlaskit/editor-common/quick-insert/is-recommended-item';
3
4
  import { MENU } from '@atlaskit/editor-common/quick-insert/keys';
4
5
  import { isMenuFooterSectionKey } from '@atlaskit/editor-common/type-ahead-is-menu-footer-section-key';
@@ -8,20 +9,35 @@ export const MAX_RECOMMENDED_ITEMS = 5;
8
9
  export const RECOMMENDED_SLOT_KEY_PREFIX = 'quick-insert-recommended-slot-';
9
10
  export const isRecommendedSlotKey = key => key.startsWith(RECOMMENDED_SLOT_KEY_PREFIX);
10
11
  const isRecommendationCandidate = component => component.type === 'menu-item' && !isRecommendedSlotKey(component.key) && !isSectionOverflowItemKey(component.key) && !component.parents.some(parent => isMenuFooterSectionKey(parent.key));
12
+
13
+ /** Normalises a consumer-supplied limit to the number of available recommended slots. */
14
+ export const resolveMaxRecommendedItems = maxRecommendedItems => {
15
+ if (maxRecommendedItems === undefined || !Number.isFinite(maxRecommendedItems)) {
16
+ return MAX_RECOMMENDED_ITEMS;
17
+ }
18
+ if (maxRecommendedItems > MAX_RECOMMENDED_ITEMS) {
19
+ void logException(new Error('Quick Insert maxRecommendedItems exceeds the available slots'), {
20
+ location: 'editor-plugin-quick-insert/getRecommendedComponents'
21
+ });
22
+ }
23
+ return Math.min(Math.max(Math.floor(maxRecommendedItems), 1), MAX_RECOMMENDED_ITEMS);
24
+ };
11
25
  export const getRecommendedComponents = ({
12
26
  components,
13
27
  context,
14
- isRecommendedItem = defaultIsRecommendedItem
28
+ isRecommendedItem = defaultIsRecommendedItem,
29
+ maxRecommendedItems
15
30
  }) => {
16
31
  return components.filter(isRecommendationCandidate).flatMap((component, index) => {
17
32
  var _component$isHidden;
33
+ // Provider items are namespaced in the registry; consumers rank them by their source key.
18
34
  const result = isRecommendedItem({
19
- itemKey: component.key
35
+ itemKey: quickInsertProviderMenuItemKey.getSourceKey(component.key)
20
36
  });
21
37
  if (result === null) {
22
38
  return [];
23
39
  }
24
- if (Number.isNaN(result)) {
40
+ if (Number.isNaN(result.rank)) {
25
41
  void logException(new Error('Invalid Quick Insert recommended item rank'), {
26
42
  location: 'editor-plugin-quick-insert/getRecommendedComponents'
27
43
  });
@@ -35,9 +51,9 @@ export const getRecommendedComponents = ({
35
51
  return [{
36
52
  component,
37
53
  index,
38
- rank: result
54
+ rank: result.rank
39
55
  }];
40
- }).sort((first, second) => first.rank === second.rank ? first.index - second.index : first.rank - second.rank).slice(0, MAX_RECOMMENDED_ITEMS).map(({
56
+ }).sort((first, second) => first.rank === second.rank ? first.index - second.index : first.rank - second.rank).slice(0, resolveMaxRecommendedItems(maxRecommendedItems)).map(({
41
57
  component
42
58
  }) => component);
43
59
  };
@@ -46,7 +62,8 @@ export const getRecommendedComponents = ({
46
62
 
47
63
  export const createRecommendedSnapshotCache = ({
48
64
  api,
49
- isRecommendedItem
65
+ isRecommendedItem,
66
+ maxRecommendedItems
50
67
  }) => {
51
68
  let snapshot;
52
69
  const getSnapshot = surfaceContext => {
@@ -62,7 +79,8 @@ export const createRecommendedSnapshotCache = ({
62
79
  items: getRecommendedComponents({
63
80
  components: (_api$uiControlRegistr = api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [],
64
81
  context: surfaceContext,
65
- isRecommendedItem
82
+ isRecommendedItem,
83
+ maxRecommendedItems
66
84
  })
67
85
  };
68
86
  }
@@ -96,7 +96,8 @@ export var quickInsertPlugin = function quickInsertPlugin(_ref) {
96
96
  api === null || api === void 0 || (_api$uiControlRegistr = api.uiControlRegistry) === null || _api$uiControlRegistr === void 0 || _api$uiControlRegistr.actions.register(getQuickInsertComponents({
97
97
  api: api,
98
98
  includeElementBrowserItems: (options === null || options === void 0 ? void 0 : options.enableElementBrowser) === true,
99
- isRecommendedItem: options === null || options === void 0 ? void 0 : options.isRecommendedItem
99
+ isRecommendedItem: options === null || options === void 0 ? void 0 : options.isRecommendedItem,
100
+ maxRecommendedItems: options === null || options === void 0 ? void 0 : options.maxRecommendedItems
100
101
  }));
101
102
  }
102
103
  if (isExperimentEnabled('platform_editor_block_control_migration') && (options === null || options === void 0 ? void 0 : options.blockControlButtonEnabled) !== false) {
@@ -60,10 +60,12 @@ var createSectionComponent = function createSectionComponent(message) {
60
60
  export var getQuickInsertComponents = function getQuickInsertComponents(_ref2) {
61
61
  var api = _ref2.api,
62
62
  includeElementBrowserItems = _ref2.includeElementBrowserItems,
63
- isRecommendedItem = _ref2.isRecommendedItem;
63
+ isRecommendedItem = _ref2.isRecommendedItem,
64
+ maxRecommendedItems = _ref2.maxRecommendedItems;
64
65
  var recommendedSnapshot = createRecommendedSnapshotCache({
65
66
  api: api,
66
- isRecommendedItem: isRecommendedItem
67
+ isRecommendedItem: isRecommendedItem,
68
+ maxRecommendedItems: maxRecommendedItems
67
69
  });
68
70
  var recommendedSlots = Array.from({
69
71
  length: MAX_RECOMMENDED_ITEMS
@@ -1,4 +1,5 @@
1
1
  import { logException } from '@atlaskit/editor-common/monitoring';
2
+ import { quickInsertProviderMenuItemKey } from '@atlaskit/editor-common/quick-insert/get-provider-menu-item-key';
2
3
  import { defaultIsRecommendedItem } from '@atlaskit/editor-common/quick-insert/is-recommended-item';
3
4
  import { MENU } from '@atlaskit/editor-common/quick-insert/keys';
4
5
  import { isMenuFooterSectionKey } from '@atlaskit/editor-common/type-ahead-is-menu-footer-section-key';
@@ -14,20 +15,35 @@ var isRecommendationCandidate = function isRecommendationCandidate(component) {
14
15
  return isMenuFooterSectionKey(parent.key);
15
16
  });
16
17
  };
18
+
19
+ /** Normalises a consumer-supplied limit to the number of available recommended slots. */
20
+ export var resolveMaxRecommendedItems = function resolveMaxRecommendedItems(maxRecommendedItems) {
21
+ if (maxRecommendedItems === undefined || !Number.isFinite(maxRecommendedItems)) {
22
+ return MAX_RECOMMENDED_ITEMS;
23
+ }
24
+ if (maxRecommendedItems > MAX_RECOMMENDED_ITEMS) {
25
+ void logException(new Error('Quick Insert maxRecommendedItems exceeds the available slots'), {
26
+ location: 'editor-plugin-quick-insert/getRecommendedComponents'
27
+ });
28
+ }
29
+ return Math.min(Math.max(Math.floor(maxRecommendedItems), 1), MAX_RECOMMENDED_ITEMS);
30
+ };
17
31
  export var getRecommendedComponents = function getRecommendedComponents(_ref) {
18
32
  var components = _ref.components,
19
33
  context = _ref.context,
20
34
  _ref$isRecommendedIte = _ref.isRecommendedItem,
21
- isRecommendedItem = _ref$isRecommendedIte === void 0 ? defaultIsRecommendedItem : _ref$isRecommendedIte;
35
+ isRecommendedItem = _ref$isRecommendedIte === void 0 ? defaultIsRecommendedItem : _ref$isRecommendedIte,
36
+ maxRecommendedItems = _ref.maxRecommendedItems;
22
37
  return components.filter(isRecommendationCandidate).flatMap(function (component, index) {
23
38
  var _component$isHidden;
39
+ // Provider items are namespaced in the registry; consumers rank them by their source key.
24
40
  var result = isRecommendedItem({
25
- itemKey: component.key
41
+ itemKey: quickInsertProviderMenuItemKey.getSourceKey(component.key)
26
42
  });
27
43
  if (result === null) {
28
44
  return [];
29
45
  }
30
- if (Number.isNaN(result)) {
46
+ if (Number.isNaN(result.rank)) {
31
47
  void logException(new Error('Invalid Quick Insert recommended item rank'), {
32
48
  location: 'editor-plugin-quick-insert/getRecommendedComponents'
33
49
  });
@@ -41,11 +57,11 @@ export var getRecommendedComponents = function getRecommendedComponents(_ref) {
41
57
  return [{
42
58
  component: component,
43
59
  index: index,
44
- rank: result
60
+ rank: result.rank
45
61
  }];
46
62
  }).sort(function (first, second) {
47
63
  return first.rank === second.rank ? first.index - second.index : first.rank - second.rank;
48
- }).slice(0, MAX_RECOMMENDED_ITEMS).map(function (_ref2) {
64
+ }).slice(0, resolveMaxRecommendedItems(maxRecommendedItems)).map(function (_ref2) {
49
65
  var component = _ref2.component;
50
66
  return component;
51
67
  });
@@ -55,7 +71,8 @@ export var getRecommendedComponents = function getRecommendedComponents(_ref) {
55
71
 
56
72
  export var createRecommendedSnapshotCache = function createRecommendedSnapshotCache(_ref3) {
57
73
  var api = _ref3.api,
58
- isRecommendedItem = _ref3.isRecommendedItem;
74
+ isRecommendedItem = _ref3.isRecommendedItem,
75
+ maxRecommendedItems = _ref3.maxRecommendedItems;
59
76
  var snapshot;
60
77
  var getSnapshot = function getSnapshot(surfaceContext) {
61
78
  var _surfaceContext$get, _snapshot;
@@ -70,7 +87,8 @@ export var createRecommendedSnapshotCache = function createRecommendedSnapshotCa
70
87
  items: getRecommendedComponents({
71
88
  components: (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(MENU.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [],
72
89
  context: surfaceContext,
73
- isRecommendedItem: isRecommendedItem
90
+ isRecommendedItem: isRecommendedItem,
91
+ maxRecommendedItems: maxRecommendedItems
74
92
  })
75
93
  };
76
94
  }
@@ -1,5 +1,6 @@
1
1
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
2
2
  import type { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
3
+ import type { IsRecommendedItem } from '@atlaskit/editor-common/quick-insert/is-recommended-item';
3
4
  import type { Command, QuickInsertPluginOptions as CommonQuickInsertPluginOptions, QuickInsertSharedState as CommonQuickInsertSharedState, EditorCommand, NextEditorPlugin, OptionalPlugin, QuickInsertHandler, QuickInsertSearchOptions, TypeAheadHandler } from '@atlaskit/editor-common/types';
4
5
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
5
6
  import type { ConnectivityPlugin } from '@atlaskit/editor-plugin-connectivity';
@@ -18,6 +19,20 @@ export type QuickInsertPluginOptions = CommonQuickInsertPluginOptions & {
18
19
  * and is only available when `platform_editor_block_control_migration` experiment is enabled.
19
20
  */
20
21
  blockControlButtonEnabled?: boolean;
22
+ /**
23
+ * Selects and ranks the items shown in the Recommended section of the `/` menu.
24
+ * Items that are not registered or are hidden are skipped, so lower-ranked items act as fallbacks.
25
+ * Defaults to `defaultIsRecommendedItem`.
26
+ *
27
+ * Only applies when the `platform_editor_slash_command` experiment is enabled.
28
+ */
29
+ isRecommendedItem?: IsRecommendedItem;
30
+ /**
31
+ * Maximum number of items shown in the Recommended section, between 1 and 5. Defaults to 5.
32
+ *
33
+ * Only applies when the `platform_editor_slash_command` experiment is enabled.
34
+ */
35
+ maxRecommendedItems?: number;
21
36
  };
22
37
  export type OpenElementBrowserOptions = {
23
38
  category?: string;
@@ -6,6 +6,7 @@ type Params = {
6
6
  api: ExtractInjectionAPI<QuickInsertPlugin> | undefined;
7
7
  includeElementBrowserItems: boolean;
8
8
  isRecommendedItem?: IsRecommendedItem;
9
+ maxRecommendedItems?: number;
9
10
  };
10
- export declare const getQuickInsertComponents: <TProps extends CommonComponentProps = CommonComponentProps>({ api, includeElementBrowserItems, isRecommendedItem, }: Params) => RegisterComponent<TProps>[];
11
+ export declare const getQuickInsertComponents: <TProps extends CommonComponentProps = CommonComponentProps>({ api, includeElementBrowserItems, isRecommendedItem, maxRecommendedItems, }: Params) => RegisterComponent<TProps>[];
11
12
  export {};
@@ -5,17 +5,21 @@ import type { QuickInsertPlugin } from '../quickInsertPluginType';
5
5
  export declare const MAX_RECOMMENDED_ITEMS = 5;
6
6
  export declare const RECOMMENDED_SLOT_KEY_PREFIX = "quick-insert-recommended-slot-";
7
7
  export declare const isRecommendedSlotKey: (key: string) => boolean;
8
- export declare const getRecommendedComponents: ({ components, context, isRecommendedItem, }: {
8
+ /** Normalises a consumer-supplied limit to the number of available recommended slots. */
9
+ export declare const resolveMaxRecommendedItems: (maxRecommendedItems?: number) => number;
10
+ export declare const getRecommendedComponents: ({ components, context, isRecommendedItem, maxRecommendedItems, }: {
9
11
  components: RegisterComponent[];
10
12
  context: SurfaceContext;
11
13
  isRecommendedItem?: IsRecommendedItem;
14
+ maxRecommendedItems?: number;
12
15
  }) => RegisterMenuItem[];
13
16
  /** Keeps only the current menu-open recommendation snapshot. */
14
17
  type RecommendedSnapshotCache = {
15
18
  getSnapshot: (surfaceContext?: SurfaceContext) => RegisterMenuItem[];
16
19
  };
17
- export declare const createRecommendedSnapshotCache: ({ api, isRecommendedItem, }: {
20
+ export declare const createRecommendedSnapshotCache: ({ api, isRecommendedItem, maxRecommendedItems, }: {
18
21
  api: ExtractInjectionAPI<QuickInsertPlugin> | undefined;
19
22
  isRecommendedItem?: IsRecommendedItem;
23
+ maxRecommendedItems?: number;
20
24
  }) => RecommendedSnapshotCache;
21
25
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-quick-insert",
3
- "version": "23.0.1",
3
+ "version": "24.0.1",
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": "^23.0.0",
32
- "@atlaskit/editor-plugin-connectivity": "^23.0.0",
33
- "@atlaskit/editor-plugin-editor-viewmode": "^25.0.0",
34
- "@atlaskit/editor-plugin-metrics": "^24.0.0",
35
- "@atlaskit/editor-plugin-type-ahead": "^24.0.0",
36
- "@atlaskit/editor-plugin-ui-control-registry": "^17.0.0",
31
+ "@atlaskit/editor-plugin-analytics": "^24.0.0",
32
+ "@atlaskit/editor-plugin-connectivity": "^24.0.0",
33
+ "@atlaskit/editor-plugin-editor-viewmode": "^26.0.0",
34
+ "@atlaskit/editor-plugin-metrics": "^25.0.0",
35
+ "@atlaskit/editor-plugin-type-ahead": "^25.0.0",
36
+ "@atlaskit/editor-plugin-ui-control-registry": "^18.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": "^220.0.0",
47
+ "@atlaskit/tmp-editor-statsig": "^221.0.0",
48
48
  "@atlaskit/tokens": "^20.1.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": "^127.2.0",
55
+ "@atlaskit/editor-common": "^128.1.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"