@atlaskit/editor-plugin-insert-block 19.0.11 → 19.0.12

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,25 @@
1
1
  # @atlaskit/editor-plugin-insert-block
2
2
 
3
+ ## 19.0.12
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
+
3
23
  ## 19.0.11
4
24
 
5
25
  ### Patch Changes
@@ -17,6 +17,7 @@ var _reactIntl = require("react-intl");
17
17
  var _messages = require("@atlaskit/editor-common/messages");
18
18
  var _registeredMenuModel = require("@atlaskit/editor-common/quick-insert/registered-menu-model");
19
19
  var _keys = require("@atlaskit/editor-common/quick-insert/keys");
20
+ var _typeAheadIsSectionOverflowItemKey = require("@atlaskit/editor-common/type-ahead-is-section-overflow-item-key");
20
21
  var _typeAheadSurfaceContext = require("@atlaskit/editor-common/type-ahead-surface-context");
21
22
  var _createSurfaceContext = require("@atlaskit/editor-ui-control-model/create-surface-context");
22
23
  var _compiled = require("@atlaskit/primitives/compiled");
@@ -63,19 +64,25 @@ var RegisteredInsertMenu = exports.RegisteredInsertMenu = function RegisteredIns
63
64
  menuOpenId: menuOpenId
64
65
  });
65
66
  }, [menuOpenId]);
67
+ var hasSectionOverflowItems = (0, _react.useMemo)(function () {
68
+ return components.some(function (_ref2) {
69
+ var key = _ref2.key;
70
+ return (0, _typeAheadIsSectionOverflowItemKey.isSectionOverflowItemKey)(key);
71
+ });
72
+ }, [components]);
66
73
  var model = (0, _react.useMemo)(function () {
67
- return query === '' ? (0, _registeredMenuModel.buildQuickInsertMenuModel)(components, _keys.MENU, undefined, surfaceContext) : (0, _registeredMenuModel.getMatchingQuickInsertComponents)({
74
+ return query === '' ? (0, _registeredMenuModel.buildQuickInsertMenuModel)(components, _keys.MENU, hasSectionOverflowItems ? _registeredMenuModel.selectQuickInsertCategoryItems : undefined, surfaceContext) : (0, _registeredMenuModel.getMatchingQuickInsertComponents)({
68
75
  components: components,
69
76
  formatMessage: formatMessage,
70
77
  query: query,
71
78
  rootComponent: _keys.MENU,
72
79
  surfaceContext: surfaceContext
73
80
  });
74
- }, [components, formatMessage, query, surfaceContext]);
81
+ }, [components, formatMessage, hasSectionOverflowItems, query, surfaceContext]);
75
82
  var itemCount = (0, _react.useMemo)(function () {
76
- return model.sections.reduce(function (count, _ref2) {
77
- var _ref3 = (0, _toArray2.default)(_ref2),
78
- items = _arrayLikeToArray(_ref3).slice(1);
83
+ return model.sections.reduce(function (count, _ref3) {
84
+ var _ref4 = (0, _toArray2.default)(_ref3),
85
+ items = _arrayLikeToArray(_ref4).slice(1);
79
86
  return count + items.length;
80
87
  }, 0) + (model.footer ? 1 : 0);
81
88
  }, [model.footer, model.sections]);
@@ -5,8 +5,9 @@ import React, { useCallback, useId, useMemo, useState } from 'react';
5
5
  import { getDocument } from '@atlaskit/browser-apis';
6
6
  import { useIntl } from 'react-intl';
7
7
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
8
- 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';
9
9
  import { MENU } from '@atlaskit/editor-common/quick-insert/keys';
10
+ import { isSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-is-section-overflow-item-key';
10
11
  import { TYPE_AHEAD_SURFACE_CONTEXT } from '@atlaskit/editor-common/type-ahead-surface-context';
11
12
  import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/create-surface-context';
12
13
  import { Box } from '@atlaskit/primitives/compiled';
@@ -38,13 +39,16 @@ export const RegisteredInsertMenu = ({
38
39
  const surfaceContext = useMemo(() => createSurfaceContext(TYPE_AHEAD_SURFACE_CONTEXT, {
39
40
  menuOpenId
40
41
  }), [menuOpenId]);
41
- const model = useMemo(() => query === '' ? buildQuickInsertMenuModel(components, MENU, undefined, surfaceContext) : getMatchingQuickInsertComponents({
42
+ const hasSectionOverflowItems = useMemo(() => components.some(({
43
+ key
44
+ }) => isSectionOverflowItemKey(key)), [components]);
45
+ const model = useMemo(() => query === '' ? buildQuickInsertMenuModel(components, MENU, hasSectionOverflowItems ? selectQuickInsertCategoryItems : undefined, surfaceContext) : getMatchingQuickInsertComponents({
42
46
  components,
43
47
  formatMessage,
44
48
  query,
45
49
  rootComponent: MENU,
46
50
  surfaceContext
47
- }), [components, formatMessage, query, surfaceContext]);
51
+ }), [components, formatMessage, hasSectionOverflowItems, query, surfaceContext]);
48
52
  const itemCount = useMemo(() => model.sections.reduce((count, [, ...items]) => count + items.length, 0) + (model.footer ? 1 : 0), [model.footer, model.sections]);
49
53
  const isActiveItemMounted = selectedItemIndex >= 0 && selectedItemIndex < itemCount && (selectedItemIndex >= renderedItems.startIndex && selectedItemIndex <= renderedItems.stopIndex || Boolean(model.footer) && selectedItemIndex === itemCount - 1);
50
54
  const activeItemId = `${listId}-${selectedItemIndex}`;
@@ -8,8 +8,9 @@ import React, { useCallback, useId, useMemo, useState } from 'react';
8
8
  import { getDocument } from '@atlaskit/browser-apis';
9
9
  import { useIntl } from 'react-intl';
10
10
  import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
11
- import { buildQuickInsertMenuModel, getMatchingQuickInsertComponents } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
11
+ import { buildQuickInsertMenuModel, getMatchingQuickInsertComponents, selectQuickInsertCategoryItems } from '@atlaskit/editor-common/quick-insert/registered-menu-model';
12
12
  import { MENU } from '@atlaskit/editor-common/quick-insert/keys';
13
+ import { isSectionOverflowItemKey } from '@atlaskit/editor-common/type-ahead-is-section-overflow-item-key';
13
14
  import { TYPE_AHEAD_SURFACE_CONTEXT } from '@atlaskit/editor-common/type-ahead-surface-context';
14
15
  import { createSurfaceContext } from '@atlaskit/editor-ui-control-model/create-surface-context';
15
16
  import { Box } from '@atlaskit/primitives/compiled';
@@ -54,19 +55,25 @@ export var RegisteredInsertMenu = function RegisteredInsertMenu(_ref) {
54
55
  menuOpenId: menuOpenId
55
56
  });
56
57
  }, [menuOpenId]);
58
+ var hasSectionOverflowItems = useMemo(function () {
59
+ return components.some(function (_ref2) {
60
+ var key = _ref2.key;
61
+ return isSectionOverflowItemKey(key);
62
+ });
63
+ }, [components]);
57
64
  var model = useMemo(function () {
58
- return query === '' ? buildQuickInsertMenuModel(components, MENU, undefined, surfaceContext) : getMatchingQuickInsertComponents({
65
+ return query === '' ? buildQuickInsertMenuModel(components, MENU, hasSectionOverflowItems ? selectQuickInsertCategoryItems : undefined, surfaceContext) : getMatchingQuickInsertComponents({
59
66
  components: components,
60
67
  formatMessage: formatMessage,
61
68
  query: query,
62
69
  rootComponent: MENU,
63
70
  surfaceContext: surfaceContext
64
71
  });
65
- }, [components, formatMessage, query, surfaceContext]);
72
+ }, [components, formatMessage, hasSectionOverflowItems, query, surfaceContext]);
66
73
  var itemCount = useMemo(function () {
67
- return model.sections.reduce(function (count, _ref2) {
68
- var _ref3 = _toArray(_ref2),
69
- items = _arrayLikeToArray(_ref3).slice(1);
74
+ return model.sections.reduce(function (count, _ref3) {
75
+ var _ref4 = _toArray(_ref3),
76
+ items = _arrayLikeToArray(_ref4).slice(1);
70
77
  return count + items.length;
71
78
  }, 0) + (model.footer ? 1 : 0);
72
79
  }, [model.footer, model.sections]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-insert-block",
3
- "version": "19.0.11",
3
+ "version": "19.0.12",
4
4
  "description": "Insert block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -63,7 +63,7 @@
63
63
  "@atlaskit/primitives": "^22.5.0",
64
64
  "@atlaskit/textfield": "^10.2.0",
65
65
  "@atlaskit/tmp-editor-statsig": "^199.0.0",
66
- "@atlaskit/tokens": "^18.0.0",
66
+ "@atlaskit/tokens": "^18.1.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@emotion/react": "^11.7.1",
69
69
  "bind-event-listener": "^3.0.0",
@@ -72,7 +72,7 @@
72
72
  "react-virtualized": "^9.22.6"
73
73
  },
74
74
  "peerDependencies": {
75
- "@atlaskit/editor-common": "^122.11.0",
75
+ "@atlaskit/editor-common": "^122.12.0",
76
76
  "react": "^18.2.0 || ^19.2.0",
77
77
  "react-dom": "^18.2.0 || ^19.2.0",
78
78
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"