@atlaskit/editor-common 116.4.0 → 116.5.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,31 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 116.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`8222a13990fce`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8222a13990fce) -
8
+ Add a `templateType` field (`atlassian` | `user`) to snippets so consumers can distinguish
9
+ Atlassian out-of-the-box templates from user-created ones. The value is populated from the backend
10
+ when provided, and otherwise derived from the snippet scope, and is reported on snippet insert
11
+ analytics events. This behaviour is gated behind the `platform_editor_blocks_patch_2` feature
12
+ gate; when the gate is disabled `templateType` is left undefined and is not emitted.
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
18
+ ## 116.4.1
19
+
20
+ ### Patch Changes
21
+
22
+ - [`6f7b6c498b07c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6f7b6c498b07c) -
23
+ [EDITOR-7591] Align the no-color highlight palette tile icon with the updated transparent
24
+ highlight styling for the experiment `platform_editor_lovability_text_bg_color`.
25
+ - [`301be34250b01`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/301be34250b01) -
26
+ [ux] added order fix so native elements are prioritised over skills (eg /code)
27
+ - Updated dependencies
28
+
3
29
  ## 116.4.0
4
30
 
5
31
  ### Minor Changes
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
28
28
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
29
29
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
30
30
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
31
- var packageVersion = "116.3.2";
31
+ var packageVersion = "116.4.1";
32
32
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
33
33
  // Remove URL as it has UGC
34
34
  // Ignored via go/ees007
@@ -0,0 +1,52 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.boostNativeResultsAboveSkills = boostNativeResultsAboveSkills;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ // Items with priority >= this threshold are treated as extension-provided
10
+ // items (e.g. Rovo skills) and demoted below native editor elements.
11
+ // Coupled with priority: 9000 set in
12
+ // platform/packages/ai-mate/rovo-skills/src/services/insert-menu-provider/extension-manifest.tsx
13
+ var SKILL_PRIORITY_THRESHOLD = 1000;
14
+ var SCORE_PROXIMITY_THRESHOLD = 0.2;
15
+
16
+ /**
17
+ * Promotes native editor elements above extension-provided items (e.g. Rovo
18
+ * skills) in search results when their Fuse scores are close.
19
+ *
20
+ * Skills set a high priority value (e.g. 9000) while native items have no
21
+ * priority (undefined / 0). When a skill and a native item have similar scores
22
+ * (within the proximity threshold), the native item is promoted above the
23
+ * skill. But when a skill is a significantly better match (e.g. searching
24
+ * "research" and the skill is "Research Insights" while the native item is
25
+ * "Live search"), the skill keeps its higher rank.
26
+ */
27
+ function boostNativeResultsAboveSkills(results) {
28
+ var isSkill = function isSkill(r) {
29
+ var _r$item$priority;
30
+ return ((_r$item$priority = r.item.priority) !== null && _r$item$priority !== void 0 ? _r$item$priority : 0) >= SKILL_PRIORITY_THRESHOLD;
31
+ };
32
+ var reordered = results.slice(0);
33
+ for (var i = 1; i < reordered.length; i++) {
34
+ if (isSkill(reordered[i])) {
35
+ continue;
36
+ }
37
+ // reordered[i] is a native item — check if there are skills
38
+ // ranked above it that have a similar score.
39
+ var insertAt = i;
40
+ while (insertAt > 0 && isSkill(reordered[insertAt - 1]) && Math.abs(((_reordered$score = reordered[insertAt - 1].score) !== null && _reordered$score !== void 0 ? _reordered$score : 0) - ((_reordered$i$score = reordered[i].score) !== null && _reordered$i$score !== void 0 ? _reordered$i$score : 0)) < SCORE_PROXIMITY_THRESHOLD) {
41
+ var _reordered$score, _reordered$i$score;
42
+ insertAt--;
43
+ }
44
+ if (insertAt < i) {
45
+ var _reordered$splice = reordered.splice(i, 1),
46
+ _reordered$splice2 = (0, _slicedToArray2.default)(_reordered$splice, 1),
47
+ native = _reordered$splice2[0];
48
+ reordered.splice(insertAt, 0, native);
49
+ }
50
+ }
51
+ return reordered;
52
+ }
@@ -11,6 +11,8 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
11
11
  var _fuse = _interopRequireDefault(require("fuse.js"));
12
12
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
13
13
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
14
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
15
+ var _boostNativeResultsAboveSkills = require("./boost-native-results-above-skills");
14
16
  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; }
15
17
  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) { (0, _defineProperty2.default)(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; }
16
18
  var processQuickInsertItems = function processQuickInsertItems(items, intl) {
@@ -60,9 +62,9 @@ var options = {
60
62
  * This function is used to find and sort QuickInsertItems based on a given query string.
61
63
  *
62
64
  * @export
63
- * @param {string} query - The query string to be used in the search.
64
- * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
65
- * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
65
+ * @param query - The query string to be used in the search.
66
+ * @param items - An array of QuickInsertItems to be searched.
67
+ * @returns Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
66
68
  */
67
69
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
68
70
  function find(query, items, prioritySortingFn) {
@@ -83,28 +85,31 @@ function find(query, items, prioritySortingFn) {
83
85
  }
84
86
  var fuse = new _fuse.default(items, fuseOptions);
85
87
  var results = fuse.search(query);
88
+
89
+ // platform_editor_insert_menu_ai: boost native editor elements above skills
90
+ var rerankedResults = (0, _expValEquals.expValEquals)('platform_editor_insert_menu_ai', 'isEnabled', true) ? (0, _boostNativeResultsAboveSkills.boostNativeResultsAboveSkills)(results) : results;
86
91
  if ((0, _platformFeatureFlags.fg)('jim-lower-ranking-in-jira-macro-search')) {
87
- var _results$datasourceIn, _results$legacyIndex$;
92
+ var _rerankedResults$data, _rerankedResults$lega;
88
93
  // searching for jira work items macro first
89
- var datasourceIndex = results.findIndex(function (r) {
94
+ var datasourceIndex = rerankedResults.findIndex(function (r) {
90
95
  var _r$item$keywords;
91
96
  return r.item.id === 'datasource' && ((_r$item$keywords = r.item.keywords) === null || _r$item$keywords === void 0 ? void 0 : _r$item$keywords.includes('jira'));
92
97
  });
93
98
 
94
99
  // then searching for the legacy jira macro
95
- var legacyIndex = results.findIndex(function (r) {
100
+ var legacyIndex = rerankedResults.findIndex(function (r) {
96
101
  return typeof r.item.key === 'string' && r.item.key.endsWith(':jira');
97
102
  });
98
103
 
99
104
  // the jira legcy macro is found before the jira work items macro then swap the two
100
- if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_results$datasourceIn = results[datasourceIndex].score) !== null && _results$datasourceIn !== void 0 ? _results$datasourceIn : 0) - ((_results$legacyIndex$ = results[legacyIndex].score) !== null && _results$legacyIndex$ !== void 0 ? _results$legacyIndex$ : 0)) < 0.2) {
101
- var _results$splice = results.splice(datasourceIndex, 1),
102
- _results$splice2 = (0, _slicedToArray2.default)(_results$splice, 1),
103
- datasource = _results$splice2[0];
104
- results.splice(legacyIndex, 0, datasource);
105
+ if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_rerankedResults$data = rerankedResults[datasourceIndex].score) !== null && _rerankedResults$data !== void 0 ? _rerankedResults$data : 0) - ((_rerankedResults$lega = rerankedResults[legacyIndex].score) !== null && _rerankedResults$lega !== void 0 ? _rerankedResults$lega : 0)) < 0.2) {
106
+ var _rerankedResults$spli = rerankedResults.splice(datasourceIndex, 1),
107
+ _rerankedResults$spli2 = (0, _slicedToArray2.default)(_rerankedResults$spli, 1),
108
+ datasource = _rerankedResults$spli2[0];
109
+ rerankedResults.splice(legacyIndex, 0, datasource);
105
110
  }
106
111
  }
107
- return results.map(function (result) {
112
+ return rerankedResults.map(function (result) {
108
113
  return result.item;
109
114
  });
110
115
  }
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "116.3.2";
27
+ var packageVersion = "116.4.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -1,19 +1,22 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.highlightColorPaletteNew = void 0;
7
- var _adfSchema = require("@atlaskit/adf-schema");
8
+ var _backgroundColor = require("@atlaskit/adf-schema/background-color");
9
+ var _getColorMessage = _interopRequireDefault(require("./getColorMessage"));
8
10
  var _highlightColorPalette = require("./highlightColorPalette");
9
11
  var _mapPaletteColor = require("./mapPaletteColor");
10
- var removeHighlightColor = _highlightColorPalette.highlightColorPalette.find(function (_ref) {
11
- var value = _ref.value;
12
- return value === _highlightColorPalette.REMOVE_HIGHLIGHT_COLOR;
13
- });
14
-
15
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
16
- var highlightColorPaletteNew = exports.highlightColorPaletteNew = removeHighlightColor ? [removeHighlightColor] : [];
17
- _adfSchema.backgroundColorPaletteNew.forEach(function (label, color) {
12
+ var _paletteMessages = _interopRequireDefault(require("./paletteMessages"));
13
+ var highlightColorPaletteNew = exports.highlightColorPaletteNew = [{
14
+ value: _highlightColorPalette.REMOVE_HIGHLIGHT_COLOR,
15
+ label: 'No color',
16
+ // Mostly informative, only used for analytics
17
+ border: "var(--ds-border, #0B120E24)",
18
+ message: (0, _getColorMessage.default)(_paletteMessages.default, 'no-color')
19
+ }];
20
+ _backgroundColor.backgroundColorPaletteNew.forEach(function (label, color) {
18
21
  highlightColorPaletteNew.push((0, _mapPaletteColor.mapPaletteColor)(label, color));
19
22
  });
@@ -4,10 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.textColorPaletteNew = void 0;
7
- var _adfSchema = require("@atlaskit/adf-schema");
7
+ var _textColor = require("@atlaskit/adf-schema/text-color");
8
8
  var _mapPaletteColor = require("./mapPaletteColor");
9
9
  // new color palette behind platform_editor_lovability_text_bg_color
10
10
  var textColorPaletteNew = exports.textColorPaletteNew = [];
11
- _adfSchema.colorPaletteNew.forEach(function (label, color) {
11
+ _textColor.colorPaletteNew.forEach(function (label, color) {
12
12
  textColorPaletteNew.push((0, _mapPaletteColor.mapPaletteColor)(label, color));
13
13
  });
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
14
14
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
15
15
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
16
16
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
17
- const packageVersion = "116.3.2";
17
+ const packageVersion = "116.4.1";
18
18
  const sanitiseSentryEvents = (data, _hint) => {
19
19
  // Remove URL as it has UGC
20
20
  // Ignored via go/ees007
@@ -0,0 +1,42 @@
1
+ // Items with priority >= this threshold are treated as extension-provided
2
+ // items (e.g. Rovo skills) and demoted below native editor elements.
3
+ // Coupled with priority: 9000 set in
4
+ // platform/packages/ai-mate/rovo-skills/src/services/insert-menu-provider/extension-manifest.tsx
5
+ const SKILL_PRIORITY_THRESHOLD = 1000;
6
+ const SCORE_PROXIMITY_THRESHOLD = 0.2;
7
+
8
+ /**
9
+ * Promotes native editor elements above extension-provided items (e.g. Rovo
10
+ * skills) in search results when their Fuse scores are close.
11
+ *
12
+ * Skills set a high priority value (e.g. 9000) while native items have no
13
+ * priority (undefined / 0). When a skill and a native item have similar scores
14
+ * (within the proximity threshold), the native item is promoted above the
15
+ * skill. But when a skill is a significantly better match (e.g. searching
16
+ * "research" and the skill is "Research Insights" while the native item is
17
+ * "Live search"), the skill keeps its higher rank.
18
+ */
19
+ export function boostNativeResultsAboveSkills(results) {
20
+ const isSkill = r => {
21
+ var _r$item$priority;
22
+ return ((_r$item$priority = r.item.priority) !== null && _r$item$priority !== void 0 ? _r$item$priority : 0) >= SKILL_PRIORITY_THRESHOLD;
23
+ };
24
+ const reordered = results.slice(0);
25
+ for (let i = 1; i < reordered.length; i++) {
26
+ if (isSkill(reordered[i])) {
27
+ continue;
28
+ }
29
+ // reordered[i] is a native item — check if there are skills
30
+ // ranked above it that have a similar score.
31
+ let insertAt = i;
32
+ while (insertAt > 0 && isSkill(reordered[insertAt - 1]) && Math.abs(((_reordered$score = reordered[insertAt - 1].score) !== null && _reordered$score !== void 0 ? _reordered$score : 0) - ((_reordered$i$score = reordered[i].score) !== null && _reordered$i$score !== void 0 ? _reordered$i$score : 0)) < SCORE_PROXIMITY_THRESHOLD) {
33
+ var _reordered$score, _reordered$i$score;
34
+ insertAt--;
35
+ }
36
+ if (insertAt < i) {
37
+ const [native] = reordered.splice(i, 1);
38
+ reordered.splice(insertAt, 0, native);
39
+ }
40
+ }
41
+ return reordered;
42
+ }
@@ -1,6 +1,8 @@
1
1
  import Fuse from 'fuse.js';
2
2
  import memoizeOne from 'memoize-one';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
5
+ import { boostNativeResultsAboveSkills } from './boost-native-results-above-skills';
4
6
  const processQuickInsertItems = (items, intl) => {
5
7
  return items.reduce((acc, item) => {
6
8
  if (typeof item === 'function' &&
@@ -44,9 +46,9 @@ const options = {
44
46
  * This function is used to find and sort QuickInsertItems based on a given query string.
45
47
  *
46
48
  * @export
47
- * @param {string} query - The query string to be used in the search.
48
- * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
49
- * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
49
+ * @param query - The query string to be used in the search.
50
+ * @param items - An array of QuickInsertItems to be searched.
51
+ * @returns Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
50
52
  */
51
53
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
52
54
  export function find(query, items, prioritySortingFn) {
@@ -67,22 +69,25 @@ export function find(query, items, prioritySortingFn) {
67
69
  }
68
70
  const fuse = new Fuse(items, fuseOptions);
69
71
  const results = fuse.search(query);
72
+
73
+ // platform_editor_insert_menu_ai: boost native editor elements above skills
74
+ const rerankedResults = expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) ? boostNativeResultsAboveSkills(results) : results;
70
75
  if (fg('jim-lower-ranking-in-jira-macro-search')) {
71
- var _results$datasourceIn, _results$legacyIndex$;
76
+ var _rerankedResults$data, _rerankedResults$lega;
72
77
  // searching for jira work items macro first
73
- const datasourceIndex = results.findIndex(r => {
78
+ const datasourceIndex = rerankedResults.findIndex(r => {
74
79
  var _r$item$keywords;
75
80
  return r.item.id === 'datasource' && ((_r$item$keywords = r.item.keywords) === null || _r$item$keywords === void 0 ? void 0 : _r$item$keywords.includes('jira'));
76
81
  });
77
82
 
78
83
  // then searching for the legacy jira macro
79
- const legacyIndex = results.findIndex(r => typeof r.item.key === 'string' && r.item.key.endsWith(':jira'));
84
+ const legacyIndex = rerankedResults.findIndex(r => typeof r.item.key === 'string' && r.item.key.endsWith(':jira'));
80
85
 
81
86
  // the jira legcy macro is found before the jira work items macro then swap the two
82
- if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_results$datasourceIn = results[datasourceIndex].score) !== null && _results$datasourceIn !== void 0 ? _results$datasourceIn : 0) - ((_results$legacyIndex$ = results[legacyIndex].score) !== null && _results$legacyIndex$ !== void 0 ? _results$legacyIndex$ : 0)) < 0.2) {
83
- const [datasource] = results.splice(datasourceIndex, 1);
84
- results.splice(legacyIndex, 0, datasource);
87
+ if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_rerankedResults$data = rerankedResults[datasourceIndex].score) !== null && _rerankedResults$data !== void 0 ? _rerankedResults$data : 0) - ((_rerankedResults$lega = rerankedResults[legacyIndex].score) !== null && _rerankedResults$lega !== void 0 ? _rerankedResults$lega : 0)) < 0.2) {
88
+ const [datasource] = rerankedResults.splice(datasourceIndex, 1);
89
+ rerankedResults.splice(legacyIndex, 0, datasource);
85
90
  }
86
91
  }
87
- return results.map(result => result.item);
92
+ return rerankedResults.map(result => result.item);
88
93
  }
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "116.3.2";
17
+ const packageVersion = "116.4.1";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -1,12 +1,15 @@
1
- import { backgroundColorPaletteNew } from '@atlaskit/adf-schema';
2
- import { REMOVE_HIGHLIGHT_COLOR, highlightColorPalette } from './highlightColorPalette';
1
+ import { backgroundColorPaletteNew } from '@atlaskit/adf-schema/background-color';
2
+ import getColorMessage from './getColorMessage';
3
+ import { REMOVE_HIGHLIGHT_COLOR } from './highlightColorPalette';
3
4
  import { mapPaletteColor } from './mapPaletteColor';
4
- const removeHighlightColor = highlightColorPalette.find(({
5
- value
6
- }) => value === REMOVE_HIGHLIGHT_COLOR);
7
-
8
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
9
- export const highlightColorPaletteNew = removeHighlightColor ? [removeHighlightColor] : [];
5
+ import paletteMessages from './paletteMessages';
6
+ export const highlightColorPaletteNew = [{
7
+ value: REMOVE_HIGHLIGHT_COLOR,
8
+ label: 'No color',
9
+ // Mostly informative, only used for analytics
10
+ border: "var(--ds-border, #0B120E24)",
11
+ message: getColorMessage(paletteMessages, 'no-color')
12
+ }];
10
13
  backgroundColorPaletteNew.forEach((label, color) => {
11
14
  highlightColorPaletteNew.push(mapPaletteColor(label, color));
12
15
  });
@@ -1,4 +1,4 @@
1
- import { colorPaletteNew } from '@atlaskit/adf-schema';
1
+ import { colorPaletteNew } from '@atlaskit/adf-schema/text-color';
2
2
  import { mapPaletteColor } from './mapPaletteColor';
3
3
  // new color palette behind platform_editor_lovability_text_bg_color
4
4
  export const textColorPaletteNew = [];
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
20
20
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
21
21
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
22
22
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
23
- var packageVersion = "116.3.2";
23
+ var packageVersion = "116.4.1";
24
24
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
25
25
  // Remove URL as it has UGC
26
26
  // Ignored via go/ees007
@@ -0,0 +1,45 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
+ // Items with priority >= this threshold are treated as extension-provided
3
+ // items (e.g. Rovo skills) and demoted below native editor elements.
4
+ // Coupled with priority: 9000 set in
5
+ // platform/packages/ai-mate/rovo-skills/src/services/insert-menu-provider/extension-manifest.tsx
6
+ var SKILL_PRIORITY_THRESHOLD = 1000;
7
+ var SCORE_PROXIMITY_THRESHOLD = 0.2;
8
+
9
+ /**
10
+ * Promotes native editor elements above extension-provided items (e.g. Rovo
11
+ * skills) in search results when their Fuse scores are close.
12
+ *
13
+ * Skills set a high priority value (e.g. 9000) while native items have no
14
+ * priority (undefined / 0). When a skill and a native item have similar scores
15
+ * (within the proximity threshold), the native item is promoted above the
16
+ * skill. But when a skill is a significantly better match (e.g. searching
17
+ * "research" and the skill is "Research Insights" while the native item is
18
+ * "Live search"), the skill keeps its higher rank.
19
+ */
20
+ export function boostNativeResultsAboveSkills(results) {
21
+ var isSkill = function isSkill(r) {
22
+ var _r$item$priority;
23
+ return ((_r$item$priority = r.item.priority) !== null && _r$item$priority !== void 0 ? _r$item$priority : 0) >= SKILL_PRIORITY_THRESHOLD;
24
+ };
25
+ var reordered = results.slice(0);
26
+ for (var i = 1; i < reordered.length; i++) {
27
+ if (isSkill(reordered[i])) {
28
+ continue;
29
+ }
30
+ // reordered[i] is a native item — check if there are skills
31
+ // ranked above it that have a similar score.
32
+ var insertAt = i;
33
+ while (insertAt > 0 && isSkill(reordered[insertAt - 1]) && Math.abs(((_reordered$score = reordered[insertAt - 1].score) !== null && _reordered$score !== void 0 ? _reordered$score : 0) - ((_reordered$i$score = reordered[i].score) !== null && _reordered$i$score !== void 0 ? _reordered$i$score : 0)) < SCORE_PROXIMITY_THRESHOLD) {
34
+ var _reordered$score, _reordered$i$score;
35
+ insertAt--;
36
+ }
37
+ if (insertAt < i) {
38
+ var _reordered$splice = reordered.splice(i, 1),
39
+ _reordered$splice2 = _slicedToArray(_reordered$splice, 1),
40
+ native = _reordered$splice2[0];
41
+ reordered.splice(insertAt, 0, native);
42
+ }
43
+ }
44
+ return reordered;
45
+ }
@@ -5,6 +5,8 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
5
5
  import Fuse from 'fuse.js';
6
6
  import memoizeOne from 'memoize-one';
7
7
  import { fg } from '@atlaskit/platform-feature-flags';
8
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
9
+ import { boostNativeResultsAboveSkills } from './boost-native-results-above-skills';
8
10
  var processQuickInsertItems = function processQuickInsertItems(items, intl) {
9
11
  return items.reduce(function (acc, item) {
10
12
  if (typeof item === 'function' &&
@@ -52,9 +54,9 @@ var options = {
52
54
  * This function is used to find and sort QuickInsertItems based on a given query string.
53
55
  *
54
56
  * @export
55
- * @param {string} query - The query string to be used in the search.
56
- * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
57
- * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
57
+ * @param query - The query string to be used in the search.
58
+ * @param items - An array of QuickInsertItems to be searched.
59
+ * @returns Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
58
60
  */
59
61
  // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
60
62
  export function find(query, items, prioritySortingFn) {
@@ -75,28 +77,31 @@ export function find(query, items, prioritySortingFn) {
75
77
  }
76
78
  var fuse = new Fuse(items, fuseOptions);
77
79
  var results = fuse.search(query);
80
+
81
+ // platform_editor_insert_menu_ai: boost native editor elements above skills
82
+ var rerankedResults = expValEquals('platform_editor_insert_menu_ai', 'isEnabled', true) ? boostNativeResultsAboveSkills(results) : results;
78
83
  if (fg('jim-lower-ranking-in-jira-macro-search')) {
79
- var _results$datasourceIn, _results$legacyIndex$;
84
+ var _rerankedResults$data, _rerankedResults$lega;
80
85
  // searching for jira work items macro first
81
- var datasourceIndex = results.findIndex(function (r) {
86
+ var datasourceIndex = rerankedResults.findIndex(function (r) {
82
87
  var _r$item$keywords;
83
88
  return r.item.id === 'datasource' && ((_r$item$keywords = r.item.keywords) === null || _r$item$keywords === void 0 ? void 0 : _r$item$keywords.includes('jira'));
84
89
  });
85
90
 
86
91
  // then searching for the legacy jira macro
87
- var legacyIndex = results.findIndex(function (r) {
92
+ var legacyIndex = rerankedResults.findIndex(function (r) {
88
93
  return typeof r.item.key === 'string' && r.item.key.endsWith(':jira');
89
94
  });
90
95
 
91
96
  // the jira legcy macro is found before the jira work items macro then swap the two
92
- if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_results$datasourceIn = results[datasourceIndex].score) !== null && _results$datasourceIn !== void 0 ? _results$datasourceIn : 0) - ((_results$legacyIndex$ = results[legacyIndex].score) !== null && _results$legacyIndex$ !== void 0 ? _results$legacyIndex$ : 0)) < 0.2) {
93
- var _results$splice = results.splice(datasourceIndex, 1),
94
- _results$splice2 = _slicedToArray(_results$splice, 1),
95
- datasource = _results$splice2[0];
96
- results.splice(legacyIndex, 0, datasource);
97
+ if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_rerankedResults$data = rerankedResults[datasourceIndex].score) !== null && _rerankedResults$data !== void 0 ? _rerankedResults$data : 0) - ((_rerankedResults$lega = rerankedResults[legacyIndex].score) !== null && _rerankedResults$lega !== void 0 ? _rerankedResults$lega : 0)) < 0.2) {
98
+ var _rerankedResults$spli = rerankedResults.splice(datasourceIndex, 1),
99
+ _rerankedResults$spli2 = _slicedToArray(_rerankedResults$spli, 1),
100
+ datasource = _rerankedResults$spli2[0];
101
+ rerankedResults.splice(legacyIndex, 0, datasource);
97
102
  }
98
103
  }
99
- return results.map(function (result) {
104
+ return rerankedResults.map(function (result) {
100
105
  return result.item;
101
106
  });
102
107
  }
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "116.3.2";
24
+ var packageVersion = "116.4.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -1,13 +1,15 @@
1
- import { backgroundColorPaletteNew } from '@atlaskit/adf-schema';
2
- import { REMOVE_HIGHLIGHT_COLOR, highlightColorPalette } from './highlightColorPalette';
1
+ import { backgroundColorPaletteNew } from '@atlaskit/adf-schema/background-color';
2
+ import getColorMessage from './getColorMessage';
3
+ import { REMOVE_HIGHLIGHT_COLOR } from './highlightColorPalette';
3
4
  import { mapPaletteColor } from './mapPaletteColor';
4
- var removeHighlightColor = highlightColorPalette.find(function (_ref) {
5
- var value = _ref.value;
6
- return value === REMOVE_HIGHLIGHT_COLOR;
7
- });
8
-
9
- // eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
10
- export var highlightColorPaletteNew = removeHighlightColor ? [removeHighlightColor] : [];
5
+ import paletteMessages from './paletteMessages';
6
+ export var highlightColorPaletteNew = [{
7
+ value: REMOVE_HIGHLIGHT_COLOR,
8
+ label: 'No color',
9
+ // Mostly informative, only used for analytics
10
+ border: "var(--ds-border, #0B120E24)",
11
+ message: getColorMessage(paletteMessages, 'no-color')
12
+ }];
11
13
  backgroundColorPaletteNew.forEach(function (label, color) {
12
14
  highlightColorPaletteNew.push(mapPaletteColor(label, color));
13
15
  });
@@ -1,4 +1,4 @@
1
- import { colorPaletteNew } from '@atlaskit/adf-schema';
1
+ import { colorPaletteNew } from '@atlaskit/adf-schema/text-color';
2
2
  import { mapPaletteColor } from './mapPaletteColor';
3
3
  // new color palette behind platform_editor_lovability_text_bg_color
4
4
  export var textColorPaletteNew = [];
@@ -166,21 +166,25 @@ type InsertSnippetAEP = InsertAEP<ACTION_SUBJECT_ID.SNIPPET, {
166
166
  hadMedia?: boolean;
167
167
  inputMethod: INPUT_METHOD.QUICK_INSERT;
168
168
  snippetId: string;
169
+ templateType?: 'atlassian' | 'user';
169
170
  }, undefined>;
170
171
  type FailedToInsertSnippetAEP = OperationalAEP<ACTION.FAILED_TO_INSERT, ACTION_SUBJECT.DOCUMENT, ACTION_SUBJECT_ID.SNIPPET, {
171
172
  reason: 'emptyBody' | 'parseError';
172
173
  snippetId: string;
174
+ templateType?: 'atlassian' | 'user';
173
175
  } | {
174
176
  numFailedMediaFiles: number;
175
177
  numTotalMediaFiles: number;
176
178
  reason: 'snippetMediaDirectCopyFailed';
177
179
  snippetId: string;
178
180
  snippetMediaCopyStatus: 'copied' | 'partial-copy' | 'failed' | 'copy-unavailable';
181
+ templateType?: 'atlassian' | 'user';
179
182
  } | {
180
183
  numFailedMediaFiles: number;
181
184
  numTotalMediaFiles: number;
182
185
  reason: 'snippetMediaDirectCopyUnexpectedError';
183
186
  snippetId: string;
187
+ templateType?: 'atlassian' | 'user';
184
188
  }>;
185
189
  export type InsertEventPayload = InsertDividerAEP | InsertLineBreakAEP | InsertPanelAEP | InsertCodeBlockAEP | InsertTableAEP | InsertExpandAEP | InsertActionDecisionAEP | InsertEmojiAEP | InsertStatusAEP | InsertMediaSingleAEP | InsertMediaGroupAEP | InsertMediaInlineAEP | InsertLinkAEP | InsertLinkPreviewAEP | InsertMediaLinkAEP | InsertSmartLinkAEP | InsertLayoutAEP | InsertLayoutColumnAEP | InsertExtensionAEP | InsertNodeViaExtensionAPIAEP | InsertDateAEP | InsertPlaceholderTextAEP | InsertNativeEmbedAEP | FailedToInsertMediaPayload | InsertReferenceSyncedBlockPayload | InsertSourceSyncedBlockPayload | InsertSnippetAEP | FailedToInsertSnippetAEP;
186
190
  export {};
@@ -0,0 +1,16 @@
1
+ import type { QuickInsertItem } from '../provider-factory';
2
+ /**
3
+ * Promotes native editor elements above extension-provided items (e.g. Rovo
4
+ * skills) in search results when their Fuse scores are close.
5
+ *
6
+ * Skills set a high priority value (e.g. 9000) while native items have no
7
+ * priority (undefined / 0). When a skill and a native item have similar scores
8
+ * (within the proximity threshold), the native item is promoted above the
9
+ * skill. But when a skill is a significantly better match (e.g. searching
10
+ * "research" and the skill is "Research Insights" while the native item is
11
+ * "Live search"), the skill keeps its higher rank.
12
+ */
13
+ export declare function boostNativeResultsAboveSkills<T extends {
14
+ item: QuickInsertItem;
15
+ score?: number;
16
+ }>(results: T[]): T[];
@@ -7,8 +7,8 @@ export declare const memoProcessQuickInsertItems: (items: Array<QuickInsertHandl
7
7
  * This function is used to find and sort QuickInsertItems based on a given query string.
8
8
  *
9
9
  * @export
10
- * @param {string} query - The query string to be used in the search.
11
- * @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
12
- * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
10
+ * @param query - The query string to be used in the search.
11
+ * @param items - An array of QuickInsertItems to be searched.
12
+ * @returns Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
13
13
  */
14
14
  export declare function find(query: string, items: QuickInsertItem[], prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction | undefined): QuickInsertItem[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "116.4.0",
3
+ "version": "116.5.0",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -49,7 +49,7 @@
49
49
  "@atlaskit/editor-tables": "^3.0.0",
50
50
  "@atlaskit/editor-toolbar": "^2.0.0",
51
51
  "@atlaskit/editor-toolbar-model": "^1.0.0",
52
- "@atlaskit/emoji": "^71.2.0",
52
+ "@atlaskit/emoji": "^71.3.0",
53
53
  "@atlaskit/icon": "^36.0.0",
54
54
  "@atlaskit/link": "^4.0.0",
55
55
  "@atlaskit/link-datasource": "^6.0.0",
@@ -79,7 +79,7 @@
79
79
  "@atlaskit/task-decision": "^21.1.0",
80
80
  "@atlaskit/teams-app-config": "^2.0.0",
81
81
  "@atlaskit/textfield": "^9.0.0",
82
- "@atlaskit/tmp-editor-statsig": "^108.3.0",
82
+ "@atlaskit/tmp-editor-statsig": "^108.4.0",
83
83
  "@atlaskit/tokens": "^14.0.0",
84
84
  "@atlaskit/tooltip": "^23.0.0",
85
85
  "@atlaskit/width-detector": "^6.0.0",