@atlaskit/editor-plugin-type-ahead 19.1.0 → 19.1.2

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,31 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 19.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`749f1c3c8359c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/749f1c3c8359c) -
8
+ Retain the first 30 category results and include the first 10 ecosystem quick-insert registrations
9
+ when they fall beyond that cutoff.
10
+
11
+ Limit slash-command insert-menu category browsing while preserving uncapped search results.
12
+
13
+ Classify ecosystem quick-insert provider registrations without changing compatibility keys.
14
+
15
+ Preserve app provenance for Quick Insert items while the `platform_editor_slash_command`
16
+ experiment is enabled.
17
+
18
+ Enable Quick Insert category analytics while the `platform_editor_slash_command` experiment is
19
+ enabled.
20
+
21
+ - Updated dependencies
22
+
23
+ ## 19.1.1
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies
28
+
3
29
  ## 19.1.0
4
30
 
5
31
  ### Minor Changes
@@ -12,6 +12,7 @@ var _runtime = require("@compiled/react/runtime");
12
12
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
13
13
  var _react = _interopRequireWildcard(require("react"));
14
14
  var _reactIntl = require("react-intl");
15
+ var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
15
16
  var _typeAheadSurfaceContext = require("@atlaskit/editor-common/type-ahead-surface-context");
16
17
  var _registeredMenuModel = require("@atlaskit/editor-common/quick-insert/registered-menu-model");
17
18
  var _typeAheadIsSectionOverflowItemKey = require("@atlaskit/editor-common/type-ahead-is-section-overflow-item-key");
@@ -32,7 +33,6 @@ var DEFAULT_MENU_MAX_HEIGHT = 480;
32
33
  var MENU_VERTICAL_PADDING = 8;
33
34
  var MENU_WIDTH = 320;
34
35
  var POPUP_OFFSET = [0, 8];
35
- var SECTION_OVERFLOW_LIMIT = 30;
36
36
  var RegisteredTypeAheadMenu = exports.RegisteredTypeAheadMenu = function RegisteredTypeAheadMenu(_ref) {
37
37
  var anchorElement = _ref.anchorElement,
38
38
  api = _ref.api,
@@ -74,6 +74,7 @@ var RegisteredTypeAheadMenu = exports.RegisteredTypeAheadMenu = function Registe
74
74
  var _api$uiControlRegistr, _api$uiControlRegistr2;
75
75
  return (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(surface.root.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
76
76
  }, [api, surface.root.key]);
77
+ var isSlashCommandEnabled = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_slash_command');
77
78
  var hasSectionOverflowItems = (0, _react.useMemo)(function () {
78
79
  return components.some(function (_ref2) {
79
80
  var key = _ref2.key;
@@ -81,14 +82,14 @@ var RegisteredTypeAheadMenu = exports.RegisteredTypeAheadMenu = function Registe
81
82
  });
82
83
  }, [components]);
83
84
  var menuModel = (0, _react.useMemo)(function () {
84
- return query === '' ? (0, _registeredMenuModel.buildQuickInsertMenuModel)(components, surface.root, hasSectionOverflowItems ? SECTION_OVERFLOW_LIMIT : undefined, surfaceContext) : (0, _registeredMenuModel.getMatchingQuickInsertComponents)({
85
+ return query === '' ? (0, _registeredMenuModel.buildQuickInsertMenuModel)(components, surface.root, hasSectionOverflowItems && isSlashCommandEnabled ? _registeredMenuModel.selectQuickInsertCategoryItems : undefined, surfaceContext) : (0, _registeredMenuModel.getMatchingQuickInsertComponents)({
85
86
  components: components,
86
87
  rootComponent: surface.root,
87
88
  query: query,
88
89
  formatMessage: formatMessage,
89
90
  surfaceContext: surfaceContext
90
91
  });
91
- }, [components, formatMessage, hasSectionOverflowItems, query, surfaceContext, surface.root]);
92
+ }, [components, formatMessage, hasSectionOverflowItems, isSlashCommandEnabled, query, surfaceContext, surface.root]);
92
93
  var rows = (0, _react.useMemo)(function () {
93
94
  return menuModel.sections.flat();
94
95
  }, [menuModel.sections]);
@@ -3,8 +3,9 @@ import "./RegisteredTypeAheadMenu.compiled.css";
3
3
  import { ax, ix } from "@compiled/react/runtime";
4
4
  import React, { useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
5
5
  import { useIntl } from 'react-intl';
6
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
6
7
  import { TYPE_AHEAD_SURFACE_CONTEXT } from '@atlaskit/editor-common/type-ahead-surface-context';
7
- import { buildQuickInsertMenuModel, getMatchingQuickInsertComponents } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
8
+ import { buildQuickInsertMenuModel, getMatchingQuickInsertComponents, selectQuickInsertCategoryItems } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
8
9
  import { isSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-is-section-overflow-item-key';
9
10
  import { Popup } from '@atlaskit/editor-common/ui';
10
11
  import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/create-surface-context';
@@ -22,7 +23,6 @@ const DEFAULT_MENU_MAX_HEIGHT = 480;
22
23
  const MENU_VERTICAL_PADDING = 8;
23
24
  const MENU_WIDTH = 320;
24
25
  const POPUP_OFFSET = [0, 8];
25
- const SECTION_OVERFLOW_LIMIT = 30;
26
26
  export const RegisteredTypeAheadMenu = ({
27
27
  anchorElement,
28
28
  api,
@@ -56,16 +56,17 @@ export const RegisteredTypeAheadMenu = ({
56
56
  var _api$uiControlRegistr, _api$uiControlRegistr2;
57
57
  return (_api$uiControlRegistr = api === null || api === void 0 ? void 0 : (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(surface.root.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
58
58
  }, [api, surface.root.key]);
59
+ const isSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
59
60
  const hasSectionOverflowItems = useMemo(() => components.some(({
60
61
  key
61
62
  }) => isSectionOverflowItemKey(key)), [components]);
62
- const menuModel = useMemo(() => query === '' ? buildQuickInsertMenuModel(components, surface.root, hasSectionOverflowItems ? SECTION_OVERFLOW_LIMIT : undefined, surfaceContext) : getMatchingQuickInsertComponents({
63
+ const menuModel = useMemo(() => query === '' ? buildQuickInsertMenuModel(components, surface.root, hasSectionOverflowItems && isSlashCommandEnabled ? selectQuickInsertCategoryItems : undefined, surfaceContext) : getMatchingQuickInsertComponents({
63
64
  components,
64
65
  rootComponent: surface.root,
65
66
  query,
66
67
  formatMessage,
67
68
  surfaceContext
68
- }), [components, formatMessage, hasSectionOverflowItems, query, surfaceContext, surface.root]);
69
+ }), [components, formatMessage, hasSectionOverflowItems, isSlashCommandEnabled, query, surfaceContext, surface.root]);
69
70
  const rows = useMemo(() => menuModel.sections.flat(), [menuModel.sections]);
70
71
  const selectableRowIndexes = useMemo(() => rows.flatMap((registration, rowIndex) => registration.type === 'menu-item' ? [rowIndex] : []), [rows]);
71
72
  const selectableRowKeys = selectableRowIndexes.map(index => {
@@ -4,8 +4,9 @@ import "./RegisteredTypeAheadMenu.compiled.css";
4
4
  import { ax, ix } from "@compiled/react/runtime";
5
5
  import React, { useCallback, useId, useLayoutEffect, useMemo, useRef, useState } from 'react';
6
6
  import { useIntl } from 'react-intl';
7
+ import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
7
8
  import { TYPE_AHEAD_SURFACE_CONTEXT } from '@atlaskit/editor-common/type-ahead-surface-context';
8
- import { buildQuickInsertMenuModel, getMatchingQuickInsertComponents } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
9
+ import { buildQuickInsertMenuModel, getMatchingQuickInsertComponents, selectQuickInsertCategoryItems } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
9
10
  import { isSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-is-section-overflow-item-key';
10
11
  import { Popup } from '@atlaskit/editor-common/ui';
11
12
  import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/create-surface-context';
@@ -23,7 +24,6 @@ var DEFAULT_MENU_MAX_HEIGHT = 480;
23
24
  var MENU_VERTICAL_PADDING = 8;
24
25
  var MENU_WIDTH = 320;
25
26
  var POPUP_OFFSET = [0, 8];
26
- var SECTION_OVERFLOW_LIMIT = 30;
27
27
  export var RegisteredTypeAheadMenu = function RegisteredTypeAheadMenu(_ref) {
28
28
  var anchorElement = _ref.anchorElement,
29
29
  api = _ref.api,
@@ -65,6 +65,7 @@ export var RegisteredTypeAheadMenu = function RegisteredTypeAheadMenu(_ref) {
65
65
  var _api$uiControlRegistr, _api$uiControlRegistr2;
66
66
  return (_api$uiControlRegistr = api === null || api === void 0 || (_api$uiControlRegistr2 = api.uiControlRegistry) === null || _api$uiControlRegistr2 === void 0 ? void 0 : _api$uiControlRegistr2.actions.getComponents(surface.root.key)) !== null && _api$uiControlRegistr !== void 0 ? _api$uiControlRegistr : [];
67
67
  }, [api, surface.root.key]);
68
+ var isSlashCommandEnabled = isExperimentEnabled('platform_editor_slash_command');
68
69
  var hasSectionOverflowItems = useMemo(function () {
69
70
  return components.some(function (_ref2) {
70
71
  var key = _ref2.key;
@@ -72,14 +73,14 @@ export var RegisteredTypeAheadMenu = function RegisteredTypeAheadMenu(_ref) {
72
73
  });
73
74
  }, [components]);
74
75
  var menuModel = useMemo(function () {
75
- return query === '' ? buildQuickInsertMenuModel(components, surface.root, hasSectionOverflowItems ? SECTION_OVERFLOW_LIMIT : undefined, surfaceContext) : getMatchingQuickInsertComponents({
76
+ return query === '' ? buildQuickInsertMenuModel(components, surface.root, hasSectionOverflowItems && isSlashCommandEnabled ? selectQuickInsertCategoryItems : undefined, surfaceContext) : getMatchingQuickInsertComponents({
76
77
  components: components,
77
78
  rootComponent: surface.root,
78
79
  query: query,
79
80
  formatMessage: formatMessage,
80
81
  surfaceContext: surfaceContext
81
82
  });
82
- }, [components, formatMessage, hasSectionOverflowItems, query, surfaceContext, surface.root]);
83
+ }, [components, formatMessage, hasSectionOverflowItems, isSlashCommandEnabled, query, surfaceContext, surface.root]);
83
84
  var rows = useMemo(function () {
84
85
  return menuModel.sections.flat();
85
86
  }, [menuModel.sections]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "19.1.0",
3
+ "version": "19.1.2",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,14 +36,14 @@
36
36
  "@atlaskit/icon": "^37.7.0",
37
37
  "@atlaskit/insm": "^3.0.0",
38
38
  "@atlaskit/mention": "^29.2.0",
39
- "@atlaskit/menu": "^10.2.0",
39
+ "@atlaskit/menu": "^11.0.0",
40
40
  "@atlaskit/platform-feature-experiments": "^0.3.0",
41
41
  "@atlaskit/platform-feature-flags": "^2.2.0",
42
42
  "@atlaskit/primitives": "^22.5.0",
43
43
  "@atlaskit/prosemirror-history": "^1.2.0",
44
44
  "@atlaskit/prosemirror-input-rules": "^4.1.0",
45
- "@atlaskit/tmp-editor-statsig": "^198.0.0",
46
- "@atlaskit/tokens": "^17.0.0",
45
+ "@atlaskit/tmp-editor-statsig": "^199.0.0",
46
+ "@atlaskit/tokens": "^18.1.0",
47
47
  "@atlaskit/visually-hidden": "^4.4.0",
48
48
  "@babel/runtime": "^7.0.0",
49
49
  "@emotion/react": "^11.7.1",
@@ -54,7 +54,7 @@
54
54
  "w3c-keyname": "^2.1.8"
55
55
  },
56
56
  "peerDependencies": {
57
- "@atlaskit/editor-common": "^122.11.0",
57
+ "@atlaskit/editor-common": "^122.12.0",
58
58
  "react": "^18.2.0 || ^19.2.0",
59
59
  "react-dom": "^18.2.0 || ^19.2.0",
60
60
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"