@atlaskit/editor-common 130.3.3 → 130.4.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 +34 -0
- package/dist/cjs/extensions/buildMenuItem.js +5 -2
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/build-quick-insert-menu-model.js +4 -2
- package/dist/cjs/quick-insert/get-matching-quick-insert-components.js +9 -6
- package/dist/cjs/quick-insert/quick-insert-rank.js +32 -0
- package/dist/cjs/type-ahead/item-rank.js +36 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/extensions/buildMenuItem.js +3 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/build-quick-insert-menu-model.js +4 -2
- package/dist/es2019/quick-insert/get-matching-quick-insert-components.js +9 -6
- package/dist/es2019/quick-insert/quick-insert-rank.js +28 -0
- package/dist/es2019/type-ahead/item-rank.js +27 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/extensions/buildMenuItem.js +5 -2
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/build-quick-insert-menu-model.js +4 -2
- package/dist/esm/quick-insert/get-matching-quick-insert-components.js +9 -6
- package/dist/esm/quick-insert/quick-insert-rank.js +27 -0
- package/dist/esm/type-ahead/item-rank.js +29 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/extensions/types/extension-manifest.d.ts +1 -0
- package/dist/types/extensions/types/utils.d.ts +1 -0
- package/dist/types/quick-insert/build-quick-insert-menu-model.d.ts +2 -1
- package/dist/types/quick-insert/get-matching-quick-insert-components.d.ts +3 -1
- package/dist/types/quick-insert/quick-insert-rank.d.ts +3 -0
- package/dist/types/type-ahead/item-rank.d.ts +12 -0
- package/dist/types/types/annotation/index.d.ts +2 -0
- package/dist/types/types/quick-insert.d.ts +2 -0
- package/dist/types/types/type-ahead.d.ts +3 -0
- package/package.json +1 -1
- package/quick-insert/quick-insert-rank/package.json +10 -0
- package/type-ahead/item-rank/package.json +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 130.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`5f335f67f55d9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5f335f67f55d9) -
|
|
8
|
+
[ux] Separate existing extension comment viewing from creation in the renderer behind
|
|
9
|
+
`cc_maui_annotations_on_extensions`. Add an optional `canCreateCommentOnBlockNode` provider
|
|
10
|
+
predicate that controls whether a supported extension can be targeted for new comments, so
|
|
11
|
+
Confluence can keep existing chart threads accessible while `cc_maui_comments_on_charts_exp`
|
|
12
|
+
disables new-thread creation.
|
|
13
|
+
|
|
14
|
+
Avoid subscribing extension nodes to annotation contexts when `cc_maui_annotations_on_extensions`
|
|
15
|
+
is disabled, preventing annotation hover updates from rerendering unrelated extensions.
|
|
16
|
+
|
|
17
|
+
- [`1c4db454a74a2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1c4db454a74a2) -
|
|
18
|
+
Registered menu hosts can override section and item ranks through getItemRank in the shared
|
|
19
|
+
ordering used by Quick Insert, type-ahead, and insert menus. Rovo editor presets group these
|
|
20
|
+
settings under quickInsertOptions. Typeahead handlers expose getRegisteredItemRank with a
|
|
21
|
+
RegisteredItemRankResolver that receives the registered component and its ranked parent. Skill
|
|
22
|
+
manifests and adapters accept visibility predicates that follow current chat state without
|
|
23
|
+
rebuilding registrations.
|
|
24
|
+
|
|
25
|
+
Under platform_editor_slash_command, main and inline Rovo chat show Rovo commands first and use
|
|
26
|
+
specialist placeholders. The chat skills layer receives selectedAgentId and respects the existing
|
|
27
|
+
enableSkillsInSpecialistPromptInput setting. Treatment keeps registrations and evaluates
|
|
28
|
+
visibility per item. Control keeps the legacy full-or-empty manifest and the same host opt-in.
|
|
29
|
+
Search mode and an existing prompt skill still prevent insertion.
|
|
30
|
+
|
|
31
|
+
Affected Jira, JSM, and Confluence skills require the signed-in user's product access at the site,
|
|
32
|
+
in addition to backend filtering of declared site entitlements. Skill Builder needs Studio and the
|
|
33
|
+
signed-in user's Rovo AI entitlement for that site. Eligibility requests follow site changes; user
|
|
34
|
+
identity remains stable during the signed-in session. Visibility reads committed React state and
|
|
35
|
+
supports server rendering.
|
|
36
|
+
|
|
3
37
|
## 130.3.3
|
|
4
38
|
|
|
5
39
|
### Patch Changes
|
|
@@ -20,7 +20,7 @@ function buildMenuItem(manifest, extensionModule) {
|
|
|
20
20
|
if (!node) {
|
|
21
21
|
throw new Error("Couldn't find any action for ".concat(title, " (").concat(key, ")"));
|
|
22
22
|
}
|
|
23
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
23
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
24
24
|
app: (_ref = (_extensionModule$app = extensionModule.app) !== null && _extensionModule$app !== void 0 ? _extensionModule$app : manifest.app) !== null && _ref !== void 0 ? _ref : {
|
|
25
25
|
key: manifest.key
|
|
26
26
|
},
|
|
@@ -44,7 +44,10 @@ function buildMenuItem(manifest, extensionModule) {
|
|
|
44
44
|
}), extensionModule.lozenge != null && {
|
|
45
45
|
lozenge: extensionModule.lozenge
|
|
46
46
|
}), {}, {
|
|
47
|
-
icon: extensionModule.icon || manifest.icons['48']
|
|
47
|
+
icon: extensionModule.icon || manifest.icons['48']
|
|
48
|
+
}, extensionModule.isHidden ? {
|
|
49
|
+
isHidden: extensionModule.isHidden
|
|
50
|
+
} : {}), {}, {
|
|
48
51
|
node: node
|
|
49
52
|
});
|
|
50
53
|
}
|
|
@@ -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 = "130.3.
|
|
30
|
+
var packageVersion = "130.3.3";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -9,11 +9,13 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
10
10
|
var _isMenuFooterSectionKey = require("../type-ahead/isMenuFooterSectionKey");
|
|
11
11
|
var _isSectionOverflowItemKey = require("../type-ahead/isSectionOverflowItemKey");
|
|
12
|
+
var _itemRank = require("../type-ahead/item-rank");
|
|
12
13
|
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; } } }; }
|
|
13
14
|
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; } }
|
|
14
15
|
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; }
|
|
15
|
-
var buildQuickInsertMenuModel = exports.buildQuickInsertMenuModel = function buildQuickInsertMenuModel(components, rootComponent, selectCategoryItems, surfaceContext) {
|
|
16
|
-
var
|
|
16
|
+
var buildQuickInsertMenuModel = exports.buildQuickInsertMenuModel = function buildQuickInsertMenuModel(components, rootComponent, selectCategoryItems, surfaceContext, getItemRank) {
|
|
17
|
+
var rankedComponents = (0, _itemRank.applyRegisteredItemRanks)(components, getItemRank);
|
|
18
|
+
var _resolveSurface = (0, _surfaceRenderer.resolveSurface)(rankedComponents, rootComponent),
|
|
17
19
|
root = _resolveSurface.root,
|
|
18
20
|
childrenMap = _resolveSurface.childrenMap,
|
|
19
21
|
topLevelChildren = _resolveSurface.topLevelChildren;
|
|
@@ -9,12 +9,13 @@ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers
|
|
|
9
9
|
var _surfaceRenderer = require("@atlaskit/editor-ui-control-model/surface-renderer");
|
|
10
10
|
var _isMenuFooterSectionKey = require("../type-ahead/isMenuFooterSectionKey");
|
|
11
11
|
var _isSectionOverflowItemKey = require("../type-ahead/isSectionOverflowItemKey");
|
|
12
|
+
var _itemRank = require("../type-ahead/item-rank");
|
|
12
13
|
var _keys = require("./keys");
|
|
13
14
|
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; } } }; }
|
|
14
15
|
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; } }
|
|
15
16
|
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; }
|
|
16
17
|
var SEARCH_TOP_MATCH_LIMIT = 5;
|
|
17
|
-
var
|
|
18
|
+
var getParentRank = function getParentRank(component, parentKey) {
|
|
18
19
|
var _component$parents$fi, _component$parents;
|
|
19
20
|
return (_component$parents$fi = (_component$parents = component.parents) === null || _component$parents === void 0 || (_component$parents = _component$parents.find(function (parent) {
|
|
20
21
|
return parent.key === parentKey;
|
|
@@ -52,8 +53,10 @@ var getMatchingQuickInsertComponents = exports.getMatchingQuickInsertComponents
|
|
|
52
53
|
rootComponent = _ref4.rootComponent,
|
|
53
54
|
query = _ref4.query,
|
|
54
55
|
formatMessage = _ref4.formatMessage,
|
|
55
|
-
surfaceContext = _ref4.surfaceContext
|
|
56
|
-
|
|
56
|
+
surfaceContext = _ref4.surfaceContext,
|
|
57
|
+
getItemRank = _ref4.getItemRank;
|
|
58
|
+
var rankedComponents = (0, _itemRank.applyRegisteredItemRanks)(components, getItemRank);
|
|
59
|
+
var _resolveSurface = (0, _surfaceRenderer.resolveSurface)(rankedComponents, rootComponent),
|
|
57
60
|
childrenMap = _resolveSurface.childrenMap,
|
|
58
61
|
root = _resolveSurface.root,
|
|
59
62
|
topLevelChildren = _resolveSurface.topLevelChildren;
|
|
@@ -65,7 +68,7 @@ var getMatchingQuickInsertComponents = exports.getMatchingQuickInsertComponents
|
|
|
65
68
|
};
|
|
66
69
|
}
|
|
67
70
|
var matches = new Map();
|
|
68
|
-
var sourceIndexByComponent = new Map(
|
|
71
|
+
var sourceIndexByComponent = new Map(rankedComponents.map(function (component, index) {
|
|
69
72
|
return [component, index];
|
|
70
73
|
}));
|
|
71
74
|
var _iterator = _createForOfIteratorHelper(topLevelChildren),
|
|
@@ -96,11 +99,11 @@ var getMatchingQuickInsertComponents = exports.getMatchingQuickInsertComponents
|
|
|
96
99
|
var candidate = {
|
|
97
100
|
identity: "".concat(item.type, ":").concat(item.key),
|
|
98
101
|
item: item,
|
|
99
|
-
itemRank:
|
|
102
|
+
itemRank: getParentRank(item, section.key),
|
|
100
103
|
score: Math.min(1, Math.max(0, (_match$score = match === null || match === void 0 ? void 0 : match.score) !== null && _match$score !== void 0 ? _match$score : 0)),
|
|
101
104
|
sourceIndex: (_sourceIndexByCompone = sourceIndexByComponent.get(item)) !== null && _sourceIndexByCompone !== void 0 ? _sourceIndexByCompone : Number.MAX_SAFE_INTEGER,
|
|
102
105
|
section: section,
|
|
103
|
-
sectionRank:
|
|
106
|
+
sectionRank: getParentRank(section, root.key)
|
|
104
107
|
};
|
|
105
108
|
var existing = matches.get(candidate.identity);
|
|
106
109
|
if (!existing || compareMatchedItems(candidate, existing) < 0) {
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createQuickInsertRankResolver = void 0;
|
|
7
|
+
var _isMenuFooterSectionKey = require("../type-ahead/isMenuFooterSectionKey");
|
|
8
|
+
var _isSectionOverflowItemKey = require("../type-ahead/isSectionOverflowItemKey");
|
|
9
|
+
var _keys = require("./keys");
|
|
10
|
+
/** Recommendations and navigation controls retain their policy-defined order. */
|
|
11
|
+
var createQuickInsertRankResolver = exports.createQuickInsertRankResolver = function createQuickInsertRankResolver(getItemRank) {
|
|
12
|
+
if (!getItemRank) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return function (_ref) {
|
|
16
|
+
var component = _ref.component,
|
|
17
|
+
parent = _ref.parent;
|
|
18
|
+
if (component.type === 'menu-section' && parent.type === 'menu' && !(0, _isMenuFooterSectionKey.isMenuFooterSectionKey)(component.key)) {
|
|
19
|
+
return getItemRank({
|
|
20
|
+
component: component,
|
|
21
|
+
parent: parent
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
if (component.type === 'menu-item' && parent.type === 'menu-section' && !(0, _isSectionOverflowItemKey.isSectionOverflowItemKey)(component.key) && !(0, _isMenuFooterSectionKey.isMenuFooterSectionKey)(parent.key) && parent.key !== _keys.RECOMMENDED_SECTION.key) {
|
|
25
|
+
return getItemRank({
|
|
26
|
+
component: component,
|
|
27
|
+
parent: parent
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.applyRegisteredItemRanks = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
11
|
+
/** Pure parent-rank override. Return undefined to preserve parent.rank; do not mutate either record. */
|
|
12
|
+
|
|
13
|
+
/** Applies per-editor parent ranks without changing shared registry records. */
|
|
14
|
+
var applyRegisteredItemRanks = exports.applyRegisteredItemRanks = function applyRegisteredItemRanks(components, getRegisteredItemRank) {
|
|
15
|
+
if (!getRegisteredItemRank) {
|
|
16
|
+
return components;
|
|
17
|
+
}
|
|
18
|
+
return components.map(function (component) {
|
|
19
|
+
if (!component.parents) {
|
|
20
|
+
return component;
|
|
21
|
+
}
|
|
22
|
+
var parents = component.parents.map(function (parent) {
|
|
23
|
+
var _getRegisteredItemRan;
|
|
24
|
+
var rank = (_getRegisteredItemRan = getRegisteredItemRank({
|
|
25
|
+
component: component,
|
|
26
|
+
parent: parent
|
|
27
|
+
})) === null || _getRegisteredItemRan === void 0 ? void 0 : _getRegisteredItemRan.rank;
|
|
28
|
+
return _objectSpread(_objectSpread({}, parent), {}, {
|
|
29
|
+
rank: typeof rank === 'number' && Number.isFinite(rank) ? rank : parent.rank
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
return Object.assign({}, component, {
|
|
33
|
+
parents: parents
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
};
|
|
@@ -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 = "130.3.
|
|
27
|
+
var packageVersion = "130.3.3";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -38,6 +38,9 @@ export function buildMenuItem(manifest, extensionModule) {
|
|
|
38
38
|
lozenge: extensionModule.lozenge
|
|
39
39
|
}),
|
|
40
40
|
icon: extensionModule.icon || manifest.icons['48'],
|
|
41
|
+
...(extensionModule.isHidden ? {
|
|
42
|
+
isHidden: extensionModule.isHidden
|
|
43
|
+
} : {}),
|
|
41
44
|
node
|
|
42
45
|
};
|
|
43
46
|
}
|
|
@@ -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 = "130.3.
|
|
16
|
+
const packageVersion = "130.3.3";
|
|
17
17
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
18
18
|
// Remove URL as it has UGC
|
|
19
19
|
// Ignored via go/ees007
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { getComponentIdentity, resolveSurface, willComponentRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
2
2
|
import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
|
|
3
3
|
import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
|
|
4
|
-
|
|
4
|
+
import { applyRegisteredItemRanks } from '../type-ahead/item-rank';
|
|
5
|
+
export const buildQuickInsertMenuModel = (components, rootComponent, selectCategoryItems, surfaceContext, getItemRank) => {
|
|
6
|
+
const rankedComponents = applyRegisteredItemRanks(components, getItemRank);
|
|
5
7
|
const {
|
|
6
8
|
root,
|
|
7
9
|
childrenMap,
|
|
8
10
|
topLevelChildren
|
|
9
|
-
} = resolveSurface(
|
|
11
|
+
} = resolveSurface(rankedComponents, rootComponent);
|
|
10
12
|
if (!root || !willComponentRender(root, childrenMap, surfaceContext)) {
|
|
11
13
|
return {
|
|
12
14
|
footer: undefined,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { getComponentIdentity, resolveSurface, willComponentRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
2
2
|
import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
|
|
3
3
|
import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
|
|
4
|
+
import { applyRegisteredItemRanks } from '../type-ahead/item-rank';
|
|
4
5
|
import { ASK_ROVO_MENU_ITEM } from './keys';
|
|
5
6
|
const SEARCH_TOP_MATCH_LIMIT = 5;
|
|
6
|
-
const
|
|
7
|
+
const getParentRank = (component, parentKey) => {
|
|
7
8
|
var _component$parents$fi, _component$parents, _component$parents$fi2;
|
|
8
9
|
return (_component$parents$fi = (_component$parents = component.parents) === null || _component$parents === void 0 ? void 0 : (_component$parents$fi2 = _component$parents.find(parent => parent.key === parentKey)) === null || _component$parents$fi2 === void 0 ? void 0 : _component$parents$fi2.rank) !== null && _component$parents$fi !== void 0 ? _component$parents$fi : Number.MAX_SAFE_INTEGER;
|
|
9
10
|
};
|
|
@@ -31,14 +32,16 @@ export const getMatchingQuickInsertComponents = ({
|
|
|
31
32
|
rootComponent,
|
|
32
33
|
query,
|
|
33
34
|
formatMessage,
|
|
34
|
-
surfaceContext
|
|
35
|
+
surfaceContext,
|
|
36
|
+
getItemRank
|
|
35
37
|
}) => {
|
|
36
38
|
var _childrenMap$get2;
|
|
39
|
+
const rankedComponents = applyRegisteredItemRanks(components, getItemRank);
|
|
37
40
|
const {
|
|
38
41
|
childrenMap,
|
|
39
42
|
root,
|
|
40
43
|
topLevelChildren
|
|
41
|
-
} = resolveSurface(
|
|
44
|
+
} = resolveSurface(rankedComponents, rootComponent);
|
|
42
45
|
if (!root || !willComponentRender(root, childrenMap, surfaceContext) || !topLevelChildren) {
|
|
43
46
|
return {
|
|
44
47
|
footer: undefined,
|
|
@@ -47,7 +50,7 @@ export const getMatchingQuickInsertComponents = ({
|
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
const matches = new Map();
|
|
50
|
-
const sourceIndexByComponent = new Map(
|
|
53
|
+
const sourceIndexByComponent = new Map(rankedComponents.map((component, index) => [component, index]));
|
|
51
54
|
for (const section of topLevelChildren) {
|
|
52
55
|
if (section.type !== 'menu-section' || isMenuFooterSectionKey(section.key) || !willComponentRender(section, childrenMap, surfaceContext)) {
|
|
53
56
|
continue;
|
|
@@ -67,11 +70,11 @@ export const getMatchingQuickInsertComponents = ({
|
|
|
67
70
|
const candidate = {
|
|
68
71
|
identity: `${item.type}:${item.key}`,
|
|
69
72
|
item,
|
|
70
|
-
itemRank:
|
|
73
|
+
itemRank: getParentRank(item, section.key),
|
|
71
74
|
score: Math.min(1, Math.max(0, (_match$score = match === null || match === void 0 ? void 0 : match.score) !== null && _match$score !== void 0 ? _match$score : 0)),
|
|
72
75
|
sourceIndex: (_sourceIndexByCompone = sourceIndexByComponent.get(item)) !== null && _sourceIndexByCompone !== void 0 ? _sourceIndexByCompone : Number.MAX_SAFE_INTEGER,
|
|
73
76
|
section,
|
|
74
|
-
sectionRank:
|
|
77
|
+
sectionRank: getParentRank(section, root.key)
|
|
75
78
|
};
|
|
76
79
|
const existing = matches.get(candidate.identity);
|
|
77
80
|
if (!existing || compareMatchedItems(candidate, existing) < 0) {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
|
|
2
|
+
import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
|
|
3
|
+
import { RECOMMENDED_SECTION } from './keys';
|
|
4
|
+
|
|
5
|
+
/** Recommendations and navigation controls retain their policy-defined order. */
|
|
6
|
+
export const createQuickInsertRankResolver = getItemRank => {
|
|
7
|
+
if (!getItemRank) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
return ({
|
|
11
|
+
component,
|
|
12
|
+
parent
|
|
13
|
+
}) => {
|
|
14
|
+
if (component.type === 'menu-section' && parent.type === 'menu' && !isMenuFooterSectionKey(component.key)) {
|
|
15
|
+
return getItemRank({
|
|
16
|
+
component,
|
|
17
|
+
parent
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
if (component.type === 'menu-item' && parent.type === 'menu-section' && !isSectionOverflowItemKey(component.key) && !isMenuFooterSectionKey(parent.key) && parent.key !== RECOMMENDED_SECTION.key) {
|
|
21
|
+
return getItemRank({
|
|
22
|
+
component,
|
|
23
|
+
parent
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return undefined;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/** Pure parent-rank override. Return undefined to preserve parent.rank; do not mutate either record. */
|
|
2
|
+
|
|
3
|
+
/** Applies per-editor parent ranks without changing shared registry records. */
|
|
4
|
+
export const applyRegisteredItemRanks = (components, getRegisteredItemRank) => {
|
|
5
|
+
if (!getRegisteredItemRank) {
|
|
6
|
+
return components;
|
|
7
|
+
}
|
|
8
|
+
return components.map(component => {
|
|
9
|
+
if (!component.parents) {
|
|
10
|
+
return component;
|
|
11
|
+
}
|
|
12
|
+
const parents = component.parents.map(parent => {
|
|
13
|
+
var _getRegisteredItemRan;
|
|
14
|
+
const rank = (_getRegisteredItemRan = getRegisteredItemRank({
|
|
15
|
+
component,
|
|
16
|
+
parent
|
|
17
|
+
})) === null || _getRegisteredItemRan === void 0 ? void 0 : _getRegisteredItemRan.rank;
|
|
18
|
+
return {
|
|
19
|
+
...parent,
|
|
20
|
+
rank: typeof rank === 'number' && Number.isFinite(rank) ? rank : parent.rank
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
return Object.assign({}, component, {
|
|
24
|
+
parents
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
};
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "130.3.
|
|
17
|
+
const packageVersion = "130.3.3";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -13,7 +13,7 @@ export function buildMenuItem(manifest, extensionModule) {
|
|
|
13
13
|
if (!node) {
|
|
14
14
|
throw new Error("Couldn't find any action for ".concat(title, " (").concat(key, ")"));
|
|
15
15
|
}
|
|
16
|
-
return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
16
|
+
return _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
17
17
|
app: (_ref = (_extensionModule$app = extensionModule.app) !== null && _extensionModule$app !== void 0 ? _extensionModule$app : manifest.app) !== null && _ref !== void 0 ? _ref : {
|
|
18
18
|
key: manifest.key
|
|
19
19
|
},
|
|
@@ -37,7 +37,10 @@ export function buildMenuItem(manifest, extensionModule) {
|
|
|
37
37
|
}), extensionModule.lozenge != null && {
|
|
38
38
|
lozenge: extensionModule.lozenge
|
|
39
39
|
}), {}, {
|
|
40
|
-
icon: extensionModule.icon || manifest.icons['48']
|
|
40
|
+
icon: extensionModule.icon || manifest.icons['48']
|
|
41
|
+
}, extensionModule.isHidden ? {
|
|
42
|
+
isHidden: extensionModule.isHidden
|
|
43
|
+
} : {}), {}, {
|
|
41
44
|
node: node
|
|
42
45
|
});
|
|
43
46
|
}
|
|
@@ -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 = "130.3.
|
|
22
|
+
var packageVersion = "130.3.3";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -5,8 +5,10 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
5
5
|
import { getComponentIdentity, resolveSurface, willComponentRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
6
6
|
import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
|
|
7
7
|
import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import { applyRegisteredItemRanks } from '../type-ahead/item-rank';
|
|
9
|
+
export var buildQuickInsertMenuModel = function buildQuickInsertMenuModel(components, rootComponent, selectCategoryItems, surfaceContext, getItemRank) {
|
|
10
|
+
var rankedComponents = applyRegisteredItemRanks(components, getItemRank);
|
|
11
|
+
var _resolveSurface = resolveSurface(rankedComponents, rootComponent),
|
|
10
12
|
root = _resolveSurface.root,
|
|
11
13
|
childrenMap = _resolveSurface.childrenMap,
|
|
12
14
|
topLevelChildren = _resolveSurface.topLevelChildren;
|
|
@@ -5,9 +5,10 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
5
5
|
import { getComponentIdentity, resolveSurface, willComponentRender } from '@atlaskit/editor-ui-control-model/surface-renderer';
|
|
6
6
|
import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
|
|
7
7
|
import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
|
|
8
|
+
import { applyRegisteredItemRanks } from '../type-ahead/item-rank';
|
|
8
9
|
import { ASK_ROVO_MENU_ITEM } from './keys';
|
|
9
10
|
var SEARCH_TOP_MATCH_LIMIT = 5;
|
|
10
|
-
var
|
|
11
|
+
var getParentRank = function getParentRank(component, parentKey) {
|
|
11
12
|
var _component$parents$fi, _component$parents;
|
|
12
13
|
return (_component$parents$fi = (_component$parents = component.parents) === null || _component$parents === void 0 || (_component$parents = _component$parents.find(function (parent) {
|
|
13
14
|
return parent.key === parentKey;
|
|
@@ -45,8 +46,10 @@ export var getMatchingQuickInsertComponents = function getMatchingQuickInsertCom
|
|
|
45
46
|
rootComponent = _ref4.rootComponent,
|
|
46
47
|
query = _ref4.query,
|
|
47
48
|
formatMessage = _ref4.formatMessage,
|
|
48
|
-
surfaceContext = _ref4.surfaceContext
|
|
49
|
-
|
|
49
|
+
surfaceContext = _ref4.surfaceContext,
|
|
50
|
+
getItemRank = _ref4.getItemRank;
|
|
51
|
+
var rankedComponents = applyRegisteredItemRanks(components, getItemRank);
|
|
52
|
+
var _resolveSurface = resolveSurface(rankedComponents, rootComponent),
|
|
50
53
|
childrenMap = _resolveSurface.childrenMap,
|
|
51
54
|
root = _resolveSurface.root,
|
|
52
55
|
topLevelChildren = _resolveSurface.topLevelChildren;
|
|
@@ -58,7 +61,7 @@ export var getMatchingQuickInsertComponents = function getMatchingQuickInsertCom
|
|
|
58
61
|
};
|
|
59
62
|
}
|
|
60
63
|
var matches = new Map();
|
|
61
|
-
var sourceIndexByComponent = new Map(
|
|
64
|
+
var sourceIndexByComponent = new Map(rankedComponents.map(function (component, index) {
|
|
62
65
|
return [component, index];
|
|
63
66
|
}));
|
|
64
67
|
var _iterator = _createForOfIteratorHelper(topLevelChildren),
|
|
@@ -89,11 +92,11 @@ export var getMatchingQuickInsertComponents = function getMatchingQuickInsertCom
|
|
|
89
92
|
var candidate = {
|
|
90
93
|
identity: "".concat(item.type, ":").concat(item.key),
|
|
91
94
|
item: item,
|
|
92
|
-
itemRank:
|
|
95
|
+
itemRank: getParentRank(item, section.key),
|
|
93
96
|
score: Math.min(1, Math.max(0, (_match$score = match === null || match === void 0 ? void 0 : match.score) !== null && _match$score !== void 0 ? _match$score : 0)),
|
|
94
97
|
sourceIndex: (_sourceIndexByCompone = sourceIndexByComponent.get(item)) !== null && _sourceIndexByCompone !== void 0 ? _sourceIndexByCompone : Number.MAX_SAFE_INTEGER,
|
|
95
98
|
section: section,
|
|
96
|
-
sectionRank:
|
|
99
|
+
sectionRank: getParentRank(section, root.key)
|
|
97
100
|
};
|
|
98
101
|
var existing = matches.get(candidate.identity);
|
|
99
102
|
if (!existing || compareMatchedItems(candidate, existing) < 0) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
|
|
2
|
+
import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
|
|
3
|
+
import { RECOMMENDED_SECTION } from './keys';
|
|
4
|
+
|
|
5
|
+
/** Recommendations and navigation controls retain their policy-defined order. */
|
|
6
|
+
export var createQuickInsertRankResolver = function createQuickInsertRankResolver(getItemRank) {
|
|
7
|
+
if (!getItemRank) {
|
|
8
|
+
return undefined;
|
|
9
|
+
}
|
|
10
|
+
return function (_ref) {
|
|
11
|
+
var component = _ref.component,
|
|
12
|
+
parent = _ref.parent;
|
|
13
|
+
if (component.type === 'menu-section' && parent.type === 'menu' && !isMenuFooterSectionKey(component.key)) {
|
|
14
|
+
return getItemRank({
|
|
15
|
+
component: component,
|
|
16
|
+
parent: parent
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
if (component.type === 'menu-item' && parent.type === 'menu-section' && !isSectionOverflowItemKey(component.key) && !isMenuFooterSectionKey(parent.key) && parent.key !== RECOMMENDED_SECTION.key) {
|
|
20
|
+
return getItemRank({
|
|
21
|
+
component: component,
|
|
22
|
+
parent: parent
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
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; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
/** Pure parent-rank override. Return undefined to preserve parent.rank; do not mutate either record. */
|
|
5
|
+
|
|
6
|
+
/** Applies per-editor parent ranks without changing shared registry records. */
|
|
7
|
+
export var applyRegisteredItemRanks = function applyRegisteredItemRanks(components, getRegisteredItemRank) {
|
|
8
|
+
if (!getRegisteredItemRank) {
|
|
9
|
+
return components;
|
|
10
|
+
}
|
|
11
|
+
return components.map(function (component) {
|
|
12
|
+
if (!component.parents) {
|
|
13
|
+
return component;
|
|
14
|
+
}
|
|
15
|
+
var parents = component.parents.map(function (parent) {
|
|
16
|
+
var _getRegisteredItemRan;
|
|
17
|
+
var rank = (_getRegisteredItemRan = getRegisteredItemRank({
|
|
18
|
+
component: component,
|
|
19
|
+
parent: parent
|
|
20
|
+
})) === null || _getRegisteredItemRan === void 0 ? void 0 : _getRegisteredItemRan.rank;
|
|
21
|
+
return _objectSpread(_objectSpread({}, parent), {}, {
|
|
22
|
+
rank: typeof rank === 'number' && Number.isFinite(rank) ? rank : parent.rank
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return Object.assign({}, component, {
|
|
26
|
+
parents: parents
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
};
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "130.3.
|
|
24
|
+
var packageVersion = "130.3.3";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { SurfaceIdentifier } from '@atlaskit/editor-ui-control-model/surface-renderer/types';
|
|
2
2
|
import type { RegisterComponent, RegisterMenuItem, RegisterMenuSection, SurfaceContext } from '@atlaskit/editor-ui-control-model/types';
|
|
3
|
+
import { type RegisteredItemRankResolver } from '../type-ahead/item-rank';
|
|
3
4
|
import type { QuickInsertCategoryItemSelectionPolicy } from './selectQuickInsertCategoryItems';
|
|
4
5
|
export type QuickInsertMenuSection = [RegisterMenuSection, ...RegisterMenuItem[]];
|
|
5
6
|
export type QuickInsertMenuModel = {
|
|
@@ -9,4 +10,4 @@ export type QuickInsertMenuModel = {
|
|
|
9
10
|
searchResults?: RegisterMenuItem[];
|
|
10
11
|
sections: QuickInsertMenuSection[];
|
|
11
12
|
};
|
|
12
|
-
export declare const buildQuickInsertMenuModel: (components: RegisterComponent[], rootComponent: SurfaceIdentifier, selectCategoryItems?: QuickInsertCategoryItemSelectionPolicy, surfaceContext?: SurfaceContext) => QuickInsertMenuModel;
|
|
13
|
+
export declare const buildQuickInsertMenuModel: (components: RegisterComponent[], rootComponent: SurfaceIdentifier, selectCategoryItems?: QuickInsertCategoryItemSelectionPolicy, surfaceContext?: SurfaceContext, getItemRank?: RegisteredItemRankResolver) => QuickInsertMenuModel;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import type { IntlShape } from 'react-intl';
|
|
2
2
|
import type { SurfaceIdentifier } from '@atlaskit/editor-ui-control-model/surface-renderer/types';
|
|
3
3
|
import type { RegisterComponent, SurfaceContext } from '@atlaskit/editor-ui-control-model/types';
|
|
4
|
+
import { type RegisteredItemRankResolver } from '../type-ahead/item-rank';
|
|
4
5
|
import type { QuickInsertMenuModel } from './build-quick-insert-menu-model';
|
|
5
6
|
/**
|
|
6
7
|
* Resolves registered menu items for a non-empty query. This intentionally has
|
|
7
8
|
* no empty-query path so browse behavior remains owned by buildQuickInsertMenuModel.
|
|
8
9
|
*/
|
|
9
|
-
export declare const getMatchingQuickInsertComponents: ({ components, rootComponent, query, formatMessage, surfaceContext, }: {
|
|
10
|
+
export declare const getMatchingQuickInsertComponents: ({ components, rootComponent, query, formatMessage, surfaceContext, getItemRank, }: {
|
|
10
11
|
components: RegisterComponent[];
|
|
11
12
|
formatMessage: IntlShape['formatMessage'];
|
|
13
|
+
getItemRank?: RegisteredItemRankResolver;
|
|
12
14
|
query: string;
|
|
13
15
|
rootComponent: SurfaceIdentifier;
|
|
14
16
|
surfaceContext?: SurfaceContext;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RegisteredItemRankResolver } from '../type-ahead/item-rank';
|
|
2
|
+
/** Recommendations and navigation controls retain their policy-defined order. */
|
|
3
|
+
export declare const createQuickInsertRankResolver: (getItemRank?: RegisteredItemRankResolver) => RegisteredItemRankResolver | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { RegisterComponent, RegisterComponentParent } from '@atlaskit/editor-ui-control-model/types';
|
|
2
|
+
export type RegisteredItemRankContext = {
|
|
3
|
+
component: RegisterComponent;
|
|
4
|
+
parent: RegisterComponentParent;
|
|
5
|
+
};
|
|
6
|
+
export type RegisteredItemRankOverride = {
|
|
7
|
+
rank: number;
|
|
8
|
+
};
|
|
9
|
+
/** Pure parent-rank override. Return undefined to preserve parent.rank; do not mutate either record. */
|
|
10
|
+
export type RegisteredItemRankResolver = (context: RegisteredItemRankContext) => RegisteredItemRankOverride | undefined;
|
|
11
|
+
/** Applies per-editor parent ranks without changing shared registry records. */
|
|
12
|
+
export declare const applyRegisteredItemRanks: (components: RegisterComponent[], getRegisteredItemRank?: RegisteredItemRankResolver) => RegisterComponent[];
|
|
@@ -141,6 +141,8 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
|
|
|
141
141
|
hoverComponent?: React.ComponentType<InlineCommentHoverComponentProps>;
|
|
142
142
|
/** Determines whether a specific block node supports inline comments. */
|
|
143
143
|
isBlockNodeSupported?: (node: PMNode) => boolean;
|
|
144
|
+
/** Additional creation policy for supported block nodes; does not control existing threads. */
|
|
145
|
+
canCreateCommentOnBlockNode?: (node: PMNode) => boolean;
|
|
144
146
|
selectionComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentSelectionComponentProps>>;
|
|
145
147
|
viewComponent?: React.ComponentType<React.PropsWithChildren<InlineCommentViewComponentProps>>;
|
|
146
148
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type Fuse from 'fuse.js';
|
|
2
2
|
import type { IntlShape } from 'react-intl';
|
|
3
3
|
import type { QuickInsertItem, QuickInsertProvider } from '../provider-factory';
|
|
4
|
+
import type { RegisteredItemRankResolver } from '../type-ahead/item-rank';
|
|
4
5
|
import type { EmptyStateHandler } from './empty-state-handler';
|
|
5
6
|
export type QuickInsertOptions = boolean | {
|
|
6
7
|
disableDefaultItems?: boolean;
|
|
@@ -54,6 +55,7 @@ export interface QuickInsertPluginOptions {
|
|
|
54
55
|
elementBrowserHelpUrl?: string;
|
|
55
56
|
emptyStateHandler?: EmptyStateHandler;
|
|
56
57
|
enableElementBrowser?: boolean;
|
|
58
|
+
getItemRank?: RegisteredItemRankResolver;
|
|
57
59
|
headless?: boolean;
|
|
58
60
|
/**
|
|
59
61
|
* EDITOR-6558: Optional predicate for filtering quick-insert items
|
|
@@ -4,6 +4,7 @@ import type { Fragment, Node as PMNode } from '@atlaskit/editor-prosemirror/mode
|
|
|
4
4
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import type { TypeAheadPayload } from '../analytics/types/type-ahead';
|
|
6
6
|
import type { SelectItemMode, TypeAheadAvailableNodes } from '../type-ahead';
|
|
7
|
+
import type { RegisteredItemRankResolver } from '../type-ahead/item-rank';
|
|
7
8
|
import type { EditorCommand } from '../types';
|
|
8
9
|
type TypeAheadForceSelectProps = {
|
|
9
10
|
editorState: EditorState;
|
|
@@ -133,6 +134,8 @@ export type TypeAheadHandler = {
|
|
|
133
134
|
query: string;
|
|
134
135
|
}) => Promise<Array<TypeAheadItem>>;
|
|
135
136
|
getMoreOptionsButtonConfig?: (intl: IntlShape) => MoreOptionsButtonConfig;
|
|
137
|
+
/** Overrides parent ranks in registered menus; does not reorder legacy getItems results. */
|
|
138
|
+
getRegisteredItemRank?: RegisteredItemRankResolver;
|
|
136
139
|
/** Optional section definitions used by type-ahead menu to group items */
|
|
137
140
|
getSections?: (props: {
|
|
138
141
|
intl: IntlShape;
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/quick-insert/quick-insert-rank",
|
|
3
|
+
"main": "../../dist/cjs/quick-insert/quick-insert-rank.js",
|
|
4
|
+
"module": "../../dist/esm/quick-insert/quick-insert-rank.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/quick-insert/quick-insert-rank.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/quick-insert/quick-insert-rank.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/type-ahead/item-rank",
|
|
3
|
+
"main": "../../dist/cjs/type-ahead/item-rank.js",
|
|
4
|
+
"module": "../../dist/esm/type-ahead/item-rank.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/type-ahead/item-rank.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/type-ahead/item-rank.d.ts"
|
|
10
|
+
}
|