@atlaskit/editor-common 128.4.0 → 129.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/dist/cjs/clipboard/index.js +41 -21
  3. package/dist/cjs/extensibility/extensionNodeView.js +17 -2
  4. package/dist/cjs/extensibility/preserveRemixNodeView.js +150 -0
  5. package/dist/cjs/extensions/native-embed-maui-extension-key.js +8 -0
  6. package/dist/cjs/messages/insert-block.js +0 -5
  7. package/dist/cjs/monitoring/error.js +1 -1
  8. package/dist/cjs/quick-insert/get-matching-quick-insert-components.js +38 -9
  9. package/dist/cjs/quick-insert/getQuickInsertMenuRows.js +12 -0
  10. package/dist/cjs/quick-insert/registered-menu-model.js +7 -0
  11. package/dist/cjs/quick-insert/snippetMenuRank.js +35 -0
  12. package/dist/cjs/quick-insert/utils.js +9 -14
  13. package/dist/cjs/type-ahead/messages.js +0 -10
  14. package/dist/cjs/ui/DropList/index.js +1 -1
  15. package/dist/es2019/clipboard/index.js +18 -6
  16. package/dist/es2019/extensibility/extensionNodeView.js +15 -2
  17. package/dist/es2019/extensibility/preserveRemixNodeView.js +132 -0
  18. package/dist/es2019/extensions/native-embed-maui-extension-key.js +2 -0
  19. package/dist/es2019/messages/insert-block.js +0 -5
  20. package/dist/es2019/monitoring/error.js +1 -1
  21. package/dist/es2019/quick-insert/get-matching-quick-insert-components.js +23 -3
  22. package/dist/es2019/quick-insert/getQuickInsertMenuRows.js +4 -0
  23. package/dist/es2019/quick-insert/registered-menu-model.js +1 -0
  24. package/dist/es2019/quick-insert/snippetMenuRank.js +30 -0
  25. package/dist/es2019/quick-insert/utils.js +7 -12
  26. package/dist/es2019/type-ahead/messages.js +0 -10
  27. package/dist/es2019/ui/DropList/index.js +1 -1
  28. package/dist/esm/clipboard/index.js +40 -20
  29. package/dist/esm/extensibility/extensionNodeView.js +17 -2
  30. package/dist/esm/extensibility/preserveRemixNodeView.js +145 -0
  31. package/dist/esm/extensions/native-embed-maui-extension-key.js +2 -0
  32. package/dist/esm/messages/insert-block.js +0 -5
  33. package/dist/esm/monitoring/error.js +1 -1
  34. package/dist/esm/quick-insert/get-matching-quick-insert-components.js +37 -9
  35. package/dist/esm/quick-insert/getQuickInsertMenuRows.js +5 -0
  36. package/dist/esm/quick-insert/registered-menu-model.js +1 -0
  37. package/dist/esm/quick-insert/snippetMenuRank.js +29 -0
  38. package/dist/esm/quick-insert/utils.js +9 -14
  39. package/dist/esm/type-ahead/messages.js +0 -10
  40. package/dist/esm/ui/DropList/index.js +1 -1
  41. package/dist/types/extensibility/preserveRemixNodeView.d.ts +33 -0
  42. package/dist/types/extensions/native-embed-maui-extension-key.d.ts +1 -0
  43. package/dist/types/messages/insert-block.d.ts +0 -5
  44. package/dist/types/quick-insert/build-quick-insert-menu-model.d.ts +1 -0
  45. package/dist/types/quick-insert/getQuickInsertMenuRows.d.ts +3 -0
  46. package/dist/types/quick-insert/registered-menu-model.d.ts +1 -0
  47. package/dist/types/quick-insert/snippetMenuRank.d.ts +16 -0
  48. package/dist/types/type-ahead/messages.d.ts +0 -10
  49. package/dist/types/types/type-ahead.d.ts +0 -7
  50. package/extensibility/preserve-remix-node-view/package.json +10 -0
  51. package/extensions/native-embed-maui-extension-key/package.json +10 -0
  52. package/package.json +4 -4
  53. package/quick-insert/snippet-menu-rank/package.json +10 -0
  54. package/dist/cjs/quick-insert/boost-native-results-above-skills.js +0 -61
  55. package/dist/es2019/quick-insert/boost-native-results-above-skills.js +0 -49
  56. package/dist/esm/quick-insert/boost-native-results-above-skills.js +0 -54
  57. package/dist/types/quick-insert/boost-native-results-above-skills.d.ts +0 -21
@@ -1,61 +0,0 @@
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
- var SCORE_PROXIMITY_THRESHOLD = 0.2;
10
-
11
- /**
12
- * The extension type for Rovo skills, used to identify skill items in the
13
- * quick insert menu. Matches the value defined in
14
- * @atlassian/conversation-assistant-content-transformer/utils/skills.
15
- *
16
- * Intentionally duplicated here to avoid adding a runtime dependency from
17
- * editor-common to the conversation-assistant packages.
18
- */
19
- var ROVO_SKILL_EXTENSION_TYPE = 'com.atlassian.rovo.skill';
20
-
21
- /**
22
- * Promotes native editor elements above Rovo skill items in search results
23
- * when their Fuse scores are close.
24
- *
25
- * An item is classified as a Rovo skill when its `extensionType` property
26
- * (set by `buildMenuItem` for all extension manifest items) matches the
27
- * Rovo skill extension type. Native editor items (Link, Code snippet, Table,
28
- * etc.) and other non-Rovo extensions are unaffected, regardless of their
29
- * priority value.
30
- *
31
- * When a skill and a native item have similar scores (within the proximity
32
- * threshold), the native item is promoted above the skill. But when a skill
33
- * is a significantly better match (e.g. searching "research" and the skill is
34
- * "Research Insights" while the native item is "Live search"), the skill keeps
35
- * its higher rank.
36
- */
37
- function boostNativeResultsAboveSkills(results) {
38
- var isSkill = function isSkill(r) {
39
- return r.item.extensionType === ROVO_SKILL_EXTENSION_TYPE;
40
- };
41
- var reordered = results.slice(0);
42
- for (var i = 1; i < reordered.length; i++) {
43
- if (isSkill(reordered[i])) {
44
- continue;
45
- }
46
- // reordered[i] is a native item — check if there are skills
47
- // ranked above it that have a similar score.
48
- var insertAt = i;
49
- 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) {
50
- var _reordered$score, _reordered$i$score;
51
- insertAt--;
52
- }
53
- if (insertAt < i) {
54
- var _reordered$splice = reordered.splice(i, 1),
55
- _reordered$splice2 = (0, _slicedToArray2.default)(_reordered$splice, 1),
56
- native = _reordered$splice2[0];
57
- reordered.splice(insertAt, 0, native);
58
- }
59
- }
60
- return reordered;
61
- }
@@ -1,49 +0,0 @@
1
- const SCORE_PROXIMITY_THRESHOLD = 0.2;
2
-
3
- /**
4
- * The extension type for Rovo skills, used to identify skill items in the
5
- * quick insert menu. Matches the value defined in
6
- * @atlassian/conversation-assistant-content-transformer/utils/skills.
7
- *
8
- * Intentionally duplicated here to avoid adding a runtime dependency from
9
- * editor-common to the conversation-assistant packages.
10
- */
11
- const ROVO_SKILL_EXTENSION_TYPE = 'com.atlassian.rovo.skill';
12
-
13
- /**
14
- * Promotes native editor elements above Rovo skill items in search results
15
- * when their Fuse scores are close.
16
- *
17
- * An item is classified as a Rovo skill when its `extensionType` property
18
- * (set by `buildMenuItem` for all extension manifest items) matches the
19
- * Rovo skill extension type. Native editor items (Link, Code snippet, Table,
20
- * etc.) and other non-Rovo extensions are unaffected, regardless of their
21
- * priority value.
22
- *
23
- * When a skill and a native item have similar scores (within the proximity
24
- * threshold), the native item is promoted above the skill. But when a skill
25
- * is a significantly better match (e.g. searching "research" and the skill is
26
- * "Research Insights" while the native item is "Live search"), the skill keeps
27
- * its higher rank.
28
- */
29
- export function boostNativeResultsAboveSkills(results) {
30
- const isSkill = r => r.item.extensionType === ROVO_SKILL_EXTENSION_TYPE;
31
- const reordered = results.slice(0);
32
- for (let i = 1; i < reordered.length; i++) {
33
- if (isSkill(reordered[i])) {
34
- continue;
35
- }
36
- // reordered[i] is a native item — check if there are skills
37
- // ranked above it that have a similar score.
38
- let insertAt = i;
39
- 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) {
40
- var _reordered$score, _reordered$i$score;
41
- insertAt--;
42
- }
43
- if (insertAt < i) {
44
- const [native] = reordered.splice(i, 1);
45
- reordered.splice(insertAt, 0, native);
46
- }
47
- }
48
- return reordered;
49
- }
@@ -1,54 +0,0 @@
1
- import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- var SCORE_PROXIMITY_THRESHOLD = 0.2;
3
-
4
- /**
5
- * The extension type for Rovo skills, used to identify skill items in the
6
- * quick insert menu. Matches the value defined in
7
- * @atlassian/conversation-assistant-content-transformer/utils/skills.
8
- *
9
- * Intentionally duplicated here to avoid adding a runtime dependency from
10
- * editor-common to the conversation-assistant packages.
11
- */
12
- var ROVO_SKILL_EXTENSION_TYPE = 'com.atlassian.rovo.skill';
13
-
14
- /**
15
- * Promotes native editor elements above Rovo skill items in search results
16
- * when their Fuse scores are close.
17
- *
18
- * An item is classified as a Rovo skill when its `extensionType` property
19
- * (set by `buildMenuItem` for all extension manifest items) matches the
20
- * Rovo skill extension type. Native editor items (Link, Code snippet, Table,
21
- * etc.) and other non-Rovo extensions are unaffected, regardless of their
22
- * priority value.
23
- *
24
- * When a skill and a native item have similar scores (within the proximity
25
- * threshold), the native item is promoted above the skill. But when a skill
26
- * is a significantly better match (e.g. searching "research" and the skill is
27
- * "Research Insights" while the native item is "Live search"), the skill keeps
28
- * its higher rank.
29
- */
30
- export function boostNativeResultsAboveSkills(results) {
31
- var isSkill = function isSkill(r) {
32
- return r.item.extensionType === ROVO_SKILL_EXTENSION_TYPE;
33
- };
34
- var reordered = results.slice(0);
35
- for (var i = 1; i < reordered.length; i++) {
36
- if (isSkill(reordered[i])) {
37
- continue;
38
- }
39
- // reordered[i] is a native item — check if there are skills
40
- // ranked above it that have a similar score.
41
- var insertAt = i;
42
- 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) {
43
- var _reordered$score, _reordered$i$score;
44
- insertAt--;
45
- }
46
- if (insertAt < i) {
47
- var _reordered$splice = reordered.splice(i, 1),
48
- _reordered$splice2 = _slicedToArray(_reordered$splice, 1),
49
- native = _reordered$splice2[0];
50
- reordered.splice(insertAt, 0, native);
51
- }
52
- }
53
- return reordered;
54
- }
@@ -1,21 +0,0 @@
1
- import type { QuickInsertItem } from '../provider-factory';
2
- /**
3
- * Promotes native editor elements above Rovo skill items in search results
4
- * when their Fuse scores are close.
5
- *
6
- * An item is classified as a Rovo skill when its `extensionType` property
7
- * (set by `buildMenuItem` for all extension manifest items) matches the
8
- * Rovo skill extension type. Native editor items (Link, Code snippet, Table,
9
- * etc.) and other non-Rovo extensions are unaffected, regardless of their
10
- * priority value.
11
- *
12
- * When a skill and a native item have similar scores (within the proximity
13
- * threshold), the native item is promoted above the skill. But when a skill
14
- * is a significantly better match (e.g. searching "research" and the skill is
15
- * "Research Insights" while the native item is "Live search"), the skill keeps
16
- * its higher rank.
17
- */
18
- export declare function boostNativeResultsAboveSkills<T extends {
19
- item: QuickInsertItem;
20
- score?: number;
21
- }>(results: T[]): T[];