@atlaskit/editor-plugin-quick-insert 14.1.0 → 14.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,21 @@
1
1
  # @atlaskit/editor-plugin-quick-insert
2
2
 
3
+ ## 14.1.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 14.1.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`3a4c286fdb8c1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3a4c286fdb8c1) -
14
+ Add registry-backed Quick Insert search matching under the existing
15
+ `platform_editor_slash_command` experiment. Make native, provider, and extension registered Quick
16
+ Insert items searchable.
17
+ - Updated dependencies
18
+
3
19
  ## 14.1.0
4
20
 
5
21
  ### Minor Changes
@@ -8,6 +8,7 @@ exports.getLegacyCompatibleComponents = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
10
  var _react = _interopRequireDefault(require("react"));
11
+ var _createQuickInsertMatcher = require("@atlaskit/editor-common/quick-insert/create-quick-insert-matcher");
11
12
  var _getMenuItemParents = require("@atlaskit/editor-common/quick-insert/get-menu-item-parents");
12
13
  var _getProviderMenuItemKey = require("@atlaskit/editor-common/quick-insert/get-provider-menu-item-key");
13
14
  var _menuItem = require("@atlaskit/editor-common/quick-insert/menu-item");
@@ -62,7 +63,15 @@ var getComponentsFromLegacyItems = function getComponentsFromLegacyItems(items,
62
63
  item: item,
63
64
  onInsert: onInsert
64
65
  });
65
- }
66
+ },
67
+ match: (0, _createQuickInsertMatcher.createQuickInsertMatcher)(function () {
68
+ return {
69
+ description: item.description,
70
+ keywords: item.keywords,
71
+ shortcut: item.keyshortcut,
72
+ title: item.title
73
+ };
74
+ })
66
75
  };
67
76
  });
68
77
  };
@@ -81,6 +90,7 @@ var getLegacyCompatibleComponents = exports.getLegacyCompatibleComponents = func
81
90
  var namespacedDirectComponents = directComponentsWithRenderer.filter(function (component) {
82
91
  return !itemFilter || allowedKeys.has(component.key);
83
92
  }).map(function (component) {
93
+ var _component$match;
84
94
  var item = filteredItems.find(function (candidate, index) {
85
95
  return getItemIdentity(candidate, index) === component.key;
86
96
  });
@@ -92,7 +102,15 @@ var getLegacyCompatibleComponents = exports.getLegacyCompatibleComponents = func
92
102
  return _onInsert(item);
93
103
  }
94
104
  }));
95
- } : component.component
105
+ } : component.component,
106
+ match: (_component$match = component.match) !== null && _component$match !== void 0 ? _component$match : item ? (0, _createQuickInsertMatcher.createQuickInsertMatcher)(function () {
107
+ return {
108
+ description: item.description,
109
+ keywords: item.keywords,
110
+ shortcut: item.keyshortcut,
111
+ title: item.title
112
+ };
113
+ }) : undefined
96
114
  });
97
115
  });
98
116
  var directComponentKeys = new Set(directComponentsWithRenderer.map(function (component) {
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
2
3
  import { getQuickInsertMenuItemParents } from '@atlaskit/editor-common/quick-insert/get-menu-item-parents';
3
4
  import { getQuickInsertProviderMenuItemKey } from '@atlaskit/editor-common/quick-insert/get-provider-menu-item-key';
4
5
  import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
@@ -51,7 +52,13 @@ const getComponentsFromLegacyItems = (items, onInsert) => items.map((item, index
51
52
  component: () => /*#__PURE__*/React.createElement(LegacyQuickInsertProviderMenuItem, {
52
53
  item: item,
53
54
  onInsert: onInsert
54
- })
55
+ }),
56
+ match: createQuickInsertMatcher(() => ({
57
+ description: item.description,
58
+ keywords: item.keywords,
59
+ shortcut: item.keyshortcut,
60
+ title: item.title
61
+ }))
55
62
  };
56
63
  });
57
64
  export const getLegacyCompatibleComponents = ({
@@ -64,6 +71,7 @@ export const getLegacyCompatibleComponents = ({
64
71
  const allowedKeys = new Set(filteredItems.map((item, index) => getItemIdentity(item, index)));
65
72
  const directComponentsWithRenderer = directComponents.filter(component => typeof component.component === 'function');
66
73
  const namespacedDirectComponents = directComponentsWithRenderer.filter(component => !itemFilter || allowedKeys.has(component.key)).map(component => {
74
+ var _component$match;
67
75
  const item = filteredItems.find((candidate, index) => getItemIdentity(candidate, index) === component.key);
68
76
  return {
69
77
  ...component,
@@ -71,7 +79,13 @@ export const getLegacyCompatibleComponents = ({
71
79
  component: item ? props => component.component({
72
80
  ...props,
73
81
  onInsert: () => onInsert(item)
74
- }) : component.component
82
+ }) : component.component,
83
+ match: (_component$match = component.match) !== null && _component$match !== void 0 ? _component$match : item ? createQuickInsertMatcher(() => ({
84
+ description: item.description,
85
+ keywords: item.keywords,
86
+ shortcut: item.keyshortcut,
87
+ title: item.title
88
+ })) : undefined
75
89
  };
76
90
  });
77
91
  const directComponentKeys = new Set(directComponentsWithRenderer.map(component => component.key));
@@ -3,6 +3,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
3
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
4
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
5
  import React from 'react';
6
+ import { createQuickInsertMatcher } from '@atlaskit/editor-common/quick-insert/create-quick-insert-matcher';
6
7
  import { getQuickInsertMenuItemParents } from '@atlaskit/editor-common/quick-insert/get-menu-item-parents';
7
8
  import { getQuickInsertProviderMenuItemKey } from '@atlaskit/editor-common/quick-insert/get-provider-menu-item-key';
8
9
  import { QuickInsertMenuItem } from '@atlaskit/editor-common/quick-insert/menu-item';
@@ -55,7 +56,15 @@ var getComponentsFromLegacyItems = function getComponentsFromLegacyItems(items,
55
56
  item: item,
56
57
  onInsert: onInsert
57
58
  });
58
- }
59
+ },
60
+ match: createQuickInsertMatcher(function () {
61
+ return {
62
+ description: item.description,
63
+ keywords: item.keywords,
64
+ shortcut: item.keyshortcut,
65
+ title: item.title
66
+ };
67
+ })
59
68
  };
60
69
  });
61
70
  };
@@ -74,6 +83,7 @@ export var getLegacyCompatibleComponents = function getLegacyCompatibleComponent
74
83
  var namespacedDirectComponents = directComponentsWithRenderer.filter(function (component) {
75
84
  return !itemFilter || allowedKeys.has(component.key);
76
85
  }).map(function (component) {
86
+ var _component$match;
77
87
  var item = filteredItems.find(function (candidate, index) {
78
88
  return getItemIdentity(candidate, index) === component.key;
79
89
  });
@@ -85,7 +95,15 @@ export var getLegacyCompatibleComponents = function getLegacyCompatibleComponent
85
95
  return _onInsert(item);
86
96
  }
87
97
  }));
88
- } : component.component
98
+ } : component.component,
99
+ match: (_component$match = component.match) !== null && _component$match !== void 0 ? _component$match : item ? createQuickInsertMatcher(function () {
100
+ return {
101
+ description: item.description,
102
+ keywords: item.keywords,
103
+ shortcut: item.keyshortcut,
104
+ title: item.title
105
+ };
106
+ }) : undefined
89
107
  });
90
108
  });
91
109
  var directComponentKeys = new Set(directComponentsWithRenderer.map(function (component) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-quick-insert",
3
- "version": "14.1.0",
3
+ "version": "14.1.2",
4
4
  "description": "Quick insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,18 +28,18 @@
28
28
  "@atlaskit/editor-plugin-type-ahead": "^15.1.0",
29
29
  "@atlaskit/editor-plugin-ui-control-registry": "^8.1.0",
30
30
  "@atlaskit/editor-prosemirror": "^8.0.0",
31
- "@atlaskit/editor-ui-control-model": "^2.5.0",
31
+ "@atlaskit/editor-ui-control-model": "^2.6.0",
32
32
  "@atlaskit/icon": "^37.3.0",
33
33
  "@atlaskit/modal-dialog": "^16.3.0",
34
34
  "@atlaskit/platform-feature-experiments": "^0.3.0",
35
35
  "@atlaskit/platform-feature-flags": "^2.1.0",
36
- "@atlaskit/tmp-editor-statsig": "^146.0.0",
37
- "@atlaskit/tokens": "^16.6.0",
36
+ "@atlaskit/tmp-editor-statsig": "^147.0.0",
37
+ "@atlaskit/tokens": "^16.7.0",
38
38
  "@babel/runtime": "^7.0.0",
39
39
  "@emotion/react": "^11.7.1"
40
40
  },
41
41
  "peerDependencies": {
42
- "@atlaskit/editor-common": "^118.8.0",
42
+ "@atlaskit/editor-common": "^118.10.0",
43
43
  "react": "^18.2.0 || ^19.2.0",
44
44
  "react-dom": "^18.2.0 || ^19.2.0",
45
45
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"