@atlaskit/editor-common 134.0.2 → 134.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 +26 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/createQuickInsertMatcher.js +9 -0
- package/dist/cjs/quick-insert/getQuickInsertSearchPriority.js +49 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/rendered-result-tracker.js +100 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/createQuickInsertMatcher.js +9 -0
- package/dist/es2019/quick-insert/getQuickInsertSearchPriority.js +34 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/rendered-result-tracker.js +83 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/createQuickInsertMatcher.js +9 -0
- package/dist/esm/quick-insert/getQuickInsertSearchPriority.js +42 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/rendered-result-tracker.js +94 -0
- package/dist/types/quick-insert/getQuickInsertSearchPriority.d.ts +7 -0
- package/dist/types/utils/rendered-result-tracker.d.ts +9 -0
- package/package.json +3 -3
- package/rendered-result-tracker/package.json +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 134.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`800e9d2b92528`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/800e9d2b92528) -
|
|
8
|
+
Add viewport-aware rendered events for MAUI embeds and Remix media behind
|
|
9
|
+
`platform_maui_retention_analytics`, deduplicated per result within each tracker.
|
|
10
|
+
|
|
11
|
+
Native embeds opt in through `uiConfig.deferRenderedEventUntilVisible` and can provide
|
|
12
|
+
`getRenderedResultId` for analytics attribution. Other embeds retain existing timing.
|
|
13
|
+
|
|
14
|
+
Media tracking preserves preview readiness across replacements and observes only eligible Remix
|
|
15
|
+
media. Analytics prefer the matching Remix source regardless of tracking eligibility.
|
|
16
|
+
|
|
17
|
+
## 134.0.3
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`f2e219b3ca00d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f2e219b3ca00d) -
|
|
22
|
+
Rank slash command search results with matcher priority groups while retaining the current
|
|
23
|
+
ordering for items without a group. Recommended results for audited search terms, including Jira,
|
|
24
|
+
receive fixed scores in group 0 under platform_editor_slash_command. The Element Browser applies
|
|
25
|
+
the same priority groups to its search results. Menu item matchers now require the item's key in
|
|
26
|
+
their context; callers must pass the registration key.
|
|
27
|
+
- Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 134.0.2
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
27
27
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
28
28
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
29
29
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
30
|
-
var packageVersion = "134.0.
|
|
30
|
+
var packageVersion = "134.0.3";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createQuickInsertMatcher = void 0;
|
|
8
8
|
var _fuse = _interopRequireDefault(require("fuse.js"));
|
|
9
9
|
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
10
|
+
var _getQuickInsertSearchPriority = require("./getQuickInsertSearchPriority");
|
|
10
11
|
var options = {
|
|
11
12
|
includeScore: true,
|
|
12
13
|
keys: [{
|
|
@@ -40,6 +41,7 @@ var _createQuickInsertMatcher = exports.createQuickInsertMatcher = function crea
|
|
|
40
41
|
var fuse;
|
|
41
42
|
var matcher = function matcher(_ref2) {
|
|
42
43
|
var formatMessage = _ref2.formatMessage,
|
|
44
|
+
itemKey = _ref2.itemKey,
|
|
43
45
|
query = _ref2.query;
|
|
44
46
|
var normalizedQuery = query.trim();
|
|
45
47
|
if (!normalizedQuery) {
|
|
@@ -47,6 +49,13 @@ var _createQuickInsertMatcher = exports.createQuickInsertMatcher = function crea
|
|
|
47
49
|
score: 0
|
|
48
50
|
};
|
|
49
51
|
}
|
|
52
|
+
var priority = (0, _getQuickInsertSearchPriority.getQuickInsertSearchPriority)({
|
|
53
|
+
itemKey: itemKey,
|
|
54
|
+
query: query
|
|
55
|
+
});
|
|
56
|
+
if (priority) {
|
|
57
|
+
return priority;
|
|
58
|
+
}
|
|
50
59
|
if (!fuse || cachedFormatMessage !== formatMessage) {
|
|
51
60
|
fuse = new _fuse.default([getSearchData({
|
|
52
61
|
formatMessage: formatMessage
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getQuickInsertSearchPriority = void 0;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
10
|
+
var _getQuickInsertProviderMenuItemKey = require("./getQuickInsertProviderMenuItemKey");
|
|
11
|
+
var _keys = require("./keys");
|
|
12
|
+
var SKILL_MENU_ITEM_KEY_PREFIX = (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('skill:');
|
|
13
|
+
var RECOMMENDED_ITEM_KEYS_BY_QUERY = [['a', [_keys.ASK_ROVO_MENU_ITEM.key, _keys.ACTION_MENU_ITEM.key, _keys.ASSETS_MENU_ITEM.key]], ['b', [(0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('blog-posts:blog-posts'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('snippet-extension:block-template'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.BRAINSTORMING_MENU_ITEM.key)]], ['c', [_keys.CODE_BLOCK_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('cards:quick-insert'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.JIRA_ISSUE_MENU_ITEM.key)]], ['d', [_keys.DATE_MENU_ITEM.key, _keys.DECISION_MENU_ITEM.key, _keys.RULE_MENU_ITEM.key]], ['e', [_keys.EMOJI_MENU_ITEM.key, _keys.EXPAND_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('third-party-quick-insert-embeds:embed')]], ['f', [_keys.INFO_PANEL_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.FLOWCHART_MENU_ITEM.key), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('third-party-quick-insert-embeds:third-party-embed-figma')]], ['g', [_keys.WARNING_PANEL_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('third-party-quick-insert-embeds:third-party-embed-google-drive')]], ['h', [_keys.HEADING_2_MENU_ITEM.key, _keys.HEADING_3_MENU_ITEM.key, _keys.HEADING_4_MENU_ITEM.key]], ['i', [_keys.MEDIA_INSERT_MENU_ITEM.key, _keys.INFO_PANEL_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('iframe:iframe')]], ['j', [_keys.JIRA_WORK_ITEMS_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('jirachart:jirachart'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.JIRA_ISSUE_MENU_ITEM.key)]], ['l', [_keys.LOOM_MENU_ITEM.key, _keys.HYPERLINK_MENU_ITEM.key, _keys.TWO_COLUMNS_LAYOUT_MENU_ITEM.key]], ['n', [_keys.ORDERED_LIST_MENU_ITEM.key, _keys.NOTE_PANEL_MENU_ITEM.key, _keys.SYNCED_BLOCK_MENU_ITEM.key]], ['p', [_keys.INFO_PANEL_MENU_ITEM.key, _keys.SUCCESS_PANEL_MENU_ITEM.key, _keys.WARNING_PANEL_MENU_ITEM.key, _keys.NOTE_PANEL_MENU_ITEM.key, _keys.CUSTOM_PANEL_MENU_ITEM.key]], ['q', [_keys.BLOCKQUOTE_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('questionslist-macro-native:questionslist-macro-native')]], ['r', [(0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.RETROSPECTIVE_MENU_ITEM.key), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.ROADMAP_MENU_ITEM.key), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('skill:response-draft')]], ['s', [_keys.STATUS_MENU_ITEM.key, _keys.SUCCESS_PANEL_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('spotlight:quick-insert')]], ['t', [_keys.TABLE_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.TABS_MENU_ITEM.key), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('toc:toc')]], ['w', [(0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.WHITEBOARD_MENU_ITEM.key), _keys.WARNING_PANEL_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('skill:write-prd')]], ['x', [_keys.EXPAND_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('excerpt:excerpt'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('skill:explain-workflow')]], ['y', [_keys.SYNCED_BLOCK_MENU_ITEM.key, _keys.TWO_COLUMNS_LAYOUT_MENU_ITEM.key, _keys.THREE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['co', [_keys.CODE_BLOCK_MENU_ITEM.key, _keys.TWO_COLUMNS_LAYOUT_MENU_ITEM.key, _keys.THREE_COLUMNS_LAYOUT_MENU_ITEM.key, _keys.FOUR_COLUMNS_LAYOUT_MENU_ITEM.key, _keys.FIVE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['pa', [_keys.INFO_PANEL_MENU_ITEM.key, _keys.NOTE_PANEL_MENU_ITEM.key, _keys.ERROR_PANEL_MENU_ITEM.key, _keys.SUCCESS_PANEL_MENU_ITEM.key, _keys.CUSTOM_PANEL_MENU_ITEM.key, _keys.EXPAND_MENU_ITEM.key]], ['pan', [_keys.INFO_PANEL_MENU_ITEM.key, _keys.NOTE_PANEL_MENU_ITEM.key, _keys.ERROR_PANEL_MENU_ITEM.key, _keys.SUCCESS_PANEL_MENU_ITEM.key, _keys.CUSTOM_PANEL_MENU_ITEM.key, _keys.EXPAND_MENU_ITEM.key]], ['ex', [_keys.EXPAND_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('excerpt:excerpt'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('skill:explain-workflow')]], ['la', [_keys.TWO_COLUMNS_LAYOUT_MENU_ITEM.key, _keys.THREE_COLUMNS_LAYOUT_MENU_ITEM.key, _keys.FOUR_COLUMNS_LAYOUT_MENU_ITEM.key, _keys.FIVE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['he', [_keys.HEADING_4_MENU_ITEM.key, _keys.HEADING_6_MENU_ITEM.key, _keys.HEADING_1_MENU_ITEM.key, _keys.HEADING_2_MENU_ITEM.key, _keys.HEADING_3_MENU_ITEM.key, _keys.HEADING_5_MENU_ITEM.key]], ['ac', [_keys.ACTION_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('com.atlassian.streams.streams-jira-plugin:activitystream-gadget')]], ['act', [_keys.ACTION_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('com.atlassian.streams.streams-jira-plugin:activitystream-gadget')]], ['che', [_keys.ACTION_MENU_ITEM.key]], ['em', [_keys.EMOJI_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('third-party-quick-insert-embeds:embed'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('database-extension:reference-database')]], ['fi', [_keys.MEDIA_INSERT_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('third-party-quick-insert-embeds:third-party-embed-figma'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('skill:find-similar-incidents')]], ['fil', [_keys.MEDIA_INSERT_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('com.atlassian.jira.gadgets:filter-results-gadget')]], ['at', [_keys.MEDIA_INSERT_MENU_ITEM.key]], ['ji', [_keys.JIRA_WORK_ITEMS_MENU_ITEM.key, (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.JIRA_ISSUE_MENU_ITEM.key)]], ['jira', [_keys.JIRA_WORK_ITEMS_MENU_ITEM.key]], ['db', [(0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.DATABASE_MENU_ITEM.key), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('skill:search-feedback')]], ['wb', [(0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)(_keys.WHITEBOARD_MENU_ITEM.key)]], ['te', [(0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('snippet-extension:block-template'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('create-from-template:create-from-template')]], ['tem', [(0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('snippet-extension:block-template'), (0, _getQuickInsertProviderMenuItemKey.getQuickInsertProviderMenuItemKey)('create-from-template:create-from-template')]]];
|
|
14
|
+
var createRecommendationResolver = function createRecommendationResolver(itemKeys) {
|
|
15
|
+
return function (itemKey) {
|
|
16
|
+
var index = itemKeys.indexOf(itemKey);
|
|
17
|
+
return index === -1 ? undefined : {
|
|
18
|
+
priorityGroup: 0,
|
|
19
|
+
score: index / itemKeys.length
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// The "sk" query should place every skill ahead of ordinary search results, after Ask Rovo.
|
|
25
|
+
var resolveSkillRecommendation = function resolveSkillRecommendation(itemKey) {
|
|
26
|
+
if (itemKey === _keys.ASK_ROVO_MENU_ITEM.key) {
|
|
27
|
+
return {
|
|
28
|
+
priorityGroup: 0,
|
|
29
|
+
score: 0
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
return itemKey.startsWith(SKILL_MENU_ITEM_KEY_PREFIX) ? {
|
|
33
|
+
priorityGroup: 0,
|
|
34
|
+
score: 1
|
|
35
|
+
} : undefined;
|
|
36
|
+
};
|
|
37
|
+
var RECOMMENDATIONS_BY_QUERY = new Map([].concat((0, _toConsumableArray2.default)(RECOMMENDED_ITEM_KEYS_BY_QUERY.map(function (_ref) {
|
|
38
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
39
|
+
query = _ref2[0],
|
|
40
|
+
itemKeys = _ref2[1];
|
|
41
|
+
return [query, createRecommendationResolver(itemKeys)];
|
|
42
|
+
})), [['sk', resolveSkillRecommendation]]));
|
|
43
|
+
var getQuickInsertSearchPriority = exports.getQuickInsertSearchPriority = function getQuickInsertSearchPriority(_ref3) {
|
|
44
|
+
var _RECOMMENDATIONS_BY_Q;
|
|
45
|
+
var itemKey = _ref3.itemKey,
|
|
46
|
+
query = _ref3.query;
|
|
47
|
+
var normalizedQuery = query.trim().toLowerCase();
|
|
48
|
+
return (_RECOMMENDATIONS_BY_Q = RECOMMENDATIONS_BY_QUERY.get(normalizedQuery)) === null || _RECOMMENDATIONS_BY_Q === void 0 ? void 0 : _RECOMMENDATIONS_BY_Q(itemKey);
|
|
49
|
+
};
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "134.0.
|
|
26
|
+
var packageVersion = "134.0.3";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createRenderedResultTracker = createRenderedResultTracker;
|
|
7
|
+
var _bindEventListener = require("bind-event-listener");
|
|
8
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
9
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
10
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
11
|
+
function createRenderedResultTracker(_ref) {
|
|
12
|
+
var onRendered = _ref.onRendered;
|
|
13
|
+
var resultId;
|
|
14
|
+
var _ready = false;
|
|
15
|
+
var intersects = false;
|
|
16
|
+
var element = null;
|
|
17
|
+
var observer;
|
|
18
|
+
var unbindVisibility;
|
|
19
|
+
var destroyed = false;
|
|
20
|
+
var emitted = new Set();
|
|
21
|
+
var updateIntersection = function updateIntersection(entries) {
|
|
22
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
23
|
+
_step;
|
|
24
|
+
try {
|
|
25
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
26
|
+
var entry = _step.value;
|
|
27
|
+
if (entry.target === element) {
|
|
28
|
+
intersects = entry.isIntersecting && entry.intersectionRatio > 0;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
} catch (err) {
|
|
32
|
+
_iterator.e(err);
|
|
33
|
+
} finally {
|
|
34
|
+
_iterator.f();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var emit = function emit() {
|
|
38
|
+
var _observer$takeRecords, _observer, _element;
|
|
39
|
+
if (destroyed || !_ready || resultId === undefined || emitted.has(resultId)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
updateIntersection((_observer$takeRecords = (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.takeRecords()) !== null && _observer$takeRecords !== void 0 ? _observer$takeRecords : []);
|
|
43
|
+
if (!intersects || ((_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.visibilityState) !== 'visible') {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
emitted.add(resultId);
|
|
47
|
+
onRendered(resultId);
|
|
48
|
+
};
|
|
49
|
+
var disconnect = function disconnect() {
|
|
50
|
+
var _observer2, _unbindVisibility;
|
|
51
|
+
(_observer2 = observer) === null || _observer2 === void 0 || _observer2.disconnect();
|
|
52
|
+
observer = undefined;
|
|
53
|
+
(_unbindVisibility = unbindVisibility) === null || _unbindVisibility === void 0 || _unbindVisibility();
|
|
54
|
+
unbindVisibility = undefined;
|
|
55
|
+
intersects = false;
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
setResult: function setResult(nextResultId) {
|
|
59
|
+
if (resultId !== nextResultId) {
|
|
60
|
+
resultId = nextResultId;
|
|
61
|
+
_ready = false;
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
ready: function ready(renderedResultId) {
|
|
65
|
+
if (resultId === renderedResultId) {
|
|
66
|
+
_ready = true;
|
|
67
|
+
emit();
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
observe: function observe(nextElement) {
|
|
71
|
+
if (destroyed || element === nextElement) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
disconnect();
|
|
75
|
+
element = nextElement;
|
|
76
|
+
if (element) {
|
|
77
|
+
observer = new IntersectionObserver(function (entries) {
|
|
78
|
+
updateIntersection(entries);
|
|
79
|
+
emit();
|
|
80
|
+
}, {
|
|
81
|
+
// The root property identifies what to observe in the viewport
|
|
82
|
+
// `null` will use the owning document (most likely the browser window)
|
|
83
|
+
root: null,
|
|
84
|
+
// Detect when overlap reaches 0.1% of the element's area
|
|
85
|
+
threshold: [0, 0.001]
|
|
86
|
+
});
|
|
87
|
+
observer.observe(element);
|
|
88
|
+
unbindVisibility = (0, _bindEventListener.bind)(element.ownerDocument, {
|
|
89
|
+
type: 'visibilitychange',
|
|
90
|
+
listener: emit
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
destroy: function destroy() {
|
|
95
|
+
destroyed = true;
|
|
96
|
+
disconnect();
|
|
97
|
+
element = null;
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
13
13
|
const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
14
14
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
15
15
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
16
|
-
const packageVersion = "134.0.
|
|
16
|
+
const packageVersion = "134.0.3";
|
|
17
17
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
18
18
|
// Remove URL as it has UGC
|
|
19
19
|
// Ignored via go/ees007
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Fuse from 'fuse.js';
|
|
2
2
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
3
|
+
import { getQuickInsertSearchPriority } from './getQuickInsertSearchPriority';
|
|
3
4
|
const options = {
|
|
4
5
|
includeScore: true,
|
|
5
6
|
keys: [{
|
|
@@ -31,6 +32,7 @@ export const createQuickInsertMatcher = getSearchData => {
|
|
|
31
32
|
let fuse;
|
|
32
33
|
const matcher = ({
|
|
33
34
|
formatMessage,
|
|
35
|
+
itemKey,
|
|
34
36
|
query
|
|
35
37
|
}) => {
|
|
36
38
|
const normalizedQuery = query.trim();
|
|
@@ -39,6 +41,13 @@ export const createQuickInsertMatcher = getSearchData => {
|
|
|
39
41
|
score: 0
|
|
40
42
|
};
|
|
41
43
|
}
|
|
44
|
+
const priority = getQuickInsertSearchPriority({
|
|
45
|
+
itemKey,
|
|
46
|
+
query
|
|
47
|
+
});
|
|
48
|
+
if (priority) {
|
|
49
|
+
return priority;
|
|
50
|
+
}
|
|
42
51
|
if (!fuse || cachedFormatMessage !== formatMessage) {
|
|
43
52
|
fuse = new Fuse([getSearchData({
|
|
44
53
|
formatMessage
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { getQuickInsertProviderMenuItemKey } from './getQuickInsertProviderMenuItemKey';
|
|
2
|
+
import { ACTION_MENU_ITEM, ASK_ROVO_MENU_ITEM, ASSETS_MENU_ITEM, BLOCKQUOTE_MENU_ITEM, BRAINSTORMING_MENU_ITEM, CODE_BLOCK_MENU_ITEM, CUSTOM_PANEL_MENU_ITEM, DATABASE_MENU_ITEM, DATE_MENU_ITEM, DECISION_MENU_ITEM, EMOJI_MENU_ITEM, ERROR_PANEL_MENU_ITEM, EXPAND_MENU_ITEM, FIVE_COLUMNS_LAYOUT_MENU_ITEM, FLOWCHART_MENU_ITEM, FOUR_COLUMNS_LAYOUT_MENU_ITEM, HEADING_1_MENU_ITEM, HEADING_2_MENU_ITEM, HEADING_3_MENU_ITEM, HEADING_4_MENU_ITEM, HEADING_5_MENU_ITEM, HEADING_6_MENU_ITEM, HYPERLINK_MENU_ITEM, INFO_PANEL_MENU_ITEM, JIRA_ISSUE_MENU_ITEM, JIRA_WORK_ITEMS_MENU_ITEM, LOOM_MENU_ITEM, MEDIA_INSERT_MENU_ITEM, NOTE_PANEL_MENU_ITEM, ORDERED_LIST_MENU_ITEM, ROADMAP_MENU_ITEM, RETROSPECTIVE_MENU_ITEM, RULE_MENU_ITEM, STATUS_MENU_ITEM, SUCCESS_PANEL_MENU_ITEM, SYNCED_BLOCK_MENU_ITEM, TABLE_MENU_ITEM, TABS_MENU_ITEM, THREE_COLUMNS_LAYOUT_MENU_ITEM, TWO_COLUMNS_LAYOUT_MENU_ITEM, WARNING_PANEL_MENU_ITEM, WHITEBOARD_MENU_ITEM } from './keys';
|
|
3
|
+
const SKILL_MENU_ITEM_KEY_PREFIX = getQuickInsertProviderMenuItemKey('skill:');
|
|
4
|
+
const RECOMMENDED_ITEM_KEYS_BY_QUERY = [['a', [ASK_ROVO_MENU_ITEM.key, ACTION_MENU_ITEM.key, ASSETS_MENU_ITEM.key]], ['b', [getQuickInsertProviderMenuItemKey('blog-posts:blog-posts'), getQuickInsertProviderMenuItemKey('snippet-extension:block-template'), getQuickInsertProviderMenuItemKey(BRAINSTORMING_MENU_ITEM.key)]], ['c', [CODE_BLOCK_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('cards:quick-insert'), getQuickInsertProviderMenuItemKey(JIRA_ISSUE_MENU_ITEM.key)]], ['d', [DATE_MENU_ITEM.key, DECISION_MENU_ITEM.key, RULE_MENU_ITEM.key]], ['e', [EMOJI_MENU_ITEM.key, EXPAND_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:embed')]], ['f', [INFO_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey(FLOWCHART_MENU_ITEM.key), getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:third-party-embed-figma')]], ['g', [WARNING_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:third-party-embed-google-drive')]], ['h', [HEADING_2_MENU_ITEM.key, HEADING_3_MENU_ITEM.key, HEADING_4_MENU_ITEM.key]], ['i', [MEDIA_INSERT_MENU_ITEM.key, INFO_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('iframe:iframe')]], ['j', [JIRA_WORK_ITEMS_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('jirachart:jirachart'), getQuickInsertProviderMenuItemKey(JIRA_ISSUE_MENU_ITEM.key)]], ['l', [LOOM_MENU_ITEM.key, HYPERLINK_MENU_ITEM.key, TWO_COLUMNS_LAYOUT_MENU_ITEM.key]], ['n', [ORDERED_LIST_MENU_ITEM.key, NOTE_PANEL_MENU_ITEM.key, SYNCED_BLOCK_MENU_ITEM.key]], ['p', [INFO_PANEL_MENU_ITEM.key, SUCCESS_PANEL_MENU_ITEM.key, WARNING_PANEL_MENU_ITEM.key, NOTE_PANEL_MENU_ITEM.key, CUSTOM_PANEL_MENU_ITEM.key]], ['q', [BLOCKQUOTE_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('questionslist-macro-native:questionslist-macro-native')]], ['r', [getQuickInsertProviderMenuItemKey(RETROSPECTIVE_MENU_ITEM.key), getQuickInsertProviderMenuItemKey(ROADMAP_MENU_ITEM.key), getQuickInsertProviderMenuItemKey('skill:response-draft')]], ['s', [STATUS_MENU_ITEM.key, SUCCESS_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('spotlight:quick-insert')]], ['t', [TABLE_MENU_ITEM.key, getQuickInsertProviderMenuItemKey(TABS_MENU_ITEM.key), getQuickInsertProviderMenuItemKey('toc:toc')]], ['w', [getQuickInsertProviderMenuItemKey(WHITEBOARD_MENU_ITEM.key), WARNING_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('skill:write-prd')]], ['x', [EXPAND_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('excerpt:excerpt'), getQuickInsertProviderMenuItemKey('skill:explain-workflow')]], ['y', [SYNCED_BLOCK_MENU_ITEM.key, TWO_COLUMNS_LAYOUT_MENU_ITEM.key, THREE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['co', [CODE_BLOCK_MENU_ITEM.key, TWO_COLUMNS_LAYOUT_MENU_ITEM.key, THREE_COLUMNS_LAYOUT_MENU_ITEM.key, FOUR_COLUMNS_LAYOUT_MENU_ITEM.key, FIVE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['pa', [INFO_PANEL_MENU_ITEM.key, NOTE_PANEL_MENU_ITEM.key, ERROR_PANEL_MENU_ITEM.key, SUCCESS_PANEL_MENU_ITEM.key, CUSTOM_PANEL_MENU_ITEM.key, EXPAND_MENU_ITEM.key]], ['pan', [INFO_PANEL_MENU_ITEM.key, NOTE_PANEL_MENU_ITEM.key, ERROR_PANEL_MENU_ITEM.key, SUCCESS_PANEL_MENU_ITEM.key, CUSTOM_PANEL_MENU_ITEM.key, EXPAND_MENU_ITEM.key]], ['ex', [EXPAND_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('excerpt:excerpt'), getQuickInsertProviderMenuItemKey('skill:explain-workflow')]], ['la', [TWO_COLUMNS_LAYOUT_MENU_ITEM.key, THREE_COLUMNS_LAYOUT_MENU_ITEM.key, FOUR_COLUMNS_LAYOUT_MENU_ITEM.key, FIVE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['he', [HEADING_4_MENU_ITEM.key, HEADING_6_MENU_ITEM.key, HEADING_1_MENU_ITEM.key, HEADING_2_MENU_ITEM.key, HEADING_3_MENU_ITEM.key, HEADING_5_MENU_ITEM.key]], ['ac', [ACTION_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('com.atlassian.streams.streams-jira-plugin:activitystream-gadget')]], ['act', [ACTION_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('com.atlassian.streams.streams-jira-plugin:activitystream-gadget')]], ['che', [ACTION_MENU_ITEM.key]], ['em', [EMOJI_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:embed'), getQuickInsertProviderMenuItemKey('database-extension:reference-database')]], ['fi', [MEDIA_INSERT_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:third-party-embed-figma'), getQuickInsertProviderMenuItemKey('skill:find-similar-incidents')]], ['fil', [MEDIA_INSERT_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('com.atlassian.jira.gadgets:filter-results-gadget')]], ['at', [MEDIA_INSERT_MENU_ITEM.key]], ['ji', [JIRA_WORK_ITEMS_MENU_ITEM.key, getQuickInsertProviderMenuItemKey(JIRA_ISSUE_MENU_ITEM.key)]], ['jira', [JIRA_WORK_ITEMS_MENU_ITEM.key]], ['db', [getQuickInsertProviderMenuItemKey(DATABASE_MENU_ITEM.key), getQuickInsertProviderMenuItemKey('skill:search-feedback')]], ['wb', [getQuickInsertProviderMenuItemKey(WHITEBOARD_MENU_ITEM.key)]], ['te', [getQuickInsertProviderMenuItemKey('snippet-extension:block-template'), getQuickInsertProviderMenuItemKey('create-from-template:create-from-template')]], ['tem', [getQuickInsertProviderMenuItemKey('snippet-extension:block-template'), getQuickInsertProviderMenuItemKey('create-from-template:create-from-template')]]];
|
|
5
|
+
const createRecommendationResolver = itemKeys => itemKey => {
|
|
6
|
+
const index = itemKeys.indexOf(itemKey);
|
|
7
|
+
return index === -1 ? undefined : {
|
|
8
|
+
priorityGroup: 0,
|
|
9
|
+
score: index / itemKeys.length
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// The "sk" query should place every skill ahead of ordinary search results, after Ask Rovo.
|
|
14
|
+
const resolveSkillRecommendation = itemKey => {
|
|
15
|
+
if (itemKey === ASK_ROVO_MENU_ITEM.key) {
|
|
16
|
+
return {
|
|
17
|
+
priorityGroup: 0,
|
|
18
|
+
score: 0
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return itemKey.startsWith(SKILL_MENU_ITEM_KEY_PREFIX) ? {
|
|
22
|
+
priorityGroup: 0,
|
|
23
|
+
score: 1
|
|
24
|
+
} : undefined;
|
|
25
|
+
};
|
|
26
|
+
const RECOMMENDATIONS_BY_QUERY = new Map([...RECOMMENDED_ITEM_KEYS_BY_QUERY.map(([query, itemKeys]) => [query, createRecommendationResolver(itemKeys)]), ['sk', resolveSkillRecommendation]]);
|
|
27
|
+
export const getQuickInsertSearchPriority = ({
|
|
28
|
+
itemKey,
|
|
29
|
+
query
|
|
30
|
+
}) => {
|
|
31
|
+
var _RECOMMENDATIONS_BY_Q;
|
|
32
|
+
const normalizedQuery = query.trim().toLowerCase();
|
|
33
|
+
return (_RECOMMENDATIONS_BY_Q = RECOMMENDATIONS_BY_QUERY.get(normalizedQuery)) === null || _RECOMMENDATIONS_BY_Q === void 0 ? void 0 : _RECOMMENDATIONS_BY_Q(itemKey);
|
|
34
|
+
};
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "134.0.
|
|
16
|
+
const packageVersion = "134.0.3";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { bind } from 'bind-event-listener';
|
|
2
|
+
export function createRenderedResultTracker({
|
|
3
|
+
onRendered
|
|
4
|
+
}) {
|
|
5
|
+
let resultId;
|
|
6
|
+
let ready = false;
|
|
7
|
+
let intersects = false;
|
|
8
|
+
let element = null;
|
|
9
|
+
let observer;
|
|
10
|
+
let unbindVisibility;
|
|
11
|
+
let destroyed = false;
|
|
12
|
+
const emitted = new Set();
|
|
13
|
+
const updateIntersection = entries => {
|
|
14
|
+
for (const entry of entries) {
|
|
15
|
+
if (entry.target === element) {
|
|
16
|
+
intersects = entry.isIntersecting && entry.intersectionRatio > 0;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const emit = () => {
|
|
21
|
+
var _observer$takeRecords, _observer, _element;
|
|
22
|
+
if (destroyed || !ready || resultId === undefined || emitted.has(resultId)) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
updateIntersection((_observer$takeRecords = (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.takeRecords()) !== null && _observer$takeRecords !== void 0 ? _observer$takeRecords : []);
|
|
26
|
+
if (!intersects || ((_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.visibilityState) !== 'visible') {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
emitted.add(resultId);
|
|
30
|
+
onRendered(resultId);
|
|
31
|
+
};
|
|
32
|
+
const disconnect = () => {
|
|
33
|
+
var _observer2, _unbindVisibility;
|
|
34
|
+
(_observer2 = observer) === null || _observer2 === void 0 ? void 0 : _observer2.disconnect();
|
|
35
|
+
observer = undefined;
|
|
36
|
+
(_unbindVisibility = unbindVisibility) === null || _unbindVisibility === void 0 ? void 0 : _unbindVisibility();
|
|
37
|
+
unbindVisibility = undefined;
|
|
38
|
+
intersects = false;
|
|
39
|
+
};
|
|
40
|
+
return {
|
|
41
|
+
setResult: nextResultId => {
|
|
42
|
+
if (resultId !== nextResultId) {
|
|
43
|
+
resultId = nextResultId;
|
|
44
|
+
ready = false;
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
ready: renderedResultId => {
|
|
48
|
+
if (resultId === renderedResultId) {
|
|
49
|
+
ready = true;
|
|
50
|
+
emit();
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
observe: nextElement => {
|
|
54
|
+
if (destroyed || element === nextElement) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
disconnect();
|
|
58
|
+
element = nextElement;
|
|
59
|
+
if (element) {
|
|
60
|
+
observer = new IntersectionObserver(entries => {
|
|
61
|
+
updateIntersection(entries);
|
|
62
|
+
emit();
|
|
63
|
+
}, {
|
|
64
|
+
// The root property identifies what to observe in the viewport
|
|
65
|
+
// `null` will use the owning document (most likely the browser window)
|
|
66
|
+
root: null,
|
|
67
|
+
// Detect when overlap reaches 0.1% of the element's area
|
|
68
|
+
threshold: [0, 0.001]
|
|
69
|
+
});
|
|
70
|
+
observer.observe(element);
|
|
71
|
+
unbindVisibility = bind(element.ownerDocument, {
|
|
72
|
+
type: 'visibilitychange',
|
|
73
|
+
listener: emit
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
destroy: () => {
|
|
78
|
+
destroyed = true;
|
|
79
|
+
disconnect();
|
|
80
|
+
element = null;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
19
19
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "134.0.
|
|
22
|
+
var packageVersion = "134.0.3";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Fuse from 'fuse.js';
|
|
2
2
|
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
3
|
+
import { getQuickInsertSearchPriority } from './getQuickInsertSearchPriority';
|
|
3
4
|
var options = {
|
|
4
5
|
includeScore: true,
|
|
5
6
|
keys: [{
|
|
@@ -33,6 +34,7 @@ var _createQuickInsertMatcher = function createQuickInsertMatcher(getSearchData)
|
|
|
33
34
|
var fuse;
|
|
34
35
|
var matcher = function matcher(_ref2) {
|
|
35
36
|
var formatMessage = _ref2.formatMessage,
|
|
37
|
+
itemKey = _ref2.itemKey,
|
|
36
38
|
query = _ref2.query;
|
|
37
39
|
var normalizedQuery = query.trim();
|
|
38
40
|
if (!normalizedQuery) {
|
|
@@ -40,6 +42,13 @@ var _createQuickInsertMatcher = function createQuickInsertMatcher(getSearchData)
|
|
|
40
42
|
score: 0
|
|
41
43
|
};
|
|
42
44
|
}
|
|
45
|
+
var priority = getQuickInsertSearchPriority({
|
|
46
|
+
itemKey: itemKey,
|
|
47
|
+
query: query
|
|
48
|
+
});
|
|
49
|
+
if (priority) {
|
|
50
|
+
return priority;
|
|
51
|
+
}
|
|
43
52
|
if (!fuse || cachedFormatMessage !== formatMessage) {
|
|
44
53
|
fuse = new Fuse([getSearchData({
|
|
45
54
|
formatMessage: formatMessage
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
3
|
+
import { getQuickInsertProviderMenuItemKey } from './getQuickInsertProviderMenuItemKey';
|
|
4
|
+
import { ACTION_MENU_ITEM, ASK_ROVO_MENU_ITEM, ASSETS_MENU_ITEM, BLOCKQUOTE_MENU_ITEM, BRAINSTORMING_MENU_ITEM, CODE_BLOCK_MENU_ITEM, CUSTOM_PANEL_MENU_ITEM, DATABASE_MENU_ITEM, DATE_MENU_ITEM, DECISION_MENU_ITEM, EMOJI_MENU_ITEM, ERROR_PANEL_MENU_ITEM, EXPAND_MENU_ITEM, FIVE_COLUMNS_LAYOUT_MENU_ITEM, FLOWCHART_MENU_ITEM, FOUR_COLUMNS_LAYOUT_MENU_ITEM, HEADING_1_MENU_ITEM, HEADING_2_MENU_ITEM, HEADING_3_MENU_ITEM, HEADING_4_MENU_ITEM, HEADING_5_MENU_ITEM, HEADING_6_MENU_ITEM, HYPERLINK_MENU_ITEM, INFO_PANEL_MENU_ITEM, JIRA_ISSUE_MENU_ITEM, JIRA_WORK_ITEMS_MENU_ITEM, LOOM_MENU_ITEM, MEDIA_INSERT_MENU_ITEM, NOTE_PANEL_MENU_ITEM, ORDERED_LIST_MENU_ITEM, ROADMAP_MENU_ITEM, RETROSPECTIVE_MENU_ITEM, RULE_MENU_ITEM, STATUS_MENU_ITEM, SUCCESS_PANEL_MENU_ITEM, SYNCED_BLOCK_MENU_ITEM, TABLE_MENU_ITEM, TABS_MENU_ITEM, THREE_COLUMNS_LAYOUT_MENU_ITEM, TWO_COLUMNS_LAYOUT_MENU_ITEM, WARNING_PANEL_MENU_ITEM, WHITEBOARD_MENU_ITEM } from './keys';
|
|
5
|
+
var SKILL_MENU_ITEM_KEY_PREFIX = getQuickInsertProviderMenuItemKey('skill:');
|
|
6
|
+
var RECOMMENDED_ITEM_KEYS_BY_QUERY = [['a', [ASK_ROVO_MENU_ITEM.key, ACTION_MENU_ITEM.key, ASSETS_MENU_ITEM.key]], ['b', [getQuickInsertProviderMenuItemKey('blog-posts:blog-posts'), getQuickInsertProviderMenuItemKey('snippet-extension:block-template'), getQuickInsertProviderMenuItemKey(BRAINSTORMING_MENU_ITEM.key)]], ['c', [CODE_BLOCK_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('cards:quick-insert'), getQuickInsertProviderMenuItemKey(JIRA_ISSUE_MENU_ITEM.key)]], ['d', [DATE_MENU_ITEM.key, DECISION_MENU_ITEM.key, RULE_MENU_ITEM.key]], ['e', [EMOJI_MENU_ITEM.key, EXPAND_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:embed')]], ['f', [INFO_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey(FLOWCHART_MENU_ITEM.key), getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:third-party-embed-figma')]], ['g', [WARNING_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:third-party-embed-google-drive')]], ['h', [HEADING_2_MENU_ITEM.key, HEADING_3_MENU_ITEM.key, HEADING_4_MENU_ITEM.key]], ['i', [MEDIA_INSERT_MENU_ITEM.key, INFO_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('iframe:iframe')]], ['j', [JIRA_WORK_ITEMS_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('jirachart:jirachart'), getQuickInsertProviderMenuItemKey(JIRA_ISSUE_MENU_ITEM.key)]], ['l', [LOOM_MENU_ITEM.key, HYPERLINK_MENU_ITEM.key, TWO_COLUMNS_LAYOUT_MENU_ITEM.key]], ['n', [ORDERED_LIST_MENU_ITEM.key, NOTE_PANEL_MENU_ITEM.key, SYNCED_BLOCK_MENU_ITEM.key]], ['p', [INFO_PANEL_MENU_ITEM.key, SUCCESS_PANEL_MENU_ITEM.key, WARNING_PANEL_MENU_ITEM.key, NOTE_PANEL_MENU_ITEM.key, CUSTOM_PANEL_MENU_ITEM.key]], ['q', [BLOCKQUOTE_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('questionslist-macro-native:questionslist-macro-native')]], ['r', [getQuickInsertProviderMenuItemKey(RETROSPECTIVE_MENU_ITEM.key), getQuickInsertProviderMenuItemKey(ROADMAP_MENU_ITEM.key), getQuickInsertProviderMenuItemKey('skill:response-draft')]], ['s', [STATUS_MENU_ITEM.key, SUCCESS_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('spotlight:quick-insert')]], ['t', [TABLE_MENU_ITEM.key, getQuickInsertProviderMenuItemKey(TABS_MENU_ITEM.key), getQuickInsertProviderMenuItemKey('toc:toc')]], ['w', [getQuickInsertProviderMenuItemKey(WHITEBOARD_MENU_ITEM.key), WARNING_PANEL_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('skill:write-prd')]], ['x', [EXPAND_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('excerpt:excerpt'), getQuickInsertProviderMenuItemKey('skill:explain-workflow')]], ['y', [SYNCED_BLOCK_MENU_ITEM.key, TWO_COLUMNS_LAYOUT_MENU_ITEM.key, THREE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['co', [CODE_BLOCK_MENU_ITEM.key, TWO_COLUMNS_LAYOUT_MENU_ITEM.key, THREE_COLUMNS_LAYOUT_MENU_ITEM.key, FOUR_COLUMNS_LAYOUT_MENU_ITEM.key, FIVE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['pa', [INFO_PANEL_MENU_ITEM.key, NOTE_PANEL_MENU_ITEM.key, ERROR_PANEL_MENU_ITEM.key, SUCCESS_PANEL_MENU_ITEM.key, CUSTOM_PANEL_MENU_ITEM.key, EXPAND_MENU_ITEM.key]], ['pan', [INFO_PANEL_MENU_ITEM.key, NOTE_PANEL_MENU_ITEM.key, ERROR_PANEL_MENU_ITEM.key, SUCCESS_PANEL_MENU_ITEM.key, CUSTOM_PANEL_MENU_ITEM.key, EXPAND_MENU_ITEM.key]], ['ex', [EXPAND_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('excerpt:excerpt'), getQuickInsertProviderMenuItemKey('skill:explain-workflow')]], ['la', [TWO_COLUMNS_LAYOUT_MENU_ITEM.key, THREE_COLUMNS_LAYOUT_MENU_ITEM.key, FOUR_COLUMNS_LAYOUT_MENU_ITEM.key, FIVE_COLUMNS_LAYOUT_MENU_ITEM.key]], ['he', [HEADING_4_MENU_ITEM.key, HEADING_6_MENU_ITEM.key, HEADING_1_MENU_ITEM.key, HEADING_2_MENU_ITEM.key, HEADING_3_MENU_ITEM.key, HEADING_5_MENU_ITEM.key]], ['ac', [ACTION_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('com.atlassian.streams.streams-jira-plugin:activitystream-gadget')]], ['act', [ACTION_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('com.atlassian.streams.streams-jira-plugin:activitystream-gadget')]], ['che', [ACTION_MENU_ITEM.key]], ['em', [EMOJI_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:embed'), getQuickInsertProviderMenuItemKey('database-extension:reference-database')]], ['fi', [MEDIA_INSERT_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('third-party-quick-insert-embeds:third-party-embed-figma'), getQuickInsertProviderMenuItemKey('skill:find-similar-incidents')]], ['fil', [MEDIA_INSERT_MENU_ITEM.key, getQuickInsertProviderMenuItemKey('com.atlassian.jira.gadgets:filter-results-gadget')]], ['at', [MEDIA_INSERT_MENU_ITEM.key]], ['ji', [JIRA_WORK_ITEMS_MENU_ITEM.key, getQuickInsertProviderMenuItemKey(JIRA_ISSUE_MENU_ITEM.key)]], ['jira', [JIRA_WORK_ITEMS_MENU_ITEM.key]], ['db', [getQuickInsertProviderMenuItemKey(DATABASE_MENU_ITEM.key), getQuickInsertProviderMenuItemKey('skill:search-feedback')]], ['wb', [getQuickInsertProviderMenuItemKey(WHITEBOARD_MENU_ITEM.key)]], ['te', [getQuickInsertProviderMenuItemKey('snippet-extension:block-template'), getQuickInsertProviderMenuItemKey('create-from-template:create-from-template')]], ['tem', [getQuickInsertProviderMenuItemKey('snippet-extension:block-template'), getQuickInsertProviderMenuItemKey('create-from-template:create-from-template')]]];
|
|
7
|
+
var createRecommendationResolver = function createRecommendationResolver(itemKeys) {
|
|
8
|
+
return function (itemKey) {
|
|
9
|
+
var index = itemKeys.indexOf(itemKey);
|
|
10
|
+
return index === -1 ? undefined : {
|
|
11
|
+
priorityGroup: 0,
|
|
12
|
+
score: index / itemKeys.length
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// The "sk" query should place every skill ahead of ordinary search results, after Ask Rovo.
|
|
18
|
+
var resolveSkillRecommendation = function resolveSkillRecommendation(itemKey) {
|
|
19
|
+
if (itemKey === ASK_ROVO_MENU_ITEM.key) {
|
|
20
|
+
return {
|
|
21
|
+
priorityGroup: 0,
|
|
22
|
+
score: 0
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return itemKey.startsWith(SKILL_MENU_ITEM_KEY_PREFIX) ? {
|
|
26
|
+
priorityGroup: 0,
|
|
27
|
+
score: 1
|
|
28
|
+
} : undefined;
|
|
29
|
+
};
|
|
30
|
+
var RECOMMENDATIONS_BY_QUERY = new Map([].concat(_toConsumableArray(RECOMMENDED_ITEM_KEYS_BY_QUERY.map(function (_ref) {
|
|
31
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
32
|
+
query = _ref2[0],
|
|
33
|
+
itemKeys = _ref2[1];
|
|
34
|
+
return [query, createRecommendationResolver(itemKeys)];
|
|
35
|
+
})), [['sk', resolveSkillRecommendation]]));
|
|
36
|
+
export var getQuickInsertSearchPriority = function getQuickInsertSearchPriority(_ref3) {
|
|
37
|
+
var _RECOMMENDATIONS_BY_Q;
|
|
38
|
+
var itemKey = _ref3.itemKey,
|
|
39
|
+
query = _ref3.query;
|
|
40
|
+
var normalizedQuery = query.trim().toLowerCase();
|
|
41
|
+
return (_RECOMMENDATIONS_BY_Q = RECOMMENDATIONS_BY_QUERY.get(normalizedQuery)) === null || _RECOMMENDATIONS_BY_Q === void 0 ? void 0 : _RECOMMENDATIONS_BY_Q(itemKey);
|
|
42
|
+
};
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "134.0.
|
|
23
|
+
var packageVersion = "134.0.3";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
|
+
import { bind } from 'bind-event-listener';
|
|
5
|
+
export function createRenderedResultTracker(_ref) {
|
|
6
|
+
var onRendered = _ref.onRendered;
|
|
7
|
+
var resultId;
|
|
8
|
+
var _ready = false;
|
|
9
|
+
var intersects = false;
|
|
10
|
+
var element = null;
|
|
11
|
+
var observer;
|
|
12
|
+
var unbindVisibility;
|
|
13
|
+
var destroyed = false;
|
|
14
|
+
var emitted = new Set();
|
|
15
|
+
var updateIntersection = function updateIntersection(entries) {
|
|
16
|
+
var _iterator = _createForOfIteratorHelper(entries),
|
|
17
|
+
_step;
|
|
18
|
+
try {
|
|
19
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
20
|
+
var entry = _step.value;
|
|
21
|
+
if (entry.target === element) {
|
|
22
|
+
intersects = entry.isIntersecting && entry.intersectionRatio > 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
} catch (err) {
|
|
26
|
+
_iterator.e(err);
|
|
27
|
+
} finally {
|
|
28
|
+
_iterator.f();
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
var emit = function emit() {
|
|
32
|
+
var _observer$takeRecords, _observer, _element;
|
|
33
|
+
if (destroyed || !_ready || resultId === undefined || emitted.has(resultId)) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
updateIntersection((_observer$takeRecords = (_observer = observer) === null || _observer === void 0 ? void 0 : _observer.takeRecords()) !== null && _observer$takeRecords !== void 0 ? _observer$takeRecords : []);
|
|
37
|
+
if (!intersects || ((_element = element) === null || _element === void 0 ? void 0 : _element.ownerDocument.visibilityState) !== 'visible') {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
emitted.add(resultId);
|
|
41
|
+
onRendered(resultId);
|
|
42
|
+
};
|
|
43
|
+
var disconnect = function disconnect() {
|
|
44
|
+
var _observer2, _unbindVisibility;
|
|
45
|
+
(_observer2 = observer) === null || _observer2 === void 0 || _observer2.disconnect();
|
|
46
|
+
observer = undefined;
|
|
47
|
+
(_unbindVisibility = unbindVisibility) === null || _unbindVisibility === void 0 || _unbindVisibility();
|
|
48
|
+
unbindVisibility = undefined;
|
|
49
|
+
intersects = false;
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
setResult: function setResult(nextResultId) {
|
|
53
|
+
if (resultId !== nextResultId) {
|
|
54
|
+
resultId = nextResultId;
|
|
55
|
+
_ready = false;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
ready: function ready(renderedResultId) {
|
|
59
|
+
if (resultId === renderedResultId) {
|
|
60
|
+
_ready = true;
|
|
61
|
+
emit();
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
observe: function observe(nextElement) {
|
|
65
|
+
if (destroyed || element === nextElement) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
disconnect();
|
|
69
|
+
element = nextElement;
|
|
70
|
+
if (element) {
|
|
71
|
+
observer = new IntersectionObserver(function (entries) {
|
|
72
|
+
updateIntersection(entries);
|
|
73
|
+
emit();
|
|
74
|
+
}, {
|
|
75
|
+
// The root property identifies what to observe in the viewport
|
|
76
|
+
// `null` will use the owning document (most likely the browser window)
|
|
77
|
+
root: null,
|
|
78
|
+
// Detect when overlap reaches 0.1% of the element's area
|
|
79
|
+
threshold: [0, 0.001]
|
|
80
|
+
});
|
|
81
|
+
observer.observe(element);
|
|
82
|
+
unbindVisibility = bind(element.ownerDocument, {
|
|
83
|
+
type: 'visibilitychange',
|
|
84
|
+
listener: emit
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
destroy: function destroy() {
|
|
89
|
+
destroyed = true;
|
|
90
|
+
disconnect();
|
|
91
|
+
element = null;
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type RenderedResultTracker = {
|
|
2
|
+
destroy: () => void;
|
|
3
|
+
observe: (element: HTMLElement | null) => void;
|
|
4
|
+
ready: (resultId: string) => void;
|
|
5
|
+
setResult: (resultId: string) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare function createRenderedResultTracker({ onRendered, }: {
|
|
8
|
+
onRendered: (resultId: string) => void;
|
|
9
|
+
}): RenderedResultTracker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "134.0
|
|
3
|
+
"version": "134.1.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.2.0",
|
|
50
50
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
51
51
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
52
|
-
"@atlaskit/editor-ui-control-model": "^
|
|
52
|
+
"@atlaskit/editor-ui-control-model": "^3.0.0",
|
|
53
53
|
"@atlaskit/emoji": "^73.1.0",
|
|
54
54
|
"@atlaskit/feature-gate-js-client": "^7.0.0",
|
|
55
55
|
"@atlaskit/icon": "^38.0.0",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@atlaskit/task-decision": "^21.13.0",
|
|
86
86
|
"@atlaskit/teams-app-config": "^3.1.0",
|
|
87
87
|
"@atlaskit/textfield": "^10.2.0",
|
|
88
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
88
|
+
"@atlaskit/tmp-editor-statsig": "^247.0.0",
|
|
89
89
|
"@atlaskit/tokens": "^20.8.0",
|
|
90
90
|
"@atlaskit/tooltip": "^24.4.0",
|
|
91
91
|
"@atlaskit/width-detector": "^7.2.0",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/rendered-result-tracker",
|
|
3
|
+
"main": "../dist/cjs/utils/rendered-result-tracker.js",
|
|
4
|
+
"module": "../dist/esm/utils/rendered-result-tracker.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/utils/rendered-result-tracker.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/utils/rendered-result-tracker.d.ts"
|
|
10
|
+
}
|