@atlaskit/editor-common 128.3.2 → 129.0.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 +53 -0
- package/block-node-badges/package.json +10 -0
- package/dist/cjs/analytics/types/enums.js +0 -12
- package/dist/cjs/block-node-badges.js +98 -0
- package/dist/cjs/extensibility/Extension/Extension/index.js +20 -2
- package/dist/cjs/extensibility/Extension/ExtensionCommentBadge.js +110 -0
- package/dist/cjs/media-single/MediaBadges.js +12 -85
- package/dist/cjs/messages/insert-block.js +0 -5
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/snippetMenuRank.js +35 -0
- package/dist/cjs/quick-insert/utils.js +9 -14
- package/dist/cjs/react-node-view/getInlineNodeViewProducer.js +0 -13
- package/dist/cjs/react-node-view/index.js +0 -14
- package/dist/cjs/type-ahead/messages.js +0 -10
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/index.js +0 -47
- package/dist/es2019/analytics/types/enums.js +0 -12
- package/dist/es2019/block-node-badges.js +84 -0
- package/dist/es2019/extensibility/Extension/Extension/index.js +17 -3
- package/dist/es2019/extensibility/Extension/ExtensionCommentBadge.js +60 -0
- package/dist/es2019/media-single/MediaBadges.js +12 -79
- package/dist/es2019/messages/insert-block.js +0 -5
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/snippetMenuRank.js +30 -0
- package/dist/es2019/quick-insert/utils.js +7 -12
- package/dist/es2019/react-node-view/getInlineNodeViewProducer.js +1 -15
- package/dist/es2019/react-node-view/index.js +0 -15
- package/dist/es2019/type-ahead/messages.js +0 -10
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/index.js +0 -5
- package/dist/esm/analytics/types/enums.js +0 -12
- package/dist/esm/block-node-badges.js +88 -0
- package/dist/esm/extensibility/Extension/Extension/index.js +21 -3
- package/dist/esm/extensibility/Extension/ExtensionCommentBadge.js +101 -0
- package/dist/esm/media-single/MediaBadges.js +12 -82
- package/dist/esm/messages/insert-block.js +0 -5
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/snippetMenuRank.js +29 -0
- package/dist/esm/quick-insert/utils.js +9 -14
- package/dist/esm/react-node-view/getInlineNodeViewProducer.js +1 -14
- package/dist/esm/react-node-view/index.js +0 -14
- package/dist/esm/type-ahead/messages.js +0 -10
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/index.js +0 -5
- package/dist/types/analytics/index.d.ts +1 -2
- package/dist/types/analytics/types/enums.d.ts +0 -12
- package/dist/types/analytics/types/events.d.ts +1 -3
- package/dist/types/analytics/types/general-events.d.ts +2 -15
- package/dist/types/block-node-badges.d.ts +14 -0
- package/dist/types/extensibility/Extension/ExtensionCommentBadge.d.ts +8 -0
- package/dist/types/extensibility/types.d.ts +29 -2
- package/dist/types/media-single/MediaBadges.d.ts +4 -8
- package/dist/types/messages/insert-block.d.ts +0 -5
- package/dist/types/quick-insert/snippetMenuRank.d.ts +16 -0
- package/dist/types/type-ahead/messages.d.ts +0 -10
- package/dist/types/types/index.d.ts +1 -1
- package/dist/types/types/performance-tracking.d.ts +0 -22
- package/dist/types/types/type-ahead.d.ts +0 -7
- package/dist/types/utils/index.d.ts +0 -5
- package/package.json +7 -3
- package/quick-insert/snippet-menu-rank/package.json +10 -0
- package/analytics/types/performance-report/package.json +0 -10
- package/dist/cjs/analytics/types/performance-report.js +0 -1
- package/dist/cjs/quick-insert/boost-native-results-above-skills.js +0 -61
- package/dist/cjs/utils/get-performance-options.js +0 -65
- package/dist/cjs/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -10
- package/dist/cjs/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -10
- package/dist/cjs/utils/performance/measure-tti.js +0 -112
- package/dist/cjs/utils/startMeasureReactNodeViewRendered.js +0 -11
- package/dist/es2019/analytics/types/performance-report.js +0 -0
- package/dist/es2019/quick-insert/boost-native-results-above-skills.js +0 -49
- package/dist/es2019/utils/get-performance-options.js +0 -54
- package/dist/es2019/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
- package/dist/es2019/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
- package/dist/es2019/utils/performance/measure-tti.js +0 -91
- package/dist/es2019/utils/startMeasureReactNodeViewRendered.js +0 -6
- package/dist/esm/analytics/types/performance-report.js +0 -0
- package/dist/esm/quick-insert/boost-native-results-above-skills.js +0 -54
- package/dist/esm/utils/get-performance-options.js +0 -53
- package/dist/esm/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
- package/dist/esm/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.js +0 -4
- package/dist/esm/utils/performance/measure-tti.js +0 -94
- package/dist/esm/utils/startMeasureReactNodeViewRendered.js +0 -5
- package/dist/types/analytics/types/performance-report.d.ts +0 -24
- package/dist/types/quick-insert/boost-native-results-above-skills.d.ts +0 -21
- package/dist/types/utils/get-performance-options.d.ts +0 -14
- package/dist/types/utils/performance/TTI_FROM_INVOCATION_SEVERITY_THRESHOLD_DEFAULTS.d.ts +0 -4
- package/dist/types/utils/performance/TTI_SEVERITY_THRESHOLD_DEFAULTS.d.ts +0 -4
- package/dist/types/utils/performance/measure-tti.d.ts +0 -8
- package/dist/types/utils/startMeasureReactNodeViewRendered.d.ts +0 -3
- package/performance/measure-tti/package.json +0 -10
- package/utils/get-performance-options/package.json +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 129.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [`1cb97ba88fb58`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1cb97ba88fb58) -
|
|
8
|
+
Clean up experiment `platform_editor_insert_menu_ai` (keep control).
|
|
9
|
+
|
|
10
|
+
Breaking changes (`@atlaskit/editor-common`): removed `getEmptyItem` from `TypeAheadHandler`, and
|
|
11
|
+
removed the unused messages `typeAheadListMessages.emptySearchResultsSuggestionNew`,
|
|
12
|
+
`typeAheadListMessages.emptySearchResultsSuggestionAskRovoOnly` and
|
|
13
|
+
`toolbarInsertBlockMessages.askRovo`.
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [`7609e9d6f1431`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/7609e9d6f1431) -
|
|
18
|
+
Add the quick-insert/snippet-menu-rank entry point with getSnippetMenuRank and
|
|
19
|
+
TEMPLATE_GALLERY_MENU_RANK for ordering Block templates in the Insert menu
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
|
|
25
|
+
## 128.4.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- [`950fcabdaee51`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/950fcabdaee51) -
|
|
30
|
+
Show comment markers for eligible Remix extension nodes in the editor behind
|
|
31
|
+
`cc_maui_annotations_on_extensions`. Highlight an open draft or selected unresolved thread, open
|
|
32
|
+
existing comments from the marker, and preserve the embedded iframe and unsaved drafts when
|
|
33
|
+
switching threads.
|
|
34
|
+
|
|
35
|
+
Render each badge from its extension node view, using its node and current position instead of
|
|
36
|
+
scanning the document. Both standard and referentiality extension node views render the shared
|
|
37
|
+
badge directly, using annotation state and logic-only actions. Expose the reusable badge container
|
|
38
|
+
as BlockNodeBadges, retaining MediaBadges as a compatibility wrapper for existing media consumers.
|
|
39
|
+
|
|
40
|
+
Preserve the existing Emotion styling for the shared badge container; defer its Compiled migration
|
|
41
|
+
with a file-scoped ratcheting exception.
|
|
42
|
+
|
|
43
|
+
- [`be603fee7766f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/be603fee7766f) -
|
|
44
|
+
Remove unused performance analytics code: ACTION enum members WITH_PLUGIN_STATE_CALLED,
|
|
45
|
+
DISPATCHED_VALID_TRANSACTION, EDITOR_CONTENT_RETRIEVAL_PERFORMED, ON_CHANGE_CALLBACK,
|
|
46
|
+
RENDERED_SAMPLED and REACT_NODEVIEW_RENDERED with their payload types, TransactionEventPayload,
|
|
47
|
+
PluginPerformanceReportData types, measureTTI / getTTISeverity and TTI threshold defaults,
|
|
48
|
+
reactNodeViewRendered tracking (getPerformanceOptions, start/stopMeasureReactNodeViewRendered,
|
|
49
|
+
PerformanceTracking.nodeViewTracking), and the `./performance/measure-tti`,
|
|
50
|
+
`./utils/get-performance-options` and `./analytics/types/performance-report` entry points
|
|
51
|
+
|
|
52
|
+
### Patch Changes
|
|
53
|
+
|
|
54
|
+
- Updated dependencies
|
|
55
|
+
|
|
3
56
|
## 128.3.2
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/block-node-badges",
|
|
3
|
+
"main": "../dist/cjs/block-node-badges.js",
|
|
4
|
+
"module": "../dist/esm/block-node-badges.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/block-node-badges.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/block-node-badges.d.ts"
|
|
10
|
+
}
|
|
@@ -54,14 +54,12 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
54
54
|
ACTION["DISPLAYED"] = "displayed";
|
|
55
55
|
ACTION["DIVERGED"] = "diverged";
|
|
56
56
|
ACTION["DISPATCHED_INVALID_TRANSACTION"] = "dispatchedInvalidTransaction";
|
|
57
|
-
ACTION["DISPATCHED_VALID_TRANSACTION"] = "dispatchedValidTransaction";
|
|
58
57
|
ACTION["DOUBLE_CLICKED"] = "doubleClicked";
|
|
59
58
|
ACTION["DRAGGED"] = "dragged";
|
|
60
59
|
ACTION["EDITED"] = "edited";
|
|
61
60
|
ACTION["EDITOR_CRASHED"] = "unhandledErrorCaught";
|
|
62
61
|
ACTION["EDITOR_CRASHED_ADDITIONAL_INFORMATION"] = "unhandledErrorCaughtAdditionalInfov2";
|
|
63
62
|
ACTION["EDITOR_MOUNTED"] = "mounted";
|
|
64
|
-
ACTION["EDITOR_CONTENT_RETRIEVAL_PERFORMED"] = "contentRetrievalPerformed";
|
|
65
63
|
ACTION["RE_RENDERED"] = "reRendered";
|
|
66
64
|
ACTION["ENDED"] = "ended";
|
|
67
65
|
ACTION["ENTERED"] = "entered";
|
|
@@ -120,7 +118,6 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
120
118
|
ACTION["PRESSED"] = "pressed";
|
|
121
119
|
ACTION["QUICK_INSERT_INFORMATION"] = "quickInsertInformation";
|
|
122
120
|
ACTION["PROSEMIRROR_RENDERED"] = "proseMirrorRendered";
|
|
123
|
-
ACTION["REACT_NODEVIEW_RENDERED"] = "reactNodeViewRendered";
|
|
124
121
|
ACTION["REFERENCE_SYNCED_BLOCK_DELETE"] = "referenceSyncedBlockDelete";
|
|
125
122
|
ACTION["REFERENCE_SYNCED_BLOCK_UPDATE"] = "referenceSyncedBlockUpdate";
|
|
126
123
|
ACTION["REFERENCE_SYNCED_BLOCK_UNSYNC"] = "referenceSyncedBlockUnsync";
|
|
@@ -176,18 +173,9 @@ var ACTION = exports.ACTION = /*#__PURE__*/function (ACTION) {
|
|
|
176
173
|
ACTION["UPLOAD_EXTERNAL_FAIL"] = "uploadExternalFailed";
|
|
177
174
|
ACTION["VIEWED"] = "viewed";
|
|
178
175
|
ACTION["VISITED"] = "visited";
|
|
179
|
-
ACTION["WITH_PLUGIN_STATE_CALLED"] = "withPluginStateCalled";
|
|
180
176
|
ACTION["RENDERED"] = "rendered";
|
|
181
|
-
ACTION["RENDERED_SAMPLED"] = "renderedSampled";
|
|
182
177
|
ACTION["REASONING_VIEWED"] = "reasoningViewed";
|
|
183
178
|
ACTION["ON_EDITOR_READY_CALLBACK"] = "onEditorReadyCallback";
|
|
184
|
-
/**
|
|
185
|
-
* @private
|
|
186
|
-
* @deprecated
|
|
187
|
-
*
|
|
188
|
-
* This is no longer used and can be removed at a later date
|
|
189
|
-
*/
|
|
190
|
-
ACTION["ON_CHANGE_CALLBACK"] = "onChangeCalled";
|
|
191
179
|
ACTION["NESTED_TABLE_TRANSFORMED"] = "nestedTableTransformed";
|
|
192
180
|
ACTION["CONTAINER_NODE_TRANSFORMED"] = "containerNodeTransformed";
|
|
193
181
|
ACTION["NATIVE_EMBEDS_TRANSFORMED"] = "nativeEmbedsTransformed";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.BlockNodeBadges = void 0;
|
|
9
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _debounce = _interopRequireDefault(require("lodash/debounce"));
|
|
12
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
|
+
var _primitives = require("@atlaskit/primitives");
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
16
|
+
|
|
17
|
+
var BADGE_VISIBILITY_BREAKPOINT = 200;
|
|
18
|
+
var containerStyles = (0, _primitives.xcss)({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
position: 'absolute',
|
|
21
|
+
top: 'space.0',
|
|
22
|
+
right: 'space.0',
|
|
23
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
24
|
+
lineHeight: "var(--ds-space-200, 16px)",
|
|
25
|
+
gap: 'space.025',
|
|
26
|
+
zIndex: 'card',
|
|
27
|
+
height: 'fit-content',
|
|
28
|
+
width: 'fit-content',
|
|
29
|
+
margin: 'space.075'
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// The above styles are used for both editor and renderer, and in renderer the
|
|
33
|
+
// document body is the main scroll area. This means it overscrolls the primary
|
|
34
|
+
// toolbar, where the z-index is "2". We have to hack in our own z-index less
|
|
35
|
+
// than that to ensure our badge appears under the toolbar when scrolled.
|
|
36
|
+
var hackedZIndexStyles = (0, _primitives.xcss)({
|
|
37
|
+
zIndex: '1'
|
|
38
|
+
});
|
|
39
|
+
var resizeOffsetStyles = (0, _primitives.xcss)({
|
|
40
|
+
right: 'space.150'
|
|
41
|
+
});
|
|
42
|
+
var getBadgeVisible = function getBadgeVisible(width, height) {
|
|
43
|
+
return width && width < BADGE_VISIBILITY_BREAKPOINT || height && height < BADGE_VISIBILITY_BREAKPOINT ? false : true;
|
|
44
|
+
};
|
|
45
|
+
var BlockNodeBadges = exports.BlockNodeBadges = function BlockNodeBadges(_ref) {
|
|
46
|
+
var children = _ref.children,
|
|
47
|
+
element = _ref.element,
|
|
48
|
+
width = _ref.width,
|
|
49
|
+
height = _ref.height,
|
|
50
|
+
extendedResizeOffset = _ref.extendedResizeOffset,
|
|
51
|
+
_ref$useMinimumZIndex = _ref.useMinimumZIndex,
|
|
52
|
+
useMinimumZIndex = _ref$useMinimumZIndex === void 0 ? false : _ref$useMinimumZIndex;
|
|
53
|
+
var _useState = (0, _react.useState)(getBadgeVisible(width, height)),
|
|
54
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
55
|
+
visible = _useState2[0],
|
|
56
|
+
setVisible = _useState2[1];
|
|
57
|
+
(0, _react.useEffect)(function () {
|
|
58
|
+
var observer = new ResizeObserver((0, _debounce.default)(function (entries) {
|
|
59
|
+
var _entries = (0, _slicedToArray2.default)(entries, 1),
|
|
60
|
+
entry = _entries[0];
|
|
61
|
+
var _entry$contentRect = entry.contentRect,
|
|
62
|
+
width = _entry$contentRect.width,
|
|
63
|
+
height = _entry$contentRect.height;
|
|
64
|
+
setVisible(getBadgeVisible(width, height));
|
|
65
|
+
}));
|
|
66
|
+
if (element) {
|
|
67
|
+
// Ignored via go/ees005
|
|
68
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
69
|
+
observer.observe(element);
|
|
70
|
+
}
|
|
71
|
+
return function () {
|
|
72
|
+
observer.disconnect();
|
|
73
|
+
};
|
|
74
|
+
}, [element]);
|
|
75
|
+
if (typeof children === 'function') {
|
|
76
|
+
children = children({
|
|
77
|
+
visible: visible
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// delete this block on cleanup of media-perf-uplift-mutation-fix
|
|
82
|
+
if (!(0, _fg.fg)('media-perf-uplift-mutation-fix')) {
|
|
83
|
+
// becuase it is wrapped in a fragment, React.Children.count(children) will always be 1.
|
|
84
|
+
// That makes this check a source of late mutations that we don't need.
|
|
85
|
+
if (!element || _react.default.Children.count(children) === 0) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
90
|
+
as: "div",
|
|
91
|
+
testId: "media-badges",
|
|
92
|
+
"data-media-badges": "true",
|
|
93
|
+
contentEditable: false
|
|
94
|
+
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
95
|
+
,
|
|
96
|
+
xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles]
|
|
97
|
+
}, children);
|
|
98
|
+
};
|
|
@@ -9,6 +9,7 @@ exports.default = void 0;
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
13
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
14
|
var _react2 = require("@emotion/react");
|
|
14
15
|
var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
@@ -20,6 +21,7 @@ var _NodeViewContentHole = require("../../../react-node-view/NodeViewContentHole
|
|
|
20
21
|
var _ui = require("../../../ui");
|
|
21
22
|
var _utils = require("../../../utils");
|
|
22
23
|
var _shouldExtensionBreakout = require("../../utils/should-extension-breakout");
|
|
24
|
+
var _ExtensionCommentBadge = require("../ExtensionCommentBadge");
|
|
23
25
|
var _Lozenge = _interopRequireDefault(require("../Lozenge"));
|
|
24
26
|
var _styles = require("../styles");
|
|
25
27
|
var _extensionUtils = require("./extension-utils");
|
|
@@ -62,6 +64,16 @@ function ExtensionWithPluginState(props) {
|
|
|
62
64
|
pluginInjectionApi = props.pluginInjectionApi,
|
|
63
65
|
isLivePageViewMode = props.isLivePageViewMode,
|
|
64
66
|
hideConfigureLabel = props.hideConfigureLabel;
|
|
67
|
+
var _useState = (0, _react.useState)(null),
|
|
68
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
69
|
+
container = _useState2[0],
|
|
70
|
+
setContainer = _useState2[1];
|
|
71
|
+
var handleContainerRef = (0, _react.useCallback)(function (element) {
|
|
72
|
+
handleRef === null || handleRef === void 0 || handleRef(element);
|
|
73
|
+
if ((0, _fg.fg)('cc_maui_annotations_on_extensions')) {
|
|
74
|
+
setContainer(element);
|
|
75
|
+
}
|
|
76
|
+
}, [handleRef]);
|
|
65
77
|
var _ref = macroInteractionDesignFeatureFlags || {},
|
|
66
78
|
showMacroInteractionDesignUpdates = _ref.showMacroInteractionDesignUpdates;
|
|
67
79
|
var isLegacyContentMacroExtension = function isLegacyContentMacroExtension(extensionNode) {
|
|
@@ -156,7 +168,7 @@ function ExtensionWithPluginState(props) {
|
|
|
156
168
|
hideConfigureLabel: hideConfigureLabel
|
|
157
169
|
}), (0, _react2.jsx)("div", {
|
|
158
170
|
"data-testid": "extension-container",
|
|
159
|
-
ref:
|
|
171
|
+
ref: handleContainerRef,
|
|
160
172
|
"data-layout": node.attrs.layout
|
|
161
173
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
162
174
|
,
|
|
@@ -220,7 +232,13 @@ function ExtensionWithPluginState(props) {
|
|
|
220
232
|
className: contentClassNames
|
|
221
233
|
}, (0, _react2.jsx)(_NodeViewContentHole.NodeViewContentHole, {
|
|
222
234
|
ref: handleContentDOMRef
|
|
223
|
-
}))))))
|
|
235
|
+
})))), (0, _fg.fg)('cc_maui_annotations_on_extensions') && node.type.name === 'extension' && container && (pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : pluginInjectionApi.annotation) && (0, _react2.jsx)(_ExtensionCommentBadge.ExtensionCommentBadge, {
|
|
236
|
+
api: pluginInjectionApi,
|
|
237
|
+
node: node,
|
|
238
|
+
getPos: getPos,
|
|
239
|
+
editorView: view,
|
|
240
|
+
container: container
|
|
241
|
+
})));
|
|
224
242
|
}
|
|
225
243
|
var Extension = function Extension(props) {
|
|
226
244
|
var pluginInjectionApi = props.pluginInjectionApi;
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ExtensionCommentBadge = void 0;
|
|
9
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _analytics = require("../../analytics");
|
|
13
|
+
var _blockNodeBadges = require("../../block-node-badges");
|
|
14
|
+
var _hooks = require("../../hooks");
|
|
15
|
+
var _CommentBadgeNext = require("../../media-single/CommentBadgeNext");
|
|
16
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t2 in e) "default" !== _t2 && {}.hasOwnProperty.call(e, _t2) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t2)) && (i.get || i.set) ? o(f, _t2, i) : f[_t2] = e[_t2]); return f; })(e, t); }
|
|
17
|
+
// Owned by the extension node view, like media's badge. Annotation updates only
|
|
18
|
+
// render this sibling of the extension content; they never reparent its iframe.
|
|
19
|
+
var ExtensionCommentBadge = exports.ExtensionCommentBadge = function ExtensionCommentBadge(_ref) {
|
|
20
|
+
var _api$annotation4;
|
|
21
|
+
var api = _ref.api,
|
|
22
|
+
editorView = _ref.editorView,
|
|
23
|
+
node = _ref.node,
|
|
24
|
+
getPos = _ref.getPos,
|
|
25
|
+
container = _ref.container;
|
|
26
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(api, ['annotation'], function (states) {
|
|
27
|
+
return {
|
|
28
|
+
annotationState: states.annotationState
|
|
29
|
+
};
|
|
30
|
+
}),
|
|
31
|
+
annotationState = _useSharedPluginState.annotationState;
|
|
32
|
+
var drafting = Boolean((annotationState === null || annotationState === void 0 ? void 0 : annotationState.isDrafting) && node.attrs.localId && node.attrs.localId === annotationState.targetNodeId);
|
|
33
|
+
var hasOpenDraft = Boolean(annotationState === null || annotationState === void 0 ? void 0 : annotationState.isDrafting);
|
|
34
|
+
var unresolvedIds = (0, _react.useMemo)(function () {
|
|
35
|
+
return node.marks.filter(function (mark) {
|
|
36
|
+
return mark.type.name === 'annotation' && (annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations[mark.attrs.id]) === false;
|
|
37
|
+
}).map(function (mark) {
|
|
38
|
+
return mark.attrs.id;
|
|
39
|
+
});
|
|
40
|
+
}, [node.marks, annotationState === null || annotationState === void 0 ? void 0 : annotationState.annotations]);
|
|
41
|
+
var onClick = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
42
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(event) {
|
|
43
|
+
var _api$annotation, _api$annotation2;
|
|
44
|
+
var pos, currentNode, _api$annotation3, _t;
|
|
45
|
+
return _regenerator.default.wrap(function (_context) {
|
|
46
|
+
while (1) switch (_context.prev = _context.next) {
|
|
47
|
+
case 0:
|
|
48
|
+
event.preventDefault();
|
|
49
|
+
event.stopPropagation();
|
|
50
|
+
if (!drafting) {
|
|
51
|
+
_context.next = 1;
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
return _context.abrupt("return");
|
|
55
|
+
case 1:
|
|
56
|
+
_t = hasOpenDraft;
|
|
57
|
+
if (!_t) {
|
|
58
|
+
_context.next = 3;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
_context.next = 2;
|
|
62
|
+
return api === null || api === void 0 || (_api$annotation = api.annotation) === null || _api$annotation === void 0 ? void 0 : _api$annotation.actions.requestCloseInlineComment();
|
|
63
|
+
case 2:
|
|
64
|
+
_t = !_context.sent;
|
|
65
|
+
case 3:
|
|
66
|
+
if (!_t) {
|
|
67
|
+
_context.next = 4;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
return _context.abrupt("return");
|
|
71
|
+
case 4:
|
|
72
|
+
// Resolve the current position after the asynchronous discard confirmation.
|
|
73
|
+
pos = getPos();
|
|
74
|
+
if (!(typeof pos !== 'number' || !Number.isFinite(pos) || pos < 0 || pos >= editorView.state.doc.content.size)) {
|
|
75
|
+
_context.next = 5;
|
|
76
|
+
break;
|
|
77
|
+
}
|
|
78
|
+
return _context.abrupt("return");
|
|
79
|
+
case 5:
|
|
80
|
+
currentNode = editorView.state.doc.nodeAt(pos);
|
|
81
|
+
if ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type) === node.type && currentNode.attrs.localId === node.attrs.localId && api !== null && api !== void 0 && (_api$annotation2 = api.annotation) !== null && _api$annotation2 !== void 0 && _api$annotation2.actions.isBlockNodeSupported(currentNode)) {
|
|
82
|
+
api === null || api === void 0 || (_api$annotation3 = api.annotation) === null || _api$annotation3 === void 0 || _api$annotation3.actions.showCommentForBlockNode(currentNode, _analytics.VIEW_METHOD.BADGE)(editorView.state, editorView.dispatch);
|
|
83
|
+
}
|
|
84
|
+
case 6:
|
|
85
|
+
case "end":
|
|
86
|
+
return _context.stop();
|
|
87
|
+
}
|
|
88
|
+
}, _callee);
|
|
89
|
+
}));
|
|
90
|
+
return function (_x) {
|
|
91
|
+
return _ref2.apply(this, arguments);
|
|
92
|
+
};
|
|
93
|
+
}(), [api, editorView, node, getPos, drafting, hasOpenDraft]);
|
|
94
|
+
if (!(annotationState !== null && annotationState !== void 0 && annotationState.isVisible) || node.type.name !== 'extension' || !(api !== null && api !== void 0 && (_api$annotation4 = api.annotation) !== null && _api$annotation4 !== void 0 && _api$annotation4.actions.isBlockNodeSupported(node))) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
if (!drafting && !unresolvedIds.length) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
var active = drafting || !annotationState.isInlineCommentViewClosed && annotationState.selectedAnnotations.some(function (_ref3) {
|
|
101
|
+
var id = _ref3.id;
|
|
102
|
+
return unresolvedIds.includes(id);
|
|
103
|
+
});
|
|
104
|
+
return /*#__PURE__*/_react.default.createElement(_blockNodeBadges.BlockNodeBadges, {
|
|
105
|
+
element: container
|
|
106
|
+
}, /*#__PURE__*/_react.default.createElement(_CommentBadgeNext.CommentBadgeNext, {
|
|
107
|
+
onClick: onClick,
|
|
108
|
+
status: active ? 'active' : 'default'
|
|
109
|
+
}));
|
|
110
|
+
};
|
|
@@ -1,98 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.MediaBadges = void 0;
|
|
9
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
13
|
-
var _primitives = require("@atlaskit/primitives");
|
|
14
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
15
|
-
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
16
|
-
|
|
17
|
-
var MEDIA_BADGE_VISIBILITY_BREAKPOINT = 200;
|
|
18
|
-
var containerStyles = (0, _primitives.xcss)({
|
|
19
|
-
display: 'flex',
|
|
20
|
-
position: 'absolute',
|
|
21
|
-
top: 'space.0',
|
|
22
|
-
right: 'space.0',
|
|
23
|
-
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
24
|
-
lineHeight: "var(--ds-space-200, 16px)",
|
|
25
|
-
gap: 'space.025',
|
|
26
|
-
zIndex: 'card',
|
|
27
|
-
height: 'fit-content',
|
|
28
|
-
width: 'fit-content',
|
|
29
|
-
margin: 'space.075'
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
// The above styles are used for both editor and renderer, and in renderer the
|
|
33
|
-
// document body is the main scroll area. This means it overscrolls the primary
|
|
34
|
-
// toolbar, where the z-index is "2". We have to hack in our own z-index less
|
|
35
|
-
// than that to ensure our badge appears under the toolbar when scrolled.
|
|
36
|
-
var hackedZIndexStyles = (0, _primitives.xcss)({
|
|
37
|
-
zIndex: '1'
|
|
38
|
-
});
|
|
39
|
-
var resizeOffsetStyles = (0, _primitives.xcss)({
|
|
40
|
-
right: 'space.150'
|
|
41
|
-
});
|
|
42
|
-
var getBadgeVisible = function getBadgeVisible(width, height) {
|
|
43
|
-
return width && width < MEDIA_BADGE_VISIBILITY_BREAKPOINT || height && height < MEDIA_BADGE_VISIBILITY_BREAKPOINT ? false : true;
|
|
44
|
-
};
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _blockNodeBadges = require("../block-node-badges");
|
|
10
|
+
/** Compatibility wrapper for existing media consumers of BlockNodeBadges. */
|
|
45
11
|
var MediaBadges = exports.MediaBadges = function MediaBadges(_ref) {
|
|
46
|
-
var
|
|
47
|
-
mediaElement = _ref.mediaElement,
|
|
12
|
+
var mediaElement = _ref.mediaElement,
|
|
48
13
|
mediaWidth = _ref.mediaWidth,
|
|
49
14
|
mediaHeight = _ref.mediaHeight,
|
|
15
|
+
children = _ref.children,
|
|
50
16
|
extendedResizeOffset = _ref.extendedResizeOffset,
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
var observer = new ResizeObserver((0, _debounce.default)(function (entries) {
|
|
59
|
-
var _entries = (0, _slicedToArray2.default)(entries, 1),
|
|
60
|
-
entry = _entries[0];
|
|
61
|
-
var _entry$contentRect = entry.contentRect,
|
|
62
|
-
width = _entry$contentRect.width,
|
|
63
|
-
height = _entry$contentRect.height;
|
|
64
|
-
setVisible(getBadgeVisible(width, height));
|
|
65
|
-
}));
|
|
66
|
-
if (mediaElement) {
|
|
67
|
-
// Ignored via go/ees005
|
|
68
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
69
|
-
observer.observe(mediaElement);
|
|
70
|
-
}
|
|
71
|
-
return function () {
|
|
72
|
-
observer.disconnect();
|
|
73
|
-
};
|
|
74
|
-
}, [mediaElement]);
|
|
75
|
-
if (typeof children === 'function') {
|
|
76
|
-
children = children({
|
|
77
|
-
visible: visible
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// delete this block on cleanup of media-perf-uplift-mutation-fix
|
|
82
|
-
if (!(0, _fg.fg)('media-perf-uplift-mutation-fix')) {
|
|
83
|
-
// becuase it is wrapped in a fragment, React.Children.count(children) will always be 1.
|
|
84
|
-
// That makes this check a source of late mutations that we don't need.
|
|
85
|
-
if (!mediaElement || _react.default.Children.count(children) === 0) {
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
90
|
-
as: "div",
|
|
91
|
-
testId: "media-badges",
|
|
92
|
-
"data-media-badges": "true",
|
|
93
|
-
contentEditable: false
|
|
94
|
-
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
95
|
-
,
|
|
96
|
-
xcss: [containerStyles, useMinimumZIndex && hackedZIndexStyles, extendedResizeOffset && resizeOffsetStyles]
|
|
17
|
+
useMinimumZIndex = _ref.useMinimumZIndex;
|
|
18
|
+
return /*#__PURE__*/_react.default.createElement(_blockNodeBadges.BlockNodeBadges, {
|
|
19
|
+
element: mediaElement,
|
|
20
|
+
width: mediaWidth,
|
|
21
|
+
height: mediaHeight,
|
|
22
|
+
extendedResizeOffset: extendedResizeOffset,
|
|
23
|
+
useMinimumZIndex: useMinimumZIndex
|
|
97
24
|
}, children);
|
|
98
25
|
};
|
|
@@ -211,11 +211,6 @@ var toolbarInsertBlockMessages = exports.toolbarInsertBlockMessages = (0, _react
|
|
|
211
211
|
defaultMessage: 'Add a custom status label',
|
|
212
212
|
description: 'Menu description shown in the quick insert menu. Explains that users can add custom status labels.'
|
|
213
213
|
},
|
|
214
|
-
askRovo: {
|
|
215
|
-
id: 'fabric.editor.askRovo',
|
|
216
|
-
defaultMessage: 'Ask Rovo',
|
|
217
|
-
description: 'Button label shown in the quick insert empty results state. Allows users to ask Rovo AI for help.'
|
|
218
|
-
},
|
|
219
214
|
viewMore: {
|
|
220
215
|
id: 'fabric.editor.viewMore',
|
|
221
216
|
defaultMessage: 'View more',
|
|
@@ -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 = "128.
|
|
30
|
+
var packageVersion = "128.4.0";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getSnippetMenuRank = exports.TEMPLATE_GALLERY_MENU_RANK = void 0;
|
|
7
|
+
var MAX_DATE_MS = 8.64e15; // largest valid Date value
|
|
8
|
+
var FAVORITE_TIER = -2;
|
|
9
|
+
var CURATED_TIER = 1;
|
|
10
|
+
var TEMPLATE_GALLERY_MENU_RANK = exports.TEMPLATE_GALLERY_MENU_RANK = 0;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Menu rank for a Block template within the Block templates section. Lower ranks appear first.
|
|
14
|
+
* Each rank is its tier plus a fraction in [0, 1), so tiers never overlap.
|
|
15
|
+
*
|
|
16
|
+
* Negative ranks are intentional and valid. This is a `parents[].rank` sort key, not a Fuse score:
|
|
17
|
+
* the registry menu compares ranks by subtraction, and Fuse's 0–1 `score` is a separate value that
|
|
18
|
+
* is compared first when searching, so rank only orders templates with equal scores.
|
|
19
|
+
*/
|
|
20
|
+
var getSnippetMenuRank = exports.getSnippetMenuRank = function getSnippetMenuRank(_ref) {
|
|
21
|
+
var insertCount = _ref.insertCount,
|
|
22
|
+
isFavorite = _ref.isFavorite,
|
|
23
|
+
scope = _ref.scope,
|
|
24
|
+
updatedAt = _ref.updatedAt;
|
|
25
|
+
if (isFavorite) {
|
|
26
|
+
// Stays in (-2, -1.5]; more inserts rank first.
|
|
27
|
+
return FAVORITE_TIER + 1 / ((insertCount !== null && insertCount !== void 0 ? insertCount : 0) + 2);
|
|
28
|
+
}
|
|
29
|
+
if (scope !== 'GLOBAL') {
|
|
30
|
+
var time = Number.isFinite(updatedAt) ? Math.max(updatedAt, 1) : 1;
|
|
31
|
+
// USER and SITE templates stay in [-1, 0); newer updates rank first.
|
|
32
|
+
return -time / MAX_DATE_MS;
|
|
33
|
+
}
|
|
34
|
+
return CURATED_TIER;
|
|
35
|
+
};
|
|
@@ -10,8 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _fuse = _interopRequireDefault(require("fuse.js"));
|
|
12
12
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
13
|
-
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
14
|
-
var _boostNativeResultsAboveSkills = require("./boost-native-results-above-skills");
|
|
15
13
|
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; }
|
|
16
14
|
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; }
|
|
17
15
|
var processQuickInsertItems = function processQuickInsertItems(items, intl) {
|
|
@@ -67,7 +65,7 @@ var options = {
|
|
|
67
65
|
*/
|
|
68
66
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
69
67
|
function find(query, items, prioritySortingFn) {
|
|
70
|
-
var
|
|
68
|
+
var _results$datasourceIn, _results$legacyIndex$;
|
|
71
69
|
if (query === '') {
|
|
72
70
|
// Copy and sort list by priority
|
|
73
71
|
return items.slice(0).sort(function (a, b) {
|
|
@@ -86,28 +84,25 @@ function find(query, items, prioritySortingFn) {
|
|
|
86
84
|
var fuse = new _fuse.default(items, fuseOptions);
|
|
87
85
|
var results = fuse.search(query);
|
|
88
86
|
|
|
89
|
-
// platform_editor_insert_menu_ai: boost native editor elements above skills
|
|
90
|
-
var rerankedResults = (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_insert_menu_ai') ? (0, _boostNativeResultsAboveSkills.boostNativeResultsAboveSkills)(results) : results;
|
|
91
|
-
|
|
92
87
|
// searching for jira work items macro first
|
|
93
|
-
var datasourceIndex =
|
|
88
|
+
var datasourceIndex = results.findIndex(function (r) {
|
|
94
89
|
var _r$item$keywords;
|
|
95
90
|
return r.item.id === 'datasource' && ((_r$item$keywords = r.item.keywords) === null || _r$item$keywords === void 0 ? void 0 : _r$item$keywords.includes('jira'));
|
|
96
91
|
});
|
|
97
92
|
|
|
98
93
|
// then searching for the legacy jira macro
|
|
99
|
-
var legacyIndex =
|
|
94
|
+
var legacyIndex = results.findIndex(function (r) {
|
|
100
95
|
return typeof r.item.key === 'string' && r.item.key.endsWith(':jira');
|
|
101
96
|
});
|
|
102
97
|
|
|
103
98
|
// the jira legcy macro is found before the jira work items macro then swap the two
|
|
104
|
-
if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((
|
|
105
|
-
var
|
|
106
|
-
|
|
107
|
-
datasource =
|
|
108
|
-
|
|
99
|
+
if (datasourceIndex > 0 && legacyIndex >= 0 && legacyIndex < datasourceIndex && Math.abs(((_results$datasourceIn = results[datasourceIndex].score) !== null && _results$datasourceIn !== void 0 ? _results$datasourceIn : 0) - ((_results$legacyIndex$ = results[legacyIndex].score) !== null && _results$legacyIndex$ !== void 0 ? _results$legacyIndex$ : 0)) < 0.2) {
|
|
100
|
+
var _results$splice = results.splice(datasourceIndex, 1),
|
|
101
|
+
_results$splice2 = (0, _slicedToArray2.default)(_results$splice, 1),
|
|
102
|
+
datasource = _results$splice2[0];
|
|
103
|
+
results.splice(legacyIndex, 0, datasource);
|
|
109
104
|
}
|
|
110
|
-
return
|
|
105
|
+
return results.map(function (result) {
|
|
111
106
|
return result.item;
|
|
112
107
|
});
|
|
113
108
|
}
|
|
@@ -81,22 +81,9 @@ function createNodeView(_ref) {
|
|
|
81
81
|
extraComponentProps: extraComponentProps
|
|
82
82
|
}), domRef, key);
|
|
83
83
|
}
|
|
84
|
-
var _getPerformanceOption = (0, _utils.getPerformanceOptions)(nodeViewParams.view),
|
|
85
|
-
samplingRate = _getPerformanceOption.samplingRate,
|
|
86
|
-
slowThreshold = _getPerformanceOption.slowThreshold,
|
|
87
|
-
trackingEnabled = _getPerformanceOption.trackingEnabled;
|
|
88
|
-
trackingEnabled && (0, _utils.startMeasureReactNodeViewRendered)({
|
|
89
|
-
nodeTypeName: currentNode.type.name
|
|
90
|
-
});
|
|
91
84
|
|
|
92
85
|
// We render the component while creating the node view
|
|
93
86
|
renderComponent();
|
|
94
|
-
trackingEnabled && (0, _utils.stopMeasureReactNodeViewRendered)({
|
|
95
|
-
nodeTypeName: currentNode.type.name,
|
|
96
|
-
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
97
|
-
samplingRate: samplingRate,
|
|
98
|
-
slowThreshold: slowThreshold
|
|
99
|
-
});
|
|
100
87
|
var extraNodeViewPropsWithStopEvent = _objectSpread({}, extraNodeViewProps);
|
|
101
88
|
|
|
102
89
|
// https://prosemirror.net/docs/ref/#view.NodeView
|