@atlaskit/editor-common 131.0.1 → 131.1.1
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 +35 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/portal/PortalBucket.js +51 -11
- package/dist/cjs/portal/PortalManager.js +6 -3
- package/dist/cjs/preset/core-plugin/index.js +4 -20
- package/dist/cjs/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/cjs/quick-insert/QuickInsertSearchResultsSection.js +19 -0
- package/dist/cjs/quick-insert/get-quick-insert-menu-model.js +20 -31
- package/dist/cjs/quick-insert/getQuickInsertMenuRows.js +2 -2
- package/dist/cjs/quick-insert/keys.js +10 -1
- package/dist/cjs/quick-insert/messages.js +5 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/portal/PortalBucket.js +48 -12
- package/dist/es2019/portal/PortalManager.js +6 -3
- package/dist/es2019/preset/core-plugin/index.js +4 -20
- package/dist/es2019/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/es2019/quick-insert/QuickInsertSearchResultsSection.js +14 -0
- package/dist/es2019/quick-insert/get-quick-insert-menu-model.js +15 -17
- package/dist/es2019/quick-insert/getQuickInsertMenuRows.js +2 -2
- package/dist/es2019/quick-insert/keys.js +9 -0
- package/dist/es2019/quick-insert/messages.js +5 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/portal/PortalBucket.js +52 -12
- package/dist/esm/portal/PortalManager.js +6 -3
- package/dist/esm/preset/core-plugin/index.js +4 -20
- package/dist/esm/quick-insert/CompactQuickInsertMenuItem.js +6 -6
- package/dist/esm/quick-insert/QuickInsertSearchResultsSection.js +12 -0
- package/dist/esm/quick-insert/get-quick-insert-menu-model.js +21 -32
- package/dist/esm/quick-insert/getQuickInsertMenuRows.js +2 -2
- package/dist/esm/quick-insert/keys.js +9 -0
- package/dist/esm/quick-insert/messages.js +5 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/quick-insert/QuickInsertSearchResultsSection.d.ts +2 -0
- package/dist/types/quick-insert/get-quick-insert-menu-model.d.ts +4 -1
- package/dist/types/quick-insert/keys.d.ts +8 -0
- package/dist/types/quick-insert/messages.d.ts +1 -1
- package/package.json +2 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 131.1.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 131.1.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`2e5bca15bacb0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2e5bca15bacb0) -
|
|
14
|
+
[ux] Replace the JavaScript driven extension overflow shadows with a CSS scroll driven
|
|
15
|
+
implementation when the `platform_editor_reduce_forced_layout_2` experiment is enabled. Extensions
|
|
16
|
+
now paint their inline start and end shadows from the overflow wrapper's scroll timeline instead
|
|
17
|
+
of scroll listeners that read `scrollLeft`, `offsetWidth` and `scrollWidth`, removing the forced
|
|
18
|
+
synchronous layout those reads caused. The `overflowShadow` higher order component gains an
|
|
19
|
+
`isDisabled` option so consumers can opt out of the JavaScript shadows without affecting other
|
|
20
|
+
call sites.
|
|
21
|
+
- [`62ee40fadb62f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/62ee40fadb62f) -
|
|
22
|
+
Add a Search results heading to the registered Quick Insert search model (new
|
|
23
|
+
SEARCH_RESULTS_SECTION key and searchResults message). A search with matches now returns a single
|
|
24
|
+
Search results section of ranked matches in `sections`, and the `searchResults` field is removed
|
|
25
|
+
from QuickInsertMenuModel. Compact Quick Insert menu items are 44px tall to match the slash
|
|
26
|
+
command design. Affects the registered slash command menu and toolbar Insert menu behind
|
|
27
|
+
platform_editor_slash_command.
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [`9fa655f27db03`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9fa655f27db03) -
|
|
32
|
+
Stop PortalBucket retaining removed portals in stale React fibers and fix PortalManager capacity
|
|
33
|
+
drift on portal re-register, behind the `platform_editor_reduce_memory_leaks` experiment.
|
|
34
|
+
- [`b5bdee7e6b998`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b5bdee7e6b998) -
|
|
35
|
+
Clean up feature gate `platform_editor_fix_scroll_to_pos`
|
|
36
|
+
- Updated dependencies
|
|
37
|
+
|
|
3
38
|
## 131.0.1
|
|
4
39
|
|
|
5
40
|
### 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 = "131.
|
|
30
|
+
var packageVersion = "131.1.0";
|
|
31
31
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
32
32
|
// Remove URL as it has UGC
|
|
33
33
|
// Ignored via go/ees007
|
|
@@ -8,18 +8,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.PortalBucket = PortalBucket;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
11
12
|
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); }
|
|
12
|
-
|
|
13
|
-
* A component for rendering portals managed by a `PortalManager`.
|
|
14
|
-
* It subscribes to a `PortalManager` instance to listen for changes in the portal content
|
|
15
|
-
* and renders the content of its assigned portal bucket.
|
|
16
|
-
*
|
|
17
|
-
* @param {PortalBucketProps} props The component props.
|
|
18
|
-
* @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
|
|
19
|
-
* @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
|
|
20
|
-
* @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
|
|
21
|
-
*/
|
|
22
|
-
function PortalBucket(_ref) {
|
|
13
|
+
function LegacyPortalBucket(_ref) {
|
|
23
14
|
var id = _ref.id,
|
|
24
15
|
portalManager = _ref.portalManager;
|
|
25
16
|
// State to hold the current portals for this bucket
|
|
@@ -41,4 +32,53 @@ function PortalBucket(_ref) {
|
|
|
41
32
|
// Render the current portal elements
|
|
42
33
|
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
43
34
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, portalElements);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Portals stay in the manager; state is only a render tick. React keeps
|
|
39
|
+
* hook state on both the current and alternate fiber, so storing portals
|
|
40
|
+
* in state would retain removed portals until the next render.
|
|
41
|
+
*/
|
|
42
|
+
function TickPortalBucket(_ref2) {
|
|
43
|
+
var _portalManager$getBuc, _portalManager$getBuc2;
|
|
44
|
+
var id = _ref2.id,
|
|
45
|
+
portalManager = _ref2.portalManager;
|
|
46
|
+
var _useReducer = (0, _react.useReducer)(function (tick) {
|
|
47
|
+
return tick + 1;
|
|
48
|
+
}, 0),
|
|
49
|
+
_useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
|
|
50
|
+
forceRender = _useReducer2[1];
|
|
51
|
+
var updater = (0, _react.useCallback)(function () {
|
|
52
|
+
return forceRender();
|
|
53
|
+
}, []);
|
|
54
|
+
(0, _react.useLayoutEffect)(function () {
|
|
55
|
+
portalManager.registerBucket(id, updater);
|
|
56
|
+
return function () {
|
|
57
|
+
portalManager.unregisterBucket(id);
|
|
58
|
+
};
|
|
59
|
+
}, [id, portalManager, updater]);
|
|
60
|
+
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
61
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, Object.values((_portalManager$getBuc = (_portalManager$getBuc2 = portalManager.getBuckets()[id]) === null || _portalManager$getBuc2 === void 0 ? void 0 : _portalManager$getBuc2.portals) !== null && _portalManager$getBuc !== void 0 ? _portalManager$getBuc : {}));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* A component for rendering portals managed by a `PortalManager`.
|
|
66
|
+
* It subscribes to a `PortalManager` instance to listen for changes in the portal content
|
|
67
|
+
* and renders the content of its assigned portal bucket.
|
|
68
|
+
*
|
|
69
|
+
* @param {PortalBucketProps} props The component props.
|
|
70
|
+
* @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
|
|
71
|
+
* @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
|
|
72
|
+
* @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
|
|
73
|
+
*/
|
|
74
|
+
function PortalBucket(_ref3) {
|
|
75
|
+
var id = _ref3.id,
|
|
76
|
+
portalManager = _ref3.portalManager;
|
|
77
|
+
return (0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') ? /*#__PURE__*/_react.default.createElement(TickPortalBucket, {
|
|
78
|
+
id: id,
|
|
79
|
+
portalManager: portalManager
|
|
80
|
+
}) : /*#__PURE__*/_react.default.createElement(LegacyPortalBucket, {
|
|
81
|
+
id: id,
|
|
82
|
+
portalManager: portalManager
|
|
83
|
+
});
|
|
44
84
|
}
|
|
@@ -10,6 +10,7 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
10
10
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
12
|
var _throttle = _interopRequireDefault(require("lodash/throttle"));
|
|
13
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
13
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
15
16
|
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; }
|
|
@@ -206,9 +207,11 @@ var PortalManager = exports.PortalManager = /*#__PURE__*/function () {
|
|
|
206
207
|
var _this$portalToBucketM,
|
|
207
208
|
_this4 = this;
|
|
208
209
|
var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
209
|
-
this.
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
if (!(0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_reduce_memory_leaks') || !this.portalToBucketMap.has(key)) {
|
|
211
|
+
this.createBucket();
|
|
212
|
+
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
213
|
+
this.buckets[this.getCurrentBucket()].capacity -= 1;
|
|
214
|
+
}
|
|
212
215
|
var id = (_this$portalToBucketM = this.portalToBucketMap.get(key)) !== null && _this$portalToBucketM !== void 0 ? _this$portalToBucketM : this.getCurrentBucket();
|
|
213
216
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
214
217
|
this.portalToBucketMap.set(key, id);
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.corePlugin = void 0;
|
|
7
7
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
-
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
9
8
|
var _nodeAnchorProvider = require("../../node-anchor/node-anchor-provider");
|
|
10
9
|
var _processRawFragmentValue = require("../../utils/processRawFragmentValue");
|
|
11
10
|
var _processRawValue = require("../../utils/processRawValue");
|
|
@@ -74,6 +73,7 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
|
|
|
74
73
|
return true;
|
|
75
74
|
},
|
|
76
75
|
scrollToPos: function scrollToPos(pos, scrollOptions) {
|
|
76
|
+
var _ref2, _editorView$domAtPos;
|
|
77
77
|
var editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
|
|
78
78
|
if (!editorView) {
|
|
79
79
|
return false;
|
|
@@ -83,27 +83,11 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
|
|
|
83
83
|
if (!isValidPos) {
|
|
84
84
|
return false;
|
|
85
85
|
}
|
|
86
|
-
if ((0, _fg.fg)('platform_editor_fix_scroll_to_pos')) {
|
|
87
|
-
var _ref2, _editorView$domAtPos;
|
|
88
|
-
// nodeDOM can return a Text node for inline positions
|
|
89
|
-
var nodeDom = editorView.nodeDOM(pos);
|
|
90
|
-
var _dom = (_ref2 = nodeDom instanceof Element ? nodeDom : null) !== null && _ref2 !== void 0 ? _ref2 : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
91
|
-
if (!(_dom instanceof Element)) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
_dom.scrollIntoView(scrollOptions);
|
|
95
|
-
return true;
|
|
96
|
-
}
|
|
97
86
|
|
|
98
|
-
//
|
|
99
|
-
var
|
|
87
|
+
// nodeDOM can return a Text node for inline positions
|
|
88
|
+
var nodeDom = editorView.nodeDOM(pos);
|
|
89
|
+
var dom = (_ref2 = nodeDom instanceof Element ? nodeDom : null) !== null && _ref2 !== void 0 ? _ref2 : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
100
90
|
if (!(dom instanceof Element)) {
|
|
101
|
-
// If it's not an element (e.g. #text node), we'll try the parent.
|
|
102
|
-
// This is expected to cover most of the scenarios, if not, window.scrollTo is an alternative
|
|
103
|
-
if (dom.parentNode instanceof Element) {
|
|
104
|
-
dom.parentNode.scrollIntoView(scrollOptions);
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
91
|
return false;
|
|
108
92
|
}
|
|
109
93
|
dom.scrollIntoView(scrollOptions);
|
|
@@ -45,8 +45,8 @@ var itemStyles = (0, _xcss.xcss)({
|
|
|
45
45
|
color: 'color.text',
|
|
46
46
|
display: 'flex',
|
|
47
47
|
gap: 'space.150',
|
|
48
|
-
minHeight: '
|
|
49
|
-
paddingBlock: 'space.
|
|
48
|
+
minHeight: '44px',
|
|
49
|
+
paddingBlock: 'space.075',
|
|
50
50
|
paddingInline: 'space.200',
|
|
51
51
|
textAlign: 'start',
|
|
52
52
|
width: '100%',
|
|
@@ -60,8 +60,8 @@ var selectedItemStyles = (0, _xcss.xcss)({
|
|
|
60
60
|
color: 'color.text',
|
|
61
61
|
display: 'flex',
|
|
62
62
|
gap: 'space.150',
|
|
63
|
-
minHeight: '
|
|
64
|
-
paddingBlock: 'space.
|
|
63
|
+
minHeight: '44px',
|
|
64
|
+
paddingBlock: 'space.075',
|
|
65
65
|
paddingInline: 'space.200',
|
|
66
66
|
position: 'relative',
|
|
67
67
|
textAlign: 'start',
|
|
@@ -86,8 +86,8 @@ var disabledItemStyles = (0, _xcss.xcss)({
|
|
|
86
86
|
color: 'color.text.disabled',
|
|
87
87
|
display: 'flex',
|
|
88
88
|
gap: 'space.150',
|
|
89
|
-
minHeight: '
|
|
90
|
-
paddingBlock: 'space.
|
|
89
|
+
minHeight: '44px',
|
|
90
|
+
paddingBlock: 'space.075',
|
|
91
91
|
paddingInline: 'space.200',
|
|
92
92
|
textAlign: 'start',
|
|
93
93
|
width: '100%'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.QuickInsertSearchResultsSection = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _reactIntl = require("react-intl");
|
|
10
|
+
var _messages = require("./messages");
|
|
11
|
+
var _QuickInsertMenuSection = require("./QuickInsertMenuSection");
|
|
12
|
+
var QuickInsertSearchResultsSection = exports.QuickInsertSearchResultsSection = function QuickInsertSearchResultsSection(_ref) {
|
|
13
|
+
var children = _ref.children;
|
|
14
|
+
var _useIntl = (0, _reactIntl.useIntl)(),
|
|
15
|
+
formatMessage = _useIntl.formatMessage;
|
|
16
|
+
return /*#__PURE__*/_react.default.createElement(_QuickInsertMenuSection.QuickInsertMenuSection, {
|
|
17
|
+
title: formatMessage(_messages.messages.searchResults)
|
|
18
|
+
}, children);
|
|
19
|
+
};
|
|
@@ -12,12 +12,23 @@ var _isMenuFooterSectionKey = require("../type-ahead/isMenuFooterSectionKey");
|
|
|
12
12
|
var _isSectionOverflowItemKey = require("../type-ahead/isSectionOverflowItemKey");
|
|
13
13
|
var _itemRank = require("../type-ahead/item-rank");
|
|
14
14
|
var _keys = require("./keys");
|
|
15
|
+
var _QuickInsertSearchResultsSection = require("./QuickInsertSearchResultsSection");
|
|
15
16
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
16
17
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
18
|
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; } } }; }
|
|
18
19
|
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; } }
|
|
19
20
|
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; }
|
|
20
21
|
var SEARCH_TOP_MATCH_LIMIT = 5;
|
|
22
|
+
var SEARCH_RESULTS_HEADING = {
|
|
23
|
+
key: _keys.SEARCH_RESULTS_SECTION.key,
|
|
24
|
+
type: _keys.SEARCH_RESULTS_SECTION.type,
|
|
25
|
+
component: _QuickInsertSearchResultsSection.QuickInsertSearchResultsSection,
|
|
26
|
+
parents: [{
|
|
27
|
+
key: _keys.MENU.key,
|
|
28
|
+
type: _keys.MENU.type,
|
|
29
|
+
rank: 0
|
|
30
|
+
}]
|
|
31
|
+
};
|
|
21
32
|
var getParentRank = function getParentRank(component, parentKey) {
|
|
22
33
|
var _component$parents$fi, _component$parents;
|
|
23
34
|
return (_component$parents$fi = (_component$parents = component.parents) === null || _component$parents === void 0 || (_component$parents = _component$parents.find(function (parent) {
|
|
@@ -106,12 +117,12 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
106
117
|
try {
|
|
107
118
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
108
119
|
var section = _step2.value;
|
|
109
|
-
var
|
|
110
|
-
|
|
120
|
+
var _iterator3 = _createForOfIteratorHelper(getRenderedMenuItems(section, childrenMap, surfaceContext)),
|
|
121
|
+
_step3;
|
|
111
122
|
try {
|
|
112
|
-
for (
|
|
123
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
113
124
|
var _item$match, _match$score, _sourceIndexByCompone;
|
|
114
|
-
var item =
|
|
125
|
+
var item = _step3.value;
|
|
115
126
|
if ((0, _isSectionOverflowItemKey.isSectionOverflowItemKey)(item.key)) {
|
|
116
127
|
continue;
|
|
117
128
|
}
|
|
@@ -128,7 +139,6 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
128
139
|
itemRank: getParentRank(item, section.key),
|
|
129
140
|
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)),
|
|
130
141
|
sourceIndex: (_sourceIndexByCompone = sourceIndexByComponent.get(item)) !== null && _sourceIndexByCompone !== void 0 ? _sourceIndexByCompone : Number.MAX_SAFE_INTEGER,
|
|
131
|
-
section: section,
|
|
132
142
|
sectionRank: getParentRank(section, root.key)
|
|
133
143
|
};
|
|
134
144
|
var existing = matches.get(candidate.identity);
|
|
@@ -137,9 +147,9 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
137
147
|
}
|
|
138
148
|
}
|
|
139
149
|
} catch (err) {
|
|
140
|
-
|
|
150
|
+
_iterator3.e(err);
|
|
141
151
|
} finally {
|
|
142
|
-
|
|
152
|
+
_iterator3.f();
|
|
143
153
|
}
|
|
144
154
|
}
|
|
145
155
|
} catch (err) {
|
|
@@ -149,29 +159,9 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
149
159
|
}
|
|
150
160
|
var uniqueMatches = Array.from(matches.values()).sort(compareMatchedItems);
|
|
151
161
|
var searchResults = getSearchResults(uniqueMatches);
|
|
152
|
-
|
|
153
|
-
var _iterator3 = _createForOfIteratorHelper(uniqueMatches),
|
|
154
|
-
_step3;
|
|
155
|
-
try {
|
|
156
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
157
|
-
var _match = _step3.value;
|
|
158
|
-
var _existing = sectionsByKey.get(_match.section.key);
|
|
159
|
-
if (_existing) {
|
|
160
|
-
_existing.push(_match.item);
|
|
161
|
-
} else {
|
|
162
|
-
sectionsByKey.set(_match.section.key, [_match.section, _match.item]);
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
} catch (err) {
|
|
166
|
-
_iterator3.e(err);
|
|
167
|
-
} finally {
|
|
168
|
-
_iterator3.f();
|
|
169
|
-
}
|
|
170
|
-
var sections = Array.from(sectionsByKey.values());
|
|
171
|
-
if (sections.length > 0) {
|
|
162
|
+
if (searchResults.length > 0) {
|
|
172
163
|
return {
|
|
173
|
-
|
|
174
|
-
sections: sections
|
|
164
|
+
sections: [[SEARCH_RESULTS_HEADING].concat((0, _toConsumableArray2.default)(searchResults))]
|
|
175
165
|
};
|
|
176
166
|
}
|
|
177
167
|
var fallbackItem = contentSections.flatMap(function (section) {
|
|
@@ -182,8 +172,7 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
182
172
|
});
|
|
183
173
|
return {
|
|
184
174
|
fallbackItems: fallbackItem ? [fallbackItem] : [],
|
|
185
|
-
|
|
186
|
-
sections: sections
|
|
175
|
+
sections: []
|
|
187
176
|
};
|
|
188
177
|
};
|
|
189
178
|
|
|
@@ -7,6 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.getQuickInsertMenuRows = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var getQuickInsertMenuRows = exports.getQuickInsertMenuRows = function getQuickInsertMenuRows(model) {
|
|
10
|
-
var _model$
|
|
11
|
-
return [].concat((0, _toConsumableArray2.default)(
|
|
10
|
+
var _model$fallbackItems;
|
|
11
|
+
return [].concat((0, _toConsumableArray2.default)(model.sections.flat()), (0, _toConsumableArray2.default)((_model$fallbackItems = model.fallbackItems) !== null && _model$fallbackItems !== void 0 ? _model$fallbackItems : []));
|
|
12
12
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getBlockTemplateMenuItem = exports.WHITEBOARD_MENU_ITEM = exports.WARNING_PANEL_MENU_ITEM = exports.VIEW_ALL_ELEMENTS_MENU_ITEM = exports.UNORDERED_LIST_MENU_ITEM = exports.TWO_COLUMNS_LAYOUT_MENU_ITEM = exports.THREE_COLUMNS_LAYOUT_MENU_ITEM = exports.TEXT_FORMATTING_SECTION = exports.TABS_MENU_ITEM = exports.TABLE_MENU_ITEM = exports.SYNCED_BLOCK_MENU_ITEM = exports.SUCCESS_PANEL_MENU_ITEM = exports.STRUCTURE_SECTION = exports.STATUS_MENU_ITEM = exports.RULE_MENU_ITEM = exports.ROVO_SECTION = exports.ROADMAP_MENU_ITEM = exports.RETROSPECTIVE_MENU_ITEM = exports.RECOMMENDED_SECTION = exports.PLACEHOLDER_TEXT_MENU_ITEM = exports.OTHER_SECTION = exports.ORDERED_LIST_MENU_ITEM = exports.NOTE_PANEL_MENU_ITEM = exports.MENU = exports.MENTION_MENU_ITEM = exports.MEDIA_SECTION = exports.MEDIA_INSERT_MENU_ITEM = exports.LOOM_MENU_ITEM = exports.JIRA_WORK_ITEMS_MENU_ITEM = exports.JIRA_ISSUE_MENU_ITEM = exports.INFO_PANEL_MENU_ITEM = exports.HYPERLINK_MENU_ITEM = exports.HELP_DIALOG_MENU_ITEM = exports.HEADING_6_MENU_ITEM = exports.HEADING_5_MENU_ITEM = exports.HEADING_4_MENU_ITEM = exports.HEADING_3_MENU_ITEM = exports.HEADING_2_MENU_ITEM = exports.HEADING_1_MENU_ITEM = exports.FOUR_COLUMNS_LAYOUT_MENU_ITEM = exports.FLOWCHART_MENU_ITEM = exports.FIVE_COLUMNS_LAYOUT_MENU_ITEM = exports.EXPAND_MENU_ITEM = exports.ERROR_PANEL_MENU_ITEM = exports.EMOJI_MENU_ITEM = exports.EMBED_SECTION = exports.DIAGRAM_MENU_ITEM = exports.DECISION_MENU_ITEM = exports.DATE_MENU_ITEM = exports.DATA_AND_CHARTS_SECTION = exports.DATABASE_MENU_ITEM = exports.CUSTOM_PANEL_MENU_ITEM = exports.CREATE_SECTION = exports.CONFLUENCE_PAGE_MENU_ITEM = exports.CONFLUENCE_LIST_MENU_ITEM = exports.CODE_BLOCK_MENU_ITEM = exports.BRAINSTORMING_MENU_ITEM = exports.BLOCK_TEMPLATES_SECTION = exports.BLOCKQUOTE_MENU_ITEM = exports.ASSETS_MENU_ITEM = exports.ASK_ROVO_MENU_ITEM = exports.AI_IMAGE_GENERATION_MENU_ITEM = exports.ADD_SUGGESTIONS_TO_CONTENT_SKILL_MENU_ITEM = exports.ACTION_MENU_ITEM = void 0;
|
|
6
|
+
exports.getBlockTemplateMenuItem = exports.WHITEBOARD_MENU_ITEM = exports.WARNING_PANEL_MENU_ITEM = exports.VIEW_ALL_ELEMENTS_MENU_ITEM = exports.UNORDERED_LIST_MENU_ITEM = exports.TWO_COLUMNS_LAYOUT_MENU_ITEM = exports.THREE_COLUMNS_LAYOUT_MENU_ITEM = exports.TEXT_FORMATTING_SECTION = exports.TABS_MENU_ITEM = exports.TABLE_MENU_ITEM = exports.SYNCED_BLOCK_MENU_ITEM = exports.SUCCESS_PANEL_MENU_ITEM = exports.STRUCTURE_SECTION = exports.STATUS_MENU_ITEM = exports.SEARCH_RESULTS_SECTION = exports.RULE_MENU_ITEM = exports.ROVO_SECTION = exports.ROADMAP_MENU_ITEM = exports.RETROSPECTIVE_MENU_ITEM = exports.RECOMMENDED_SECTION = exports.PLACEHOLDER_TEXT_MENU_ITEM = exports.OTHER_SECTION = exports.ORDERED_LIST_MENU_ITEM = exports.NOTE_PANEL_MENU_ITEM = exports.MENU = exports.MENTION_MENU_ITEM = exports.MEDIA_SECTION = exports.MEDIA_INSERT_MENU_ITEM = exports.LOOM_MENU_ITEM = exports.JIRA_WORK_ITEMS_MENU_ITEM = exports.JIRA_ISSUE_MENU_ITEM = exports.INFO_PANEL_MENU_ITEM = exports.HYPERLINK_MENU_ITEM = exports.HELP_DIALOG_MENU_ITEM = exports.HEADING_6_MENU_ITEM = exports.HEADING_5_MENU_ITEM = exports.HEADING_4_MENU_ITEM = exports.HEADING_3_MENU_ITEM = exports.HEADING_2_MENU_ITEM = exports.HEADING_1_MENU_ITEM = exports.FOUR_COLUMNS_LAYOUT_MENU_ITEM = exports.FLOWCHART_MENU_ITEM = exports.FIVE_COLUMNS_LAYOUT_MENU_ITEM = exports.EXPAND_MENU_ITEM = exports.ERROR_PANEL_MENU_ITEM = exports.EMOJI_MENU_ITEM = exports.EMBED_SECTION = exports.DIAGRAM_MENU_ITEM = exports.DECISION_MENU_ITEM = exports.DATE_MENU_ITEM = exports.DATA_AND_CHARTS_SECTION = exports.DATABASE_MENU_ITEM = exports.CUSTOM_PANEL_MENU_ITEM = exports.CREATE_SECTION = exports.CONFLUENCE_PAGE_MENU_ITEM = exports.CONFLUENCE_LIST_MENU_ITEM = exports.CODE_BLOCK_MENU_ITEM = exports.BRAINSTORMING_MENU_ITEM = exports.BLOCK_TEMPLATES_SECTION = exports.BLOCKQUOTE_MENU_ITEM = exports.ASSETS_MENU_ITEM = exports.ASK_ROVO_MENU_ITEM = exports.AI_IMAGE_GENERATION_MENU_ITEM = exports.ADD_SUGGESTIONS_TO_CONTENT_SKILL_MENU_ITEM = exports.ACTION_MENU_ITEM = void 0;
|
|
7
7
|
/* eslint-disable @atlaskit/volt-strict-mode/no-multiple-exports */
|
|
8
8
|
|
|
9
9
|
var MENU = exports.MENU = {
|
|
@@ -50,6 +50,15 @@ var OTHER_SECTION = exports.OTHER_SECTION = {
|
|
|
50
50
|
key: 'quick-insert-other-section',
|
|
51
51
|
type: 'menu-section'
|
|
52
52
|
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Heading shown above the matching items when the menu has a search query. It is not registered,
|
|
56
|
+
* so it never appears in browse mode.
|
|
57
|
+
*/
|
|
58
|
+
var SEARCH_RESULTS_SECTION = exports.SEARCH_RESULTS_SECTION = {
|
|
59
|
+
key: 'quick-insert-search-results-section',
|
|
60
|
+
type: 'menu-section'
|
|
61
|
+
};
|
|
53
62
|
var VIEW_ALL_ELEMENTS_MENU_ITEM = exports.VIEW_ALL_ELEMENTS_MENU_ITEM = {
|
|
54
63
|
key: 'quick-insert-view-all-elements-menu-item',
|
|
55
64
|
type: 'menu-item'
|
|
@@ -141,6 +141,11 @@ var messages = exports.messages = (0, _reactIntl.defineMessages)({
|
|
|
141
141
|
defaultMessage: 'Other elements',
|
|
142
142
|
description: 'Other items in the Quick Insert menu.'
|
|
143
143
|
},
|
|
144
|
+
searchResults: {
|
|
145
|
+
id: 'editor-common.quick-insert.searchResults',
|
|
146
|
+
defaultMessage: 'Search results',
|
|
147
|
+
description: 'Heading shown above the matching items when searching in the Quick Insert menu.'
|
|
148
|
+
},
|
|
144
149
|
previewAttributionBy: {
|
|
145
150
|
id: 'editor-common.quick-insert.previewAttributionBy',
|
|
146
151
|
defaultMessage: 'By {name}',
|
|
@@ -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 = "131.
|
|
27
|
+
var packageVersion = "131.1.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -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 = "131.
|
|
16
|
+
const packageVersion = "131.1.0";
|
|
17
17
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
18
18
|
// Remove URL as it has UGC
|
|
19
19
|
// Ignored via go/ees007
|
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
import React, { useLayoutEffect, useMemo, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* It subscribes to a `PortalManager` instance to listen for changes in the portal content
|
|
5
|
-
* and renders the content of its assigned portal bucket.
|
|
6
|
-
*
|
|
7
|
-
* @param {PortalBucketProps} props The component props.
|
|
8
|
-
* @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
|
|
9
|
-
* @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
|
|
10
|
-
* @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
|
|
11
|
-
*/
|
|
12
|
-
export function PortalBucket({
|
|
1
|
+
import React, { useCallback, useLayoutEffect, useMemo, useReducer, useState } from 'react';
|
|
2
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
3
|
+
function LegacyPortalBucket({
|
|
13
4
|
id,
|
|
14
5
|
portalManager
|
|
15
6
|
}) {
|
|
@@ -27,4 +18,49 @@ export function PortalBucket({
|
|
|
27
18
|
// Render the current portal elements
|
|
28
19
|
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
29
20
|
return /*#__PURE__*/React.createElement(React.Fragment, null, portalElements);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Portals stay in the manager; state is only a render tick. React keeps
|
|
25
|
+
* hook state on both the current and alternate fiber, so storing portals
|
|
26
|
+
* in state would retain removed portals until the next render.
|
|
27
|
+
*/
|
|
28
|
+
function TickPortalBucket({
|
|
29
|
+
id,
|
|
30
|
+
portalManager
|
|
31
|
+
}) {
|
|
32
|
+
var _portalManager$getBuc, _portalManager$getBuc2;
|
|
33
|
+
const [, forceRender] = useReducer(tick => tick + 1, 0);
|
|
34
|
+
const updater = useCallback(() => forceRender(), []);
|
|
35
|
+
useLayoutEffect(() => {
|
|
36
|
+
portalManager.registerBucket(id, updater);
|
|
37
|
+
return () => {
|
|
38
|
+
portalManager.unregisterBucket(id);
|
|
39
|
+
};
|
|
40
|
+
}, [id, portalManager, updater]);
|
|
41
|
+
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
42
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, Object.values((_portalManager$getBuc = (_portalManager$getBuc2 = portalManager.getBuckets()[id]) === null || _portalManager$getBuc2 === void 0 ? void 0 : _portalManager$getBuc2.portals) !== null && _portalManager$getBuc !== void 0 ? _portalManager$getBuc : {}));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* A component for rendering portals managed by a `PortalManager`.
|
|
47
|
+
* It subscribes to a `PortalManager` instance to listen for changes in the portal content
|
|
48
|
+
* and renders the content of its assigned portal bucket.
|
|
49
|
+
*
|
|
50
|
+
* @param {PortalBucketProps} props The component props.
|
|
51
|
+
* @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
|
|
52
|
+
* @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
|
|
53
|
+
* @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
|
|
54
|
+
*/
|
|
55
|
+
export function PortalBucket({
|
|
56
|
+
id,
|
|
57
|
+
portalManager
|
|
58
|
+
}) {
|
|
59
|
+
return isExperimentEnabled('platform_editor_reduce_memory_leaks') ? /*#__PURE__*/React.createElement(TickPortalBucket, {
|
|
60
|
+
id: id,
|
|
61
|
+
portalManager: portalManager
|
|
62
|
+
}) : /*#__PURE__*/React.createElement(LegacyPortalBucket, {
|
|
63
|
+
id: id,
|
|
64
|
+
portalManager: portalManager
|
|
65
|
+
});
|
|
30
66
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import throttle from 'lodash/throttle';
|
|
3
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
3
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
const DEFAULT_INITIAL_BUCKETS = 50;
|
|
5
6
|
const DEFAULT_MAX_BUCKET_CAPACITY = 50;
|
|
@@ -162,9 +163,11 @@ export class PortalManager {
|
|
|
162
163
|
}
|
|
163
164
|
registerPortal(key, portal, immediate = false) {
|
|
164
165
|
var _this$portalToBucketM;
|
|
165
|
-
this.
|
|
166
|
-
|
|
167
|
-
|
|
166
|
+
if (!isExperimentEnabled('platform_editor_reduce_memory_leaks') || !this.portalToBucketMap.has(key)) {
|
|
167
|
+
this.createBucket();
|
|
168
|
+
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
169
|
+
this.buckets[this.getCurrentBucket()].capacity -= 1;
|
|
170
|
+
}
|
|
168
171
|
const id = (_this$portalToBucketM = this.portalToBucketMap.get(key)) !== null && _this$portalToBucketM !== void 0 ? _this$portalToBucketM : this.getCurrentBucket();
|
|
169
172
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
170
173
|
this.portalToBucketMap.set(key, id);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
2
|
import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
|
|
4
3
|
import { processRawFragmentValue } from '../../utils/processRawFragmentValue';
|
|
5
4
|
import { processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
|
|
@@ -70,6 +69,7 @@ export const corePlugin = ({
|
|
|
70
69
|
return true;
|
|
71
70
|
},
|
|
72
71
|
scrollToPos(pos, scrollOptions) {
|
|
72
|
+
var _ref, _editorView$domAtPos;
|
|
73
73
|
const editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
|
|
74
74
|
if (!editorView) {
|
|
75
75
|
return false;
|
|
@@ -79,27 +79,11 @@ export const corePlugin = ({
|
|
|
79
79
|
if (!isValidPos) {
|
|
80
80
|
return false;
|
|
81
81
|
}
|
|
82
|
-
if (fg('platform_editor_fix_scroll_to_pos')) {
|
|
83
|
-
var _ref, _editorView$domAtPos;
|
|
84
|
-
// nodeDOM can return a Text node for inline positions
|
|
85
|
-
const nodeDom = editorView.nodeDOM(pos);
|
|
86
|
-
const dom = (_ref = nodeDom instanceof Element ? nodeDom : null) !== null && _ref !== void 0 ? _ref : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
87
|
-
if (!(dom instanceof Element)) {
|
|
88
|
-
return false;
|
|
89
|
-
}
|
|
90
|
-
dom.scrollIntoView(scrollOptions);
|
|
91
|
-
return true;
|
|
92
|
-
}
|
|
93
82
|
|
|
94
|
-
//
|
|
95
|
-
const
|
|
83
|
+
// nodeDOM can return a Text node for inline positions
|
|
84
|
+
const nodeDom = editorView.nodeDOM(pos);
|
|
85
|
+
const dom = (_ref = nodeDom instanceof Element ? nodeDom : null) !== null && _ref !== void 0 ? _ref : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
96
86
|
if (!(dom instanceof Element)) {
|
|
97
|
-
// If it's not an element (e.g. #text node), we'll try the parent.
|
|
98
|
-
// This is expected to cover most of the scenarios, if not, window.scrollTo is an alternative
|
|
99
|
-
if (dom.parentNode instanceof Element) {
|
|
100
|
-
dom.parentNode.scrollIntoView(scrollOptions);
|
|
101
|
-
return true;
|
|
102
|
-
}
|
|
103
87
|
return false;
|
|
104
88
|
}
|
|
105
89
|
dom.scrollIntoView(scrollOptions);
|
|
@@ -35,8 +35,8 @@ const itemStyles = xcss({
|
|
|
35
35
|
color: 'color.text',
|
|
36
36
|
display: 'flex',
|
|
37
37
|
gap: 'space.150',
|
|
38
|
-
minHeight: '
|
|
39
|
-
paddingBlock: 'space.
|
|
38
|
+
minHeight: '44px',
|
|
39
|
+
paddingBlock: 'space.075',
|
|
40
40
|
paddingInline: 'space.200',
|
|
41
41
|
textAlign: 'start',
|
|
42
42
|
width: '100%',
|
|
@@ -50,8 +50,8 @@ const selectedItemStyles = xcss({
|
|
|
50
50
|
color: 'color.text',
|
|
51
51
|
display: 'flex',
|
|
52
52
|
gap: 'space.150',
|
|
53
|
-
minHeight: '
|
|
54
|
-
paddingBlock: 'space.
|
|
53
|
+
minHeight: '44px',
|
|
54
|
+
paddingBlock: 'space.075',
|
|
55
55
|
paddingInline: 'space.200',
|
|
56
56
|
position: 'relative',
|
|
57
57
|
textAlign: 'start',
|
|
@@ -76,8 +76,8 @@ const disabledItemStyles = xcss({
|
|
|
76
76
|
color: 'color.text.disabled',
|
|
77
77
|
display: 'flex',
|
|
78
78
|
gap: 'space.150',
|
|
79
|
-
minHeight: '
|
|
80
|
-
paddingBlock: 'space.
|
|
79
|
+
minHeight: '44px',
|
|
80
|
+
paddingBlock: 'space.075',
|
|
81
81
|
paddingInline: 'space.200',
|
|
82
82
|
textAlign: 'start',
|
|
83
83
|
width: '100%'
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { messages } from './messages';
|
|
4
|
+
import { QuickInsertMenuSection } from './QuickInsertMenuSection';
|
|
5
|
+
export const QuickInsertSearchResultsSection = ({
|
|
6
|
+
children
|
|
7
|
+
}) => {
|
|
8
|
+
const {
|
|
9
|
+
formatMessage
|
|
10
|
+
} = useIntl();
|
|
11
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuSection, {
|
|
12
|
+
title: formatMessage(messages.searchResults)
|
|
13
|
+
}, children);
|
|
14
|
+
};
|
|
@@ -2,8 +2,19 @@ import { getComponentIdentity, resolveSurface, willComponentRender } from '@atla
|
|
|
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
|
-
import { ASK_ROVO_MENU_ITEM } from './keys';
|
|
5
|
+
import { ASK_ROVO_MENU_ITEM, MENU, SEARCH_RESULTS_SECTION } from './keys';
|
|
6
|
+
import { QuickInsertSearchResultsSection } from './QuickInsertSearchResultsSection';
|
|
6
7
|
const SEARCH_TOP_MATCH_LIMIT = 5;
|
|
8
|
+
const SEARCH_RESULTS_HEADING = {
|
|
9
|
+
key: SEARCH_RESULTS_SECTION.key,
|
|
10
|
+
type: SEARCH_RESULTS_SECTION.type,
|
|
11
|
+
component: QuickInsertSearchResultsSection,
|
|
12
|
+
parents: [{
|
|
13
|
+
key: MENU.key,
|
|
14
|
+
type: MENU.type,
|
|
15
|
+
rank: 0
|
|
16
|
+
}]
|
|
17
|
+
};
|
|
7
18
|
const getParentRank = (component, parentKey) => {
|
|
8
19
|
var _component$parents$fi, _component$parents, _component$parents$fi2;
|
|
9
20
|
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;
|
|
@@ -82,7 +93,6 @@ const buildSearchSections = ({
|
|
|
82
93
|
itemRank: getParentRank(item, section.key),
|
|
83
94
|
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)),
|
|
84
95
|
sourceIndex: (_sourceIndexByCompone = sourceIndexByComponent.get(item)) !== null && _sourceIndexByCompone !== void 0 ? _sourceIndexByCompone : Number.MAX_SAFE_INTEGER,
|
|
85
|
-
section,
|
|
86
96
|
sectionRank: getParentRank(section, root.key)
|
|
87
97
|
};
|
|
88
98
|
const existing = matches.get(candidate.identity);
|
|
@@ -93,20 +103,9 @@ const buildSearchSections = ({
|
|
|
93
103
|
}
|
|
94
104
|
const uniqueMatches = Array.from(matches.values()).sort(compareMatchedItems);
|
|
95
105
|
const searchResults = getSearchResults(uniqueMatches);
|
|
96
|
-
|
|
97
|
-
for (const match of uniqueMatches) {
|
|
98
|
-
const existing = sectionsByKey.get(match.section.key);
|
|
99
|
-
if (existing) {
|
|
100
|
-
existing.push(match.item);
|
|
101
|
-
} else {
|
|
102
|
-
sectionsByKey.set(match.section.key, [match.section, match.item]);
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
const sections = Array.from(sectionsByKey.values());
|
|
106
|
-
if (sections.length > 0) {
|
|
106
|
+
if (searchResults.length > 0) {
|
|
107
107
|
return {
|
|
108
|
-
searchResults
|
|
109
|
-
sections
|
|
108
|
+
sections: [[SEARCH_RESULTS_HEADING, ...searchResults]]
|
|
110
109
|
};
|
|
111
110
|
}
|
|
112
111
|
const fallbackItem = contentSections.flatMap(section => {
|
|
@@ -115,8 +114,7 @@ const buildSearchSections = ({
|
|
|
115
114
|
}).find(component => component.type === ASK_ROVO_MENU_ITEM.type && component.key === ASK_ROVO_MENU_ITEM.key && willComponentRender(component, childrenMap, surfaceContext));
|
|
116
115
|
return {
|
|
117
116
|
fallbackItems: fallbackItem ? [fallbackItem] : [],
|
|
118
|
-
|
|
119
|
-
sections
|
|
117
|
+
sections: []
|
|
120
118
|
};
|
|
121
119
|
};
|
|
122
120
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export const getQuickInsertMenuRows = model => {
|
|
2
|
-
var _model$
|
|
3
|
-
return [...
|
|
2
|
+
var _model$fallbackItems;
|
|
3
|
+
return [...model.sections.flat(), ...((_model$fallbackItems = model.fallbackItems) !== null && _model$fallbackItems !== void 0 ? _model$fallbackItems : [])];
|
|
4
4
|
};
|
|
@@ -44,6 +44,15 @@ export const OTHER_SECTION = {
|
|
|
44
44
|
key: 'quick-insert-other-section',
|
|
45
45
|
type: 'menu-section'
|
|
46
46
|
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Heading shown above the matching items when the menu has a search query. It is not registered,
|
|
50
|
+
* so it never appears in browse mode.
|
|
51
|
+
*/
|
|
52
|
+
export const SEARCH_RESULTS_SECTION = {
|
|
53
|
+
key: 'quick-insert-search-results-section',
|
|
54
|
+
type: 'menu-section'
|
|
55
|
+
};
|
|
47
56
|
export const VIEW_ALL_ELEMENTS_MENU_ITEM = {
|
|
48
57
|
key: 'quick-insert-view-all-elements-menu-item',
|
|
49
58
|
type: 'menu-item'
|
|
@@ -135,6 +135,11 @@ export const messages = defineMessages({
|
|
|
135
135
|
defaultMessage: 'Other elements',
|
|
136
136
|
description: 'Other items in the Quick Insert menu.'
|
|
137
137
|
},
|
|
138
|
+
searchResults: {
|
|
139
|
+
id: 'editor-common.quick-insert.searchResults',
|
|
140
|
+
defaultMessage: 'Search results',
|
|
141
|
+
description: 'Heading shown above the matching items when searching in the Quick Insert menu.'
|
|
142
|
+
},
|
|
138
143
|
previewAttributionBy: {
|
|
139
144
|
id: 'editor-common.quick-insert.previewAttributionBy',
|
|
140
145
|
defaultMessage: 'By {name}',
|
|
@@ -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 = "131.
|
|
17
|
+
const packageVersion = "131.1.0";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -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 = "131.
|
|
22
|
+
var packageVersion = "131.1.0";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -1,16 +1,7 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { useLayoutEffect, useMemo, useState } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* It subscribes to a `PortalManager` instance to listen for changes in the portal content
|
|
6
|
-
* and renders the content of its assigned portal bucket.
|
|
7
|
-
*
|
|
8
|
-
* @param {PortalBucketProps} props The component props.
|
|
9
|
-
* @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
|
|
10
|
-
* @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
|
|
11
|
-
* @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
|
|
12
|
-
*/
|
|
13
|
-
export function PortalBucket(_ref) {
|
|
2
|
+
import React, { useCallback, useLayoutEffect, useMemo, useReducer, useState } from 'react';
|
|
3
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
4
|
+
function LegacyPortalBucket(_ref) {
|
|
14
5
|
var id = _ref.id,
|
|
15
6
|
portalManager = _ref.portalManager;
|
|
16
7
|
// State to hold the current portals for this bucket
|
|
@@ -32,4 +23,53 @@ export function PortalBucket(_ref) {
|
|
|
32
23
|
// Render the current portal elements
|
|
33
24
|
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
34
25
|
return /*#__PURE__*/React.createElement(React.Fragment, null, portalElements);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Portals stay in the manager; state is only a render tick. React keeps
|
|
30
|
+
* hook state on both the current and alternate fiber, so storing portals
|
|
31
|
+
* in state would retain removed portals until the next render.
|
|
32
|
+
*/
|
|
33
|
+
function TickPortalBucket(_ref2) {
|
|
34
|
+
var _portalManager$getBuc, _portalManager$getBuc2;
|
|
35
|
+
var id = _ref2.id,
|
|
36
|
+
portalManager = _ref2.portalManager;
|
|
37
|
+
var _useReducer = useReducer(function (tick) {
|
|
38
|
+
return tick + 1;
|
|
39
|
+
}, 0),
|
|
40
|
+
_useReducer2 = _slicedToArray(_useReducer, 2),
|
|
41
|
+
forceRender = _useReducer2[1];
|
|
42
|
+
var updater = useCallback(function () {
|
|
43
|
+
return forceRender();
|
|
44
|
+
}, []);
|
|
45
|
+
useLayoutEffect(function () {
|
|
46
|
+
portalManager.registerBucket(id, updater);
|
|
47
|
+
return function () {
|
|
48
|
+
portalManager.unregisterBucket(id);
|
|
49
|
+
};
|
|
50
|
+
}, [id, portalManager, updater]);
|
|
51
|
+
// @ts-ignore - TS2322 TypeScript 5.9.2 upgrade
|
|
52
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, Object.values((_portalManager$getBuc = (_portalManager$getBuc2 = portalManager.getBuckets()[id]) === null || _portalManager$getBuc2 === void 0 ? void 0 : _portalManager$getBuc2.portals) !== null && _portalManager$getBuc !== void 0 ? _portalManager$getBuc : {}));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* A component for rendering portals managed by a `PortalManager`.
|
|
57
|
+
* It subscribes to a `PortalManager` instance to listen for changes in the portal content
|
|
58
|
+
* and renders the content of its assigned portal bucket.
|
|
59
|
+
*
|
|
60
|
+
* @param {PortalBucketProps} props The component props.
|
|
61
|
+
* @param {number} props.id The ID for the portal bucket. This ID is used by the `PortalManager` to manage the content of this bucket.
|
|
62
|
+
* @param {PortalManager} props.portalManager An instance of `PortalManager` which manages the registration and unregistration of portal buckets and their content.
|
|
63
|
+
* @returns {React.ReactElement} The React element(s) that are currently registered to this portal bucket.
|
|
64
|
+
*/
|
|
65
|
+
export function PortalBucket(_ref3) {
|
|
66
|
+
var id = _ref3.id,
|
|
67
|
+
portalManager = _ref3.portalManager;
|
|
68
|
+
return isExperimentEnabled('platform_editor_reduce_memory_leaks') ? /*#__PURE__*/React.createElement(TickPortalBucket, {
|
|
69
|
+
id: id,
|
|
70
|
+
portalManager: portalManager
|
|
71
|
+
}) : /*#__PURE__*/React.createElement(LegacyPortalBucket, {
|
|
72
|
+
id: id,
|
|
73
|
+
portalManager: portalManager
|
|
74
|
+
});
|
|
35
75
|
}
|
|
@@ -5,6 +5,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
5
5
|
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; }
|
|
6
6
|
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; }
|
|
7
7
|
import throttle from 'lodash/throttle';
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
var DEFAULT_INITIAL_BUCKETS = 50;
|
|
10
11
|
var DEFAULT_MAX_BUCKET_CAPACITY = 50;
|
|
@@ -199,9 +200,11 @@ export var PortalManager = /*#__PURE__*/function () {
|
|
|
199
200
|
var _this$portalToBucketM,
|
|
200
201
|
_this4 = this;
|
|
201
202
|
var immediate = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
202
|
-
this.
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
if (!isExperimentEnabled('platform_editor_reduce_memory_leaks') || !this.portalToBucketMap.has(key)) {
|
|
204
|
+
this.createBucket();
|
|
205
|
+
// @ts-ignore - TS2538 TypeScript 5.9.2 upgrade
|
|
206
|
+
this.buckets[this.getCurrentBucket()].capacity -= 1;
|
|
207
|
+
}
|
|
205
208
|
var id = (_this$portalToBucketM = this.portalToBucketMap.get(key)) !== null && _this$portalToBucketM !== void 0 ? _this$portalToBucketM : this.getCurrentBucket();
|
|
206
209
|
// @ts-ignore - TS2345 TypeScript 5.9.2 upgrade
|
|
207
210
|
this.portalToBucketMap.set(key, id);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
3
2
|
import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
|
|
4
3
|
import { processRawFragmentValue } from '../../utils/processRawFragmentValue';
|
|
5
4
|
import { processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
|
|
@@ -69,6 +68,7 @@ export var corePlugin = function corePlugin(_ref) {
|
|
|
69
68
|
return true;
|
|
70
69
|
},
|
|
71
70
|
scrollToPos: function scrollToPos(pos, scrollOptions) {
|
|
71
|
+
var _ref2, _editorView$domAtPos;
|
|
72
72
|
var editorView = config === null || config === void 0 ? void 0 : config.getEditorView();
|
|
73
73
|
if (!editorView) {
|
|
74
74
|
return false;
|
|
@@ -78,27 +78,11 @@ export var corePlugin = function corePlugin(_ref) {
|
|
|
78
78
|
if (!isValidPos) {
|
|
79
79
|
return false;
|
|
80
80
|
}
|
|
81
|
-
if (fg('platform_editor_fix_scroll_to_pos')) {
|
|
82
|
-
var _ref2, _editorView$domAtPos;
|
|
83
|
-
// nodeDOM can return a Text node for inline positions
|
|
84
|
-
var nodeDom = editorView.nodeDOM(pos);
|
|
85
|
-
var _dom = (_ref2 = nodeDom instanceof Element ? nodeDom : null) !== null && _ref2 !== void 0 ? _ref2 : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
86
|
-
if (!(_dom instanceof Element)) {
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
_dom.scrollIntoView(scrollOptions);
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
81
|
|
|
93
|
-
//
|
|
94
|
-
var
|
|
82
|
+
// nodeDOM can return a Text node for inline positions
|
|
83
|
+
var nodeDom = editorView.nodeDOM(pos);
|
|
84
|
+
var dom = (_ref2 = nodeDom instanceof Element ? nodeDom : null) !== null && _ref2 !== void 0 ? _ref2 : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
95
85
|
if (!(dom instanceof Element)) {
|
|
96
|
-
// If it's not an element (e.g. #text node), we'll try the parent.
|
|
97
|
-
// This is expected to cover most of the scenarios, if not, window.scrollTo is an alternative
|
|
98
|
-
if (dom.parentNode instanceof Element) {
|
|
99
|
-
dom.parentNode.scrollIntoView(scrollOptions);
|
|
100
|
-
return true;
|
|
101
|
-
}
|
|
102
86
|
return false;
|
|
103
87
|
}
|
|
104
88
|
dom.scrollIntoView(scrollOptions);
|
|
@@ -36,8 +36,8 @@ var itemStyles = xcss({
|
|
|
36
36
|
color: 'color.text',
|
|
37
37
|
display: 'flex',
|
|
38
38
|
gap: 'space.150',
|
|
39
|
-
minHeight: '
|
|
40
|
-
paddingBlock: 'space.
|
|
39
|
+
minHeight: '44px',
|
|
40
|
+
paddingBlock: 'space.075',
|
|
41
41
|
paddingInline: 'space.200',
|
|
42
42
|
textAlign: 'start',
|
|
43
43
|
width: '100%',
|
|
@@ -51,8 +51,8 @@ var selectedItemStyles = xcss({
|
|
|
51
51
|
color: 'color.text',
|
|
52
52
|
display: 'flex',
|
|
53
53
|
gap: 'space.150',
|
|
54
|
-
minHeight: '
|
|
55
|
-
paddingBlock: 'space.
|
|
54
|
+
minHeight: '44px',
|
|
55
|
+
paddingBlock: 'space.075',
|
|
56
56
|
paddingInline: 'space.200',
|
|
57
57
|
position: 'relative',
|
|
58
58
|
textAlign: 'start',
|
|
@@ -77,8 +77,8 @@ var disabledItemStyles = xcss({
|
|
|
77
77
|
color: 'color.text.disabled',
|
|
78
78
|
display: 'flex',
|
|
79
79
|
gap: 'space.150',
|
|
80
|
-
minHeight: '
|
|
81
|
-
paddingBlock: 'space.
|
|
80
|
+
minHeight: '44px',
|
|
81
|
+
paddingBlock: 'space.075',
|
|
82
82
|
paddingInline: 'space.200',
|
|
83
83
|
textAlign: 'start',
|
|
84
84
|
width: '100%'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useIntl } from 'react-intl';
|
|
3
|
+
import { messages } from './messages';
|
|
4
|
+
import { QuickInsertMenuSection } from './QuickInsertMenuSection';
|
|
5
|
+
export var QuickInsertSearchResultsSection = function QuickInsertSearchResultsSection(_ref) {
|
|
6
|
+
var children = _ref.children;
|
|
7
|
+
var _useIntl = useIntl(),
|
|
8
|
+
formatMessage = _useIntl.formatMessage;
|
|
9
|
+
return /*#__PURE__*/React.createElement(QuickInsertMenuSection, {
|
|
10
|
+
title: formatMessage(messages.searchResults)
|
|
11
|
+
}, children);
|
|
12
|
+
};
|
|
@@ -9,8 +9,19 @@ import { getComponentIdentity, resolveSurface, willComponentRender } from '@atla
|
|
|
9
9
|
import { isMenuFooterSectionKey } from '../type-ahead/isMenuFooterSectionKey';
|
|
10
10
|
import { isSectionOverflowItemKey } from '../type-ahead/isSectionOverflowItemKey';
|
|
11
11
|
import { applyRegisteredItemRanks } from '../type-ahead/item-rank';
|
|
12
|
-
import { ASK_ROVO_MENU_ITEM } from './keys';
|
|
12
|
+
import { ASK_ROVO_MENU_ITEM, MENU, SEARCH_RESULTS_SECTION } from './keys';
|
|
13
|
+
import { QuickInsertSearchResultsSection } from './QuickInsertSearchResultsSection';
|
|
13
14
|
var SEARCH_TOP_MATCH_LIMIT = 5;
|
|
15
|
+
var SEARCH_RESULTS_HEADING = {
|
|
16
|
+
key: SEARCH_RESULTS_SECTION.key,
|
|
17
|
+
type: SEARCH_RESULTS_SECTION.type,
|
|
18
|
+
component: QuickInsertSearchResultsSection,
|
|
19
|
+
parents: [{
|
|
20
|
+
key: MENU.key,
|
|
21
|
+
type: MENU.type,
|
|
22
|
+
rank: 0
|
|
23
|
+
}]
|
|
24
|
+
};
|
|
14
25
|
var getParentRank = function getParentRank(component, parentKey) {
|
|
15
26
|
var _component$parents$fi, _component$parents;
|
|
16
27
|
return (_component$parents$fi = (_component$parents = component.parents) === null || _component$parents === void 0 || (_component$parents = _component$parents.find(function (parent) {
|
|
@@ -99,12 +110,12 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
99
110
|
try {
|
|
100
111
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
101
112
|
var section = _step2.value;
|
|
102
|
-
var
|
|
103
|
-
|
|
113
|
+
var _iterator3 = _createForOfIteratorHelper(getRenderedMenuItems(section, childrenMap, surfaceContext)),
|
|
114
|
+
_step3;
|
|
104
115
|
try {
|
|
105
|
-
for (
|
|
116
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
106
117
|
var _item$match, _match$score, _sourceIndexByCompone;
|
|
107
|
-
var item =
|
|
118
|
+
var item = _step3.value;
|
|
108
119
|
if (isSectionOverflowItemKey(item.key)) {
|
|
109
120
|
continue;
|
|
110
121
|
}
|
|
@@ -121,7 +132,6 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
121
132
|
itemRank: getParentRank(item, section.key),
|
|
122
133
|
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)),
|
|
123
134
|
sourceIndex: (_sourceIndexByCompone = sourceIndexByComponent.get(item)) !== null && _sourceIndexByCompone !== void 0 ? _sourceIndexByCompone : Number.MAX_SAFE_INTEGER,
|
|
124
|
-
section: section,
|
|
125
135
|
sectionRank: getParentRank(section, root.key)
|
|
126
136
|
};
|
|
127
137
|
var existing = matches.get(candidate.identity);
|
|
@@ -130,9 +140,9 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
130
140
|
}
|
|
131
141
|
}
|
|
132
142
|
} catch (err) {
|
|
133
|
-
|
|
143
|
+
_iterator3.e(err);
|
|
134
144
|
} finally {
|
|
135
|
-
|
|
145
|
+
_iterator3.f();
|
|
136
146
|
}
|
|
137
147
|
}
|
|
138
148
|
} catch (err) {
|
|
@@ -142,29 +152,9 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
142
152
|
}
|
|
143
153
|
var uniqueMatches = Array.from(matches.values()).sort(compareMatchedItems);
|
|
144
154
|
var searchResults = getSearchResults(uniqueMatches);
|
|
145
|
-
|
|
146
|
-
var _iterator3 = _createForOfIteratorHelper(uniqueMatches),
|
|
147
|
-
_step3;
|
|
148
|
-
try {
|
|
149
|
-
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
150
|
-
var _match = _step3.value;
|
|
151
|
-
var _existing = sectionsByKey.get(_match.section.key);
|
|
152
|
-
if (_existing) {
|
|
153
|
-
_existing.push(_match.item);
|
|
154
|
-
} else {
|
|
155
|
-
sectionsByKey.set(_match.section.key, [_match.section, _match.item]);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
} catch (err) {
|
|
159
|
-
_iterator3.e(err);
|
|
160
|
-
} finally {
|
|
161
|
-
_iterator3.f();
|
|
162
|
-
}
|
|
163
|
-
var sections = Array.from(sectionsByKey.values());
|
|
164
|
-
if (sections.length > 0) {
|
|
155
|
+
if (searchResults.length > 0) {
|
|
165
156
|
return {
|
|
166
|
-
|
|
167
|
-
sections: sections
|
|
157
|
+
sections: [[SEARCH_RESULTS_HEADING].concat(_toConsumableArray(searchResults))]
|
|
168
158
|
};
|
|
169
159
|
}
|
|
170
160
|
var fallbackItem = contentSections.flatMap(function (section) {
|
|
@@ -175,8 +165,7 @@ var buildSearchSections = function buildSearchSections(_ref5) {
|
|
|
175
165
|
});
|
|
176
166
|
return {
|
|
177
167
|
fallbackItems: fallbackItem ? [fallbackItem] : [],
|
|
178
|
-
|
|
179
|
-
sections: sections
|
|
168
|
+
sections: []
|
|
180
169
|
};
|
|
181
170
|
};
|
|
182
171
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
export var getQuickInsertMenuRows = function getQuickInsertMenuRows(model) {
|
|
3
|
-
var _model$
|
|
4
|
-
return [].concat(_toConsumableArray(
|
|
3
|
+
var _model$fallbackItems;
|
|
4
|
+
return [].concat(_toConsumableArray(model.sections.flat()), _toConsumableArray((_model$fallbackItems = model.fallbackItems) !== null && _model$fallbackItems !== void 0 ? _model$fallbackItems : []));
|
|
5
5
|
};
|
|
@@ -44,6 +44,15 @@ export var OTHER_SECTION = {
|
|
|
44
44
|
key: 'quick-insert-other-section',
|
|
45
45
|
type: 'menu-section'
|
|
46
46
|
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Heading shown above the matching items when the menu has a search query. It is not registered,
|
|
50
|
+
* so it never appears in browse mode.
|
|
51
|
+
*/
|
|
52
|
+
export var SEARCH_RESULTS_SECTION = {
|
|
53
|
+
key: 'quick-insert-search-results-section',
|
|
54
|
+
type: 'menu-section'
|
|
55
|
+
};
|
|
47
56
|
export var VIEW_ALL_ELEMENTS_MENU_ITEM = {
|
|
48
57
|
key: 'quick-insert-view-all-elements-menu-item',
|
|
49
58
|
type: 'menu-item'
|
|
@@ -135,6 +135,11 @@ export var messages = defineMessages({
|
|
|
135
135
|
defaultMessage: 'Other elements',
|
|
136
136
|
description: 'Other items in the Quick Insert menu.'
|
|
137
137
|
},
|
|
138
|
+
searchResults: {
|
|
139
|
+
id: 'editor-common.quick-insert.searchResults',
|
|
140
|
+
defaultMessage: 'Search results',
|
|
141
|
+
description: 'Heading shown above the matching items when searching in the Quick Insert menu.'
|
|
142
|
+
},
|
|
138
143
|
previewAttributionBy: {
|
|
139
144
|
id: 'editor-common.quick-insert.previewAttributionBy',
|
|
140
145
|
defaultMessage: 'By {name}',
|
|
@@ -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 = "131.
|
|
24
|
+
var packageVersion = "131.1.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -8,7 +8,10 @@ export type QuickInsertMenuModel = {
|
|
|
8
8
|
fallbackItems?: RegisterMenuItem[];
|
|
9
9
|
footer: RegisterMenuItem | undefined;
|
|
10
10
|
root: RegisterComponent | undefined;
|
|
11
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Groups to render, in order. Browse returns one group per category. A search with matches
|
|
13
|
+
* returns a single Search results group of ranked matches.
|
|
14
|
+
*/
|
|
12
15
|
sections: QuickInsertMenuSection[];
|
|
13
16
|
};
|
|
14
17
|
/**
|
|
@@ -42,6 +42,14 @@ export declare const OTHER_SECTION: {
|
|
|
42
42
|
readonly key: 'quick-insert-other-section';
|
|
43
43
|
readonly type: 'menu-section';
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Heading shown above the matching items when the menu has a search query. It is not registered,
|
|
47
|
+
* so it never appears in browse mode.
|
|
48
|
+
*/
|
|
49
|
+
export declare const SEARCH_RESULTS_SECTION: {
|
|
50
|
+
readonly key: 'quick-insert-search-results-section';
|
|
51
|
+
readonly type: 'menu-section';
|
|
52
|
+
};
|
|
45
53
|
export declare const VIEW_ALL_ELEMENTS_MENU_ITEM: {
|
|
46
54
|
readonly key: 'quick-insert-view-all-elements-menu-item';
|
|
47
55
|
readonly type: 'menu-item';
|
|
@@ -3,5 +3,5 @@ type Messages<Keys extends string> = Record<Keys, MessageDescriptor & {
|
|
|
3
3
|
defaultMessage: string;
|
|
4
4
|
id: string;
|
|
5
5
|
}>;
|
|
6
|
-
export declare const messages: Messages<'admin' | 'AI' | 'all' | 'browse' | 'categoryBlockTemplates' | 'categoryCreate' | 'categoryDataAndCharts' | 'categoryEmbed' | 'categoryMedia' | 'categoryOther' | 'categoryRecommended' | 'categoryRovo' | 'categoryStructure' | 'categoryTextFormatting' | 'previewAttributionBy' | 'previewAttributionAtlassian' | 'previewAttributionAssets' | 'previewAttributionConfluence' | 'previewAttributionJira' | 'previewAttributionJiraServiceManagement' | 'previewAttributionMicrosoft' | 'close' | 'communication' | 'confluence-content' | 'development' | 'external-content' | 'featuredWhiteboardDescription' | 'formatting' | 'help' | 'insert' | 'media' | 'navigation' | 'reporting' | 'visuals'>;
|
|
6
|
+
export declare const messages: Messages<'admin' | 'AI' | 'all' | 'browse' | 'categoryBlockTemplates' | 'categoryCreate' | 'categoryDataAndCharts' | 'categoryEmbed' | 'categoryMedia' | 'categoryOther' | 'categoryRecommended' | 'categoryRovo' | 'categoryStructure' | 'categoryTextFormatting' | 'searchResults' | 'previewAttributionBy' | 'previewAttributionAtlassian' | 'previewAttributionAssets' | 'previewAttributionConfluence' | 'previewAttributionJira' | 'previewAttributionJiraServiceManagement' | 'previewAttributionMicrosoft' | 'close' | 'communication' | 'confluence-content' | 'development' | 'external-content' | 'featuredWhiteboardDescription' | 'formatting' | 'help' | 'insert' | 'media' | 'navigation' | 'reporting' | 'visuals'>;
|
|
7
7
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "131.
|
|
3
|
+
"version": "131.1.1",
|
|
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/"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@atlaskit/task-decision": "^21.12.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": "^238.0.0",
|
|
89
89
|
"@atlaskit/tokens": "^20.5.0",
|
|
90
90
|
"@atlaskit/tooltip": "^24.4.0",
|
|
91
91
|
"@atlaskit/width-detector": "^7.2.0",
|
|
@@ -229,9 +229,6 @@
|
|
|
229
229
|
"platform_editor_panel_c1_fallback_transform": {
|
|
230
230
|
"type": "boolean"
|
|
231
231
|
},
|
|
232
|
-
"platform_editor_fix_scroll_to_pos": {
|
|
233
|
-
"type": "boolean"
|
|
234
|
-
},
|
|
235
232
|
"platform_editor_custom_emoji_unicode_fallback": {
|
|
236
233
|
"type": "boolean"
|
|
237
234
|
},
|