@atlaskit/editor-plugin-quick-insert 2.0.5 → 2.1.0

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,19 @@
1
1
  # @atlaskit/editor-plugin-quick-insert
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#122563](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/122563)
8
+ [`ee7df79353727`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ee7df79353727) -
9
+ Changes dedupe logic to check title and description instead of just title
10
+
11
+ ## 2.0.6
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 2.0.5
4
18
 
5
19
  ### Patch Changes
@@ -8,6 +8,7 @@ exports.getQuickInsertSuggestions = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
10
10
  var _utils = require("@atlaskit/editor-common/utils");
11
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
12
  var getQuickInsertSuggestions = exports.getQuickInsertSuggestions = function getQuickInsertSuggestions(searchOptions) {
12
13
  var lazyDefaultItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
13
14
  return [];
@@ -21,9 +22,13 @@ var getQuickInsertSuggestions = exports.getQuickInsertSuggestions = function get
21
22
  templateItems = searchOptions.templateItems,
22
23
  prioritySortingFn = searchOptions.prioritySortingFn;
23
24
  var defaultItems = disableDefaultItems ? [] : lazyDefaultItems();
24
- var items = providedItems ? (0, _utils.dedupe)([].concat((0, _toConsumableArray2.default)(defaultItems), (0, _toConsumableArray2.default)(providedItems)), function (item) {
25
+ var dedupeFn = (0, _platformFeatureFlags.fg)('platform_editor_quick_insert_dedupe_title_desc') ? function (item) {
26
+ var _item$description;
27
+ return "".concat(item.title, "-").concat((_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : '');
28
+ } : function (item) {
25
29
  return item.title;
26
- }) : defaultItems;
30
+ };
31
+ var items = providedItems ? (0, _utils.dedupe)([].concat((0, _toConsumableArray2.default)(defaultItems), (0, _toConsumableArray2.default)(providedItems)), dedupeFn) : defaultItems;
27
32
 
28
33
  // For platform_editor_element_level_templates experiment only
29
34
  // clean up ticket ED-24873
@@ -1,5 +1,6 @@
1
1
  import { find } from '@atlaskit/editor-common/quick-insert';
2
2
  import { dedupe } from '@atlaskit/editor-common/utils';
3
+ import { fg } from '@atlaskit/platform-feature-flags';
3
4
  export const getQuickInsertSuggestions = (searchOptions, lazyDefaultItems = () => [], providedItems) => {
4
5
  // @ts-ignore
5
6
  const {
@@ -11,7 +12,11 @@ export const getQuickInsertSuggestions = (searchOptions, lazyDefaultItems = () =
11
12
  prioritySortingFn
12
13
  } = searchOptions;
13
14
  const defaultItems = disableDefaultItems ? [] : lazyDefaultItems();
14
- const items = providedItems ? dedupe([...defaultItems, ...providedItems], item => item.title) : defaultItems;
15
+ const dedupeFn = fg('platform_editor_quick_insert_dedupe_title_desc') ? item => {
16
+ var _item$description;
17
+ return `${item.title}-${(_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : ''}`;
18
+ } : item => item.title;
19
+ const items = providedItems ? dedupe([...defaultItems, ...providedItems], dedupeFn) : defaultItems;
15
20
 
16
21
  // For platform_editor_element_level_templates experiment only
17
22
  // clean up ticket ED-24873
@@ -1,6 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { find } from '@atlaskit/editor-common/quick-insert';
3
3
  import { dedupe } from '@atlaskit/editor-common/utils';
4
+ import { fg } from '@atlaskit/platform-feature-flags';
4
5
  export var getQuickInsertSuggestions = function getQuickInsertSuggestions(searchOptions) {
5
6
  var lazyDefaultItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {
6
7
  return [];
@@ -14,9 +15,13 @@ export var getQuickInsertSuggestions = function getQuickInsertSuggestions(search
14
15
  templateItems = searchOptions.templateItems,
15
16
  prioritySortingFn = searchOptions.prioritySortingFn;
16
17
  var defaultItems = disableDefaultItems ? [] : lazyDefaultItems();
17
- var items = providedItems ? dedupe([].concat(_toConsumableArray(defaultItems), _toConsumableArray(providedItems)), function (item) {
18
+ var dedupeFn = fg('platform_editor_quick_insert_dedupe_title_desc') ? function (item) {
19
+ var _item$description;
20
+ return "".concat(item.title, "-").concat((_item$description = item.description) !== null && _item$description !== void 0 ? _item$description : '');
21
+ } : function (item) {
18
22
  return item.title;
19
- }) : defaultItems;
23
+ };
24
+ var items = providedItems ? dedupe([].concat(_toConsumableArray(defaultItems), _toConsumableArray(providedItems)), dedupeFn) : defaultItems;
20
25
 
21
26
  // For platform_editor_element_level_templates experiment only
22
27
  // clean up ticket ED-24873
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-quick-insert",
3
- "version": "2.0.5",
3
+ "version": "2.1.0",
4
4
  "description": "Quick insert plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -34,12 +34,13 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@atlaskit/button": "^21.1.0",
37
- "@atlaskit/editor-common": "^101.1.0",
37
+ "@atlaskit/editor-common": "^102.0.0",
38
38
  "@atlaskit/editor-plugin-connectivity": "^2.0.0",
39
39
  "@atlaskit/editor-plugin-type-ahead": "^2.1.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/icon": "^24.1.0",
42
42
  "@atlaskit/modal-dialog": "^13.0.0",
43
+ "@atlaskit/platform-feature-flags": "^1.1.0",
43
44
  "@atlaskit/theme": "^18.0.0",
44
45
  "@atlaskit/tmp-editor-statsig": "^3.4.0",
45
46
  "@atlaskit/tokens": "^4.3.0",
@@ -52,9 +53,9 @@
52
53
  "react-intl-next": "npm:react-intl@^5.18.1"
53
54
  },
54
55
  "devDependencies": {
55
- "@af/visual-regression": "*",
56
- "@atlaskit/ssr": "*",
57
- "@atlaskit/visual-regression": "*",
56
+ "@af/visual-regression": "^1.3.0",
57
+ "@atlaskit/ssr": "^0.4.0",
58
+ "@atlaskit/visual-regression": "^0.10.0",
58
59
  "@testing-library/react": "^13.4.0",
59
60
  "typescript": "~5.4.2",
60
61
  "wait-for-expect": "^1.2.0"
@@ -94,5 +95,10 @@
94
95
  "import-no-extraneous-disable-for-examples-and-docs"
95
96
  ]
96
97
  }
98
+ },
99
+ "platform-feature-flags": {
100
+ "platform_editor_quick_insert_dedupe_title_desc": {
101
+ "type": "boolean"
102
+ }
97
103
  }
98
104
  }