@atlaskit/editor-common 125.2.1 → 125.3.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 +19 -0
- package/dist/cjs/element-browser/components/ElementBrowserLoader.js +8 -31
- package/dist/cjs/extensions/extension-handlers.js +17 -96
- package/dist/cjs/floating-toolbar/DropdownMenuExtensionItems.js +4 -25
- package/dist/cjs/icons/index.js +10 -33
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/assets/index.js +257 -888
- package/dist/cjs/toolbar-flag-check.js +2 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Mention/mention-with-profilecard.js +11 -30
- package/dist/cjs/ui/Popup/index.js +101 -17
- package/dist/es2019/element-browser/components/ElementBrowserLoader.js +2 -16
- package/dist/es2019/extensions/extension-handlers.js +15 -70
- package/dist/es2019/floating-toolbar/DropdownMenuExtensionItems.js +2 -16
- package/dist/es2019/icons/index.js +3 -17
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/assets/index.js +66 -386
- package/dist/es2019/toolbar-flag-check.js +2 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Mention/mention-with-profilecard.js +4 -15
- package/dist/es2019/ui/Popup/index.js +89 -7
- package/dist/esm/element-browser/components/ElementBrowserLoader.js +6 -28
- package/dist/esm/extensions/extension-handlers.js +17 -97
- package/dist/esm/floating-toolbar/DropdownMenuExtensionItems.js +4 -24
- package/dist/esm/icons/index.js +7 -29
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/assets/index.js +194 -764
- package/dist/esm/toolbar-flag-check.js +2 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Mention/mention-with-profilecard.js +8 -25
- package/dist/esm/ui/Popup/index.js +101 -17
- package/dist/types/icons/index.d.ts +3 -5
- package/dist/types/quick-insert/assets/index.d.ts +32 -34
- package/dist/types/ui/Popup/index.d.ts +11 -0
- package/package.json +3 -4
|
@@ -5,6 +5,7 @@ import { bind } from 'bind-event-listener';
|
|
|
5
5
|
import createFocusTrap from 'focus-trap';
|
|
6
6
|
import rafSchedule from 'raf-schd';
|
|
7
7
|
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
9
|
import { calculatePlacement, calculatePosition, findOverflowScrollParent } from './utils';
|
|
9
10
|
import { validatePosition } from './validatePosition';
|
|
10
11
|
// Ignored via go/ees005
|
|
@@ -15,10 +16,45 @@ export default class Popup extends React.Component {
|
|
|
15
16
|
super(...args);
|
|
16
17
|
_defineProperty(this, "rafIds", new Set());
|
|
17
18
|
_defineProperty(this, "state", {
|
|
19
|
+
targetVisible: true,
|
|
18
20
|
validPosition: true
|
|
19
21
|
});
|
|
20
22
|
_defineProperty(this, "popupRef", /*#__PURE__*/React.createRef());
|
|
21
23
|
_defineProperty(this, "placement", ['', '']);
|
|
24
|
+
_defineProperty(this, "setTargetVisibility", targetVisible => {
|
|
25
|
+
if (targetVisible !== this.state.targetVisible) {
|
|
26
|
+
if (!targetVisible) {
|
|
27
|
+
var _this$focusTrap;
|
|
28
|
+
// Let consumers preserve focus before the popup becomes hidden.
|
|
29
|
+
this.reportTargetVisibility(targetVisible);
|
|
30
|
+
(_this$focusTrap = this.focusTrap) === null || _this$focusTrap === void 0 ? void 0 : _this$focusTrap.pause();
|
|
31
|
+
this.setState({
|
|
32
|
+
targetVisible
|
|
33
|
+
});
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Reveal the popup before consumers restore focus to its contents.
|
|
38
|
+
this.setState({
|
|
39
|
+
targetVisible
|
|
40
|
+
}, () => {
|
|
41
|
+
if (this.props.focusTrap) {
|
|
42
|
+
var _this$focusTrap2;
|
|
43
|
+
(_this$focusTrap2 = this.focusTrap) === null || _this$focusTrap2 === void 0 ? void 0 : _this$focusTrap2.unpause();
|
|
44
|
+
}
|
|
45
|
+
this.reportTargetVisibility(targetVisible);
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
this.reportTargetVisibility(targetVisible);
|
|
50
|
+
});
|
|
51
|
+
_defineProperty(this, "reportTargetVisibility", targetVisible => {
|
|
52
|
+
if (targetVisible !== this.reportedTargetVisibility) {
|
|
53
|
+
var _this$props$onTargetV, _this$props;
|
|
54
|
+
this.reportedTargetVisibility = targetVisible;
|
|
55
|
+
(_this$props$onTargetV = (_this$props = this.props).onTargetVisibilityChanged) === null || _this$props$onTargetV === void 0 ? void 0 : _this$props$onTargetV.call(_this$props, targetVisible);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
22
58
|
_defineProperty(this, "handleRef", popup => {
|
|
23
59
|
if (!popup) {
|
|
24
60
|
return;
|
|
@@ -137,6 +173,38 @@ export default class Popup extends React.Component {
|
|
|
137
173
|
});
|
|
138
174
|
}
|
|
139
175
|
}
|
|
176
|
+
initTargetVisibilityObserver() {
|
|
177
|
+
var _this$targetVisibilit, _observedTarget$owner;
|
|
178
|
+
const {
|
|
179
|
+
hideWhenTargetOutOfView,
|
|
180
|
+
target,
|
|
181
|
+
visibilityTarget
|
|
182
|
+
} = this.props;
|
|
183
|
+
const observedTarget = visibilityTarget !== null && visibilityTarget !== void 0 ? visibilityTarget : target;
|
|
184
|
+
(_this$targetVisibilit = this.targetVisibilityObserver) === null || _this$targetVisibilit === void 0 ? void 0 : _this$targetVisibilit.disconnect();
|
|
185
|
+
this.targetVisibilityObserver = undefined;
|
|
186
|
+
if (!hideWhenTargetOutOfView || !isExperimentEnabled('platform_editor_popup_target_visibility')) {
|
|
187
|
+
if (!this.state.targetVisible) {
|
|
188
|
+
this.setTargetVisibility(true);
|
|
189
|
+
}
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
this.reportedTargetVisibility = undefined;
|
|
193
|
+
const IntersectionObserverConstructor = observedTarget === null || observedTarget === void 0 ? void 0 : (_observedTarget$owner = observedTarget.ownerDocument.defaultView) === null || _observedTarget$owner === void 0 ? void 0 : _observedTarget$owner.IntersectionObserver;
|
|
194
|
+
if (!IntersectionObserverConstructor || !observedTarget) {
|
|
195
|
+
this.setTargetVisibility(true);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
this.targetVisibilityObserver = new IntersectionObserverConstructor(entries => {
|
|
199
|
+
var _entry$isIntersecting;
|
|
200
|
+
const entry = entries[entries.length - 1];
|
|
201
|
+
this.setTargetVisibility((_entry$isIntersecting = entry === null || entry === void 0 ? void 0 : entry.isIntersecting) !== null && _entry$isIntersecting !== void 0 ? _entry$isIntersecting : true);
|
|
202
|
+
}, {
|
|
203
|
+
root: null
|
|
204
|
+
});
|
|
205
|
+
this.targetVisibilityObserver.observe(observedTarget);
|
|
206
|
+
this.setTargetVisibility(true);
|
|
207
|
+
}
|
|
140
208
|
cannotSetPopup(popup, target, overflowScrollParent) {
|
|
141
209
|
/**
|
|
142
210
|
* Check whether:
|
|
@@ -199,9 +267,9 @@ export default class Popup extends React.Component {
|
|
|
199
267
|
* Deactivates the focus trap if it exists
|
|
200
268
|
*/
|
|
201
269
|
destroyFocusTrap() {
|
|
202
|
-
var _this$
|
|
270
|
+
var _this$focusTrap3;
|
|
203
271
|
this.initFocusTrap.cancel();
|
|
204
|
-
(_this$
|
|
272
|
+
(_this$focusTrap3 = this.focusTrap) === null || _this$focusTrap3 === void 0 ? void 0 : _this$focusTrap3.deactivate();
|
|
205
273
|
}
|
|
206
274
|
|
|
207
275
|
/**
|
|
@@ -211,8 +279,8 @@ export default class Popup extends React.Component {
|
|
|
211
279
|
if (prevProps.focusTrap !== this.props.focusTrap) {
|
|
212
280
|
// If currently set to disable, then pause the trap if it exists
|
|
213
281
|
if (!this.props.focusTrap) {
|
|
214
|
-
var _this$
|
|
215
|
-
return (_this$
|
|
282
|
+
var _this$focusTrap4;
|
|
283
|
+
return (_this$focusTrap4 = this.focusTrap) === null || _this$focusTrap4 === void 0 ? void 0 : _this$focusTrap4.pause();
|
|
216
284
|
}
|
|
217
285
|
|
|
218
286
|
// If set to enabled and trap already exists, unpause
|
|
@@ -259,6 +327,11 @@ export default class Popup extends React.Component {
|
|
|
259
327
|
if (prevProps.scrollableElement !== this.props.scrollableElement) {
|
|
260
328
|
this.initScrollElement();
|
|
261
329
|
}
|
|
330
|
+
// Reconfigure while enabled, or once after disabling to clean up the existing observer.
|
|
331
|
+
// A different target must be observed again.
|
|
332
|
+
if ((prevProps.hideWhenTargetOutOfView || this.props.hideWhenTargetOutOfView) && (prevProps.hideWhenTargetOutOfView !== this.props.hideWhenTargetOutOfView || prevProps.target !== this.props.target || prevProps.visibilityTarget !== this.props.visibilityTarget)) {
|
|
333
|
+
this.initTargetVisibilityObserver();
|
|
334
|
+
}
|
|
262
335
|
if (this.props !== prevProps) {
|
|
263
336
|
this.scheduledUpdatePosition(prevProps);
|
|
264
337
|
}
|
|
@@ -268,12 +341,16 @@ export default class Popup extends React.Component {
|
|
|
268
341
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
269
342
|
window.addEventListener('resize', this.onResize);
|
|
270
343
|
this.initScrollElement();
|
|
344
|
+
if (this.props.hideWhenTargetOutOfView) {
|
|
345
|
+
this.initTargetVisibilityObserver();
|
|
346
|
+
}
|
|
271
347
|
}
|
|
272
348
|
componentWillUnmount() {
|
|
273
|
-
var _this$unbindScroll2, _this$resizeObserver3;
|
|
349
|
+
var _this$targetVisibilit2, _this$unbindScroll2, _this$resizeObserver3;
|
|
274
350
|
// Ignored via go/ees005
|
|
275
351
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
276
352
|
window.removeEventListener('resize', this.onResize);
|
|
353
|
+
(_this$targetVisibilit2 = this.targetVisibilityObserver) === null || _this$targetVisibilit2 === void 0 ? void 0 : _this$targetVisibilit2.disconnect();
|
|
277
354
|
(_this$unbindScroll2 = this.unbindScroll) === null || _this$unbindScroll2 === void 0 ? void 0 : _this$unbindScroll2.call(this);
|
|
278
355
|
if (this.scrollElement) {
|
|
279
356
|
// Ignored via go/ees005
|
|
@@ -293,7 +370,8 @@ export default class Popup extends React.Component {
|
|
|
293
370
|
renderPopup() {
|
|
294
371
|
var _this$props$ariaLabel;
|
|
295
372
|
const {
|
|
296
|
-
position
|
|
373
|
+
position,
|
|
374
|
+
targetVisible
|
|
297
375
|
} = this.state;
|
|
298
376
|
const {
|
|
299
377
|
shouldRenderPopup
|
|
@@ -327,7 +405,11 @@ export default class Popup extends React.Component {
|
|
|
327
405
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
328
406
|
...position,
|
|
329
407
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
330
|
-
...this.props.style
|
|
408
|
+
...this.props.style,
|
|
409
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Runtime visibility follows the target's scroll position.
|
|
410
|
+
...(this.props.hideWhenTargetOutOfView && isExperimentEnabled('platform_editor_popup_target_visibility') && !targetVisible && {
|
|
411
|
+
visibility: 'hidden'
|
|
412
|
+
})
|
|
331
413
|
},
|
|
332
414
|
role: getRole(),
|
|
333
415
|
"aria-label": ariaLabel,
|
|
@@ -7,11 +7,6 @@ import React from 'react';
|
|
|
7
7
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
8
8
|
import { css, jsx } from '@emotion/react';
|
|
9
9
|
import Loadable from 'react-loadable';
|
|
10
|
-
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
11
|
-
import { lazy, LazySuspense } from 'react-loosely-lazy';
|
|
12
|
-
|
|
13
|
-
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
14
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
15
10
|
import Spinner from '@atlaskit/spinner/spinner';
|
|
16
11
|
var spinnerContainer = css({
|
|
17
12
|
display: 'flex',
|
|
@@ -20,19 +15,12 @@ var spinnerContainer = css({
|
|
|
20
15
|
height: '100%',
|
|
21
16
|
width: '100%'
|
|
22
17
|
});
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
return module
|
|
26
|
-
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
return import( /* webpackChunkName: "@atlaskit-internal_editor-element-browser" */'../ElementBrowser').then(function (module) {
|
|
30
|
-
return module.default;
|
|
31
|
-
});
|
|
32
|
-
});
|
|
33
|
-
ElementBrowserLazy.displayName = 'lazy(ElementBrowser)';
|
|
34
|
-
var ElementBrowserLoadable = Loadable({
|
|
35
|
-
loader: loadElementBrowser,
|
|
18
|
+
var ElementBrowserLoader = Loadable({
|
|
19
|
+
loader: function loader() {
|
|
20
|
+
return import( /* webpackChunkName: "@atlaskit-internal_editor-element-browser" */'../ElementBrowser').then(function (module) {
|
|
21
|
+
return module.default;
|
|
22
|
+
});
|
|
23
|
+
},
|
|
36
24
|
loading: function loading() {
|
|
37
25
|
return jsx("div", {
|
|
38
26
|
css: spinnerContainer
|
|
@@ -42,14 +30,4 @@ var ElementBrowserLoadable = Loadable({
|
|
|
42
30
|
}));
|
|
43
31
|
}
|
|
44
32
|
});
|
|
45
|
-
var ElementBrowserLoader = function ElementBrowserLoader(props) {
|
|
46
|
-
return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? jsx(LazySuspense, {
|
|
47
|
-
fallback: null
|
|
48
|
-
}, jsx(ElementBrowserLazy, props)) :
|
|
49
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
50
|
-
jsx(ElementBrowserLoadable, props);
|
|
51
|
-
};
|
|
52
|
-
ElementBrowserLoader.preload = function () {
|
|
53
|
-
return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? ElementBrowserLazy.preload() : ElementBrowserLoadable.preload();
|
|
54
|
-
};
|
|
55
33
|
export default ElementBrowserLoader;
|
|
@@ -1,21 +1,9 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
-
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
3
|
-
import _createClass from "@babel/runtime/helpers/createClass";
|
|
4
|
-
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
|
-
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
import _inherits from "@babel/runtime/helpers/inherits";
|
|
7
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
8
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
9
2
|
import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
10
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
-
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
12
|
-
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
13
4
|
import React from 'react';
|
|
14
5
|
import { useIntl } from 'react-intl';
|
|
15
6
|
import Loadable from 'react-loadable';
|
|
16
|
-
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
17
|
-
import { lazy, LazySuspense } from 'react-loosely-lazy';
|
|
18
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
19
7
|
import { getExtensionKeyAndNodeKey, resolveImport } from './manifest-helpers';
|
|
20
8
|
import { messages } from './messages';
|
|
21
9
|
import { resolveImportSync } from './resolveImportSync';
|
|
@@ -117,52 +105,6 @@ function isUnknownConfluenceMacroWithBody(extensionNode) {
|
|
|
117
105
|
var _extensionNode$parame;
|
|
118
106
|
return extensionNode !== null && extensionNode.type === 'extension' && extensionNode.extensionType === 'com.atlassian.confluence.macro.core' && !!((_extensionNode$parame = extensionNode.parameters) !== null && _extensionNode$parame !== void 0 && (_extensionNode$parame = _extensionNode$parame.macroParams) !== null && _extensionNode$parame !== void 0 && (_extensionNode$parame = _extensionNode$parame.__bodyContent) !== null && _extensionNode$parame !== void 0 && _extensionNode$parame.value);
|
|
119
107
|
}
|
|
120
|
-
// eslint-disable-next-line @repo/internal/react/no-class-components -- error boundaries require a class component
|
|
121
|
-
var ExtensionRendererErrorBoundary = /*#__PURE__*/function (_React$Component) {
|
|
122
|
-
function ExtensionRendererErrorBoundary() {
|
|
123
|
-
var _this;
|
|
124
|
-
_classCallCheck(this, ExtensionRendererErrorBoundary);
|
|
125
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
126
|
-
args[_key] = arguments[_key];
|
|
127
|
-
}
|
|
128
|
-
_this = _callSuper(this, ExtensionRendererErrorBoundary, [].concat(args));
|
|
129
|
-
_defineProperty(_this, "state", {});
|
|
130
|
-
return _this;
|
|
131
|
-
}
|
|
132
|
-
_inherits(ExtensionRendererErrorBoundary, _React$Component);
|
|
133
|
-
return _createClass(ExtensionRendererErrorBoundary, [{
|
|
134
|
-
key: "componentDidCatch",
|
|
135
|
-
value: function componentDidCatch(error) {
|
|
136
|
-
// eslint-disable-next-line no-console
|
|
137
|
-
console.error('Error rendering extension', error);
|
|
138
|
-
}
|
|
139
|
-
}, {
|
|
140
|
-
key: "render",
|
|
141
|
-
value: function render() {
|
|
142
|
-
return this.state.error ? renderExtensionLoadingError(this.state.error, this.props.fallbackProps) : this.props.children;
|
|
143
|
-
}
|
|
144
|
-
}], [{
|
|
145
|
-
key: "getDerivedStateFromError",
|
|
146
|
-
value: function getDerivedStateFromError(error) {
|
|
147
|
-
return {
|
|
148
|
-
error: error
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
}]);
|
|
152
|
-
}(React.Component);
|
|
153
|
-
var noop = function noop() {};
|
|
154
|
-
function renderExtensionLoadingError(error, props) {
|
|
155
|
-
// Needed because the old react-loadable (older code-splitting library) error handling behaviour might be relied on by extensions.
|
|
156
|
-
// https://unpkg.com/react-loadable@5.2.2/lib/index.js
|
|
157
|
-
return /*#__PURE__*/React.createElement(ExtensionLoading, _extends({
|
|
158
|
-
isLoading: false,
|
|
159
|
-
pastDelay: true,
|
|
160
|
-
timedOut: false,
|
|
161
|
-
error: error,
|
|
162
|
-
retry: noop
|
|
163
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
164
|
-
}, props));
|
|
165
|
-
}
|
|
166
108
|
function ExtensionLoading(props) {
|
|
167
109
|
var intl = useIntl();
|
|
168
110
|
var extensionNode = props.node;
|
|
@@ -185,51 +127,29 @@ function ExtensionLoading(props) {
|
|
|
185
127
|
|
|
186
128
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
187
129
|
export function getNodeRenderer(extensionProvider, extensionType, extensionKey) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
});
|
|
206
|
-
LazyNodeRenderer.displayName = 'lazy(NodeRenderer)';
|
|
207
|
-
// Ignored via go/ees005
|
|
208
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
209
|
-
var LoadableNodeRenderer = Loadable({
|
|
210
|
-
loader: loadNodeRenderer,
|
|
130
|
+
return Loadable({
|
|
131
|
+
loader: function loader() {
|
|
132
|
+
var maybePromise = getExtensionModuleNodeMaybePreloaded(extensionProvider, extensionType, extensionKey);
|
|
133
|
+
if (maybePromise instanceof Promise) {
|
|
134
|
+
return maybePromise.then(function (node) {
|
|
135
|
+
return resolveImport(node.render());
|
|
136
|
+
});
|
|
137
|
+
} else {
|
|
138
|
+
var _renderSync, _ref;
|
|
139
|
+
var preloaded = maybePromise === null || maybePromise === void 0 || (_renderSync = (_ref = maybePromise).renderSync) === null || _renderSync === void 0 ? void 0 : _renderSync.call(_ref);
|
|
140
|
+
// Only product implemented preloading will return sync result
|
|
141
|
+
// However the out-of-box won't handle this. Confluence uses a custom implementation
|
|
142
|
+
return preloaded ?
|
|
143
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
144
|
+
resolveImportSync(preloaded) : resolveImport(maybePromise.render());
|
|
145
|
+
}
|
|
146
|
+
},
|
|
211
147
|
// react-loadable passes all props from <NodeRenderer> to the loading component at runtime,
|
|
212
148
|
// but its TypeScript types only expect LoadingComponentProps. We cast here because
|
|
213
149
|
// ExtensionLoading accepts additional props (node, showUnknownMacroPlaceholder) that
|
|
214
150
|
// react-loadable will pass through but doesn't know about in its type definitions.
|
|
215
151
|
loading: ExtensionLoading
|
|
216
152
|
});
|
|
217
|
-
var NodeRenderer = function NodeRenderer(props) {
|
|
218
|
-
var _props$loadingFallbac;
|
|
219
|
-
if (!isExperimentEnabled('platform_editor_loosely_lazy_migration')) {
|
|
220
|
-
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
221
|
-
return /*#__PURE__*/React.createElement(LoadableNodeRenderer, props);
|
|
222
|
-
}
|
|
223
|
-
return /*#__PURE__*/React.createElement(ExtensionRendererErrorBoundary, {
|
|
224
|
-
fallbackProps: props
|
|
225
|
-
}, /*#__PURE__*/React.createElement(LazySuspense, {
|
|
226
|
-
fallback: (_props$loadingFallbac = props.loadingFallback) !== null && _props$loadingFallbac !== void 0 ? _props$loadingFallbac : null
|
|
227
|
-
}, /*#__PURE__*/React.createElement(LazyNodeRenderer, props)));
|
|
228
|
-
};
|
|
229
|
-
NodeRenderer.preload = function () {
|
|
230
|
-
return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? LazyNodeRenderer.preload() : LoadableNodeRenderer.preload();
|
|
231
|
-
};
|
|
232
|
-
return NodeRenderer;
|
|
233
153
|
}
|
|
234
154
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
235
155
|
export { getExtensionManifest } from './getExtensionManifest';
|
|
@@ -3,9 +3,6 @@ import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
|
|
|
3
3
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
4
|
import React, { useEffect, useRef, useState } from 'react';
|
|
5
5
|
import Loadable from 'react-loadable';
|
|
6
|
-
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
7
|
-
import { lazy, LazySuspense } from 'react-loosely-lazy';
|
|
8
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
6
|
import { getContextualToolbarItemsFromModule } from '../extensions';
|
|
10
7
|
import { nodeToJSON } from '../utils';
|
|
11
8
|
import { DropdownMenuItem } from './DropdownMenuItem';
|
|
@@ -88,29 +85,12 @@ var DropdownMenuExtensionItem = function DropdownMenuExtensionItem(_ref3) {
|
|
|
88
85
|
// Use ref to keep icon component stable across renders
|
|
89
86
|
var iconRef = useRef(null);
|
|
90
87
|
if (!iconRef.current && item.icon) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return resolveExtensionIcon(item.icon);
|
|
96
|
-
});
|
|
97
|
-
IconLazy.displayName = 'lazy(ExtensionIcon)';
|
|
98
|
-
var IconLoadable = Loadable({
|
|
99
|
-
loader: loadIcon,
|
|
88
|
+
iconRef.current = Loadable({
|
|
89
|
+
loader: function loader() {
|
|
90
|
+
return resolveExtensionIcon(item.icon);
|
|
91
|
+
},
|
|
100
92
|
loading: noop
|
|
101
93
|
});
|
|
102
|
-
var Icon = function Icon(props) {
|
|
103
|
-
return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/React.createElement(LazySuspense, {
|
|
104
|
-
fallback: null
|
|
105
|
-
}, /*#__PURE__*/React.createElement(IconLazy, props)) :
|
|
106
|
-
/*#__PURE__*/
|
|
107
|
-
// eslint-disable-next-line react/jsx-props-no-spreading -- pass icon props to the legacy component
|
|
108
|
-
React.createElement(IconLoadable, props);
|
|
109
|
-
};
|
|
110
|
-
Icon.preload = function () {
|
|
111
|
-
return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? IconLazy.preload() : IconLoadable.preload();
|
|
112
|
-
};
|
|
113
|
-
iconRef.current = Icon;
|
|
114
94
|
}
|
|
115
95
|
var dropdownItem = convertExtensionToDropdownMenuItem({
|
|
116
96
|
item: item,
|
package/dist/esm/icons/index.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
// Disable no-re-export rule for entry point files
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
|
-
import React from 'react';
|
|
5
4
|
import Loadable from 'react-loadable';
|
|
6
|
-
// oxlint-disable-next-line @atlassian/no-restricted-imports
|
|
7
|
-
import { lazy, LazySuspense } from 'react-loosely-lazy';
|
|
8
|
-
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
9
5
|
export { PanelInfoIcon } from './shared/PanelInfoIcon';
|
|
10
6
|
export { PanelWarningIcon } from './shared/PanelWarningIcon';
|
|
11
7
|
export { PanelErrorIcon } from './shared/PanelErrorIcon';
|
|
@@ -14,31 +10,13 @@ export { PanelNoteIcon } from './shared/PanelNoteIcon';
|
|
|
14
10
|
export { BorderIcon } from './shared/BorderIcon';
|
|
15
11
|
export { SteppedRainbowIconDecoration, rainbow, disabledRainbow } from './shared/SteppedRainbowIconDecoration';
|
|
16
12
|
export { DynamicStrokeIconDecoration } from './shared/DynamicStrokeIconDecoration';
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
return module
|
|
20
|
-
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
return import( /* webpackChunkName: "@atlaskit-internal_editor-icon-table" */'../icons/shared/table').then(function (module) {
|
|
24
|
-
return module.default;
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
IconTableLazy.displayName = 'lazy(IconTable)';
|
|
28
|
-
var IconTableLoadable = Loadable({
|
|
29
|
-
loader: loadIconTable,
|
|
13
|
+
export var IconTable = Loadable({
|
|
14
|
+
loader: function loader() {
|
|
15
|
+
return import( /* webpackChunkName: "@atlaskit-internal_editor-icon-table" */'../icons/shared/table').then(function (module) {
|
|
16
|
+
return module.default;
|
|
17
|
+
});
|
|
18
|
+
},
|
|
30
19
|
loading: function loading() {
|
|
31
20
|
return null;
|
|
32
21
|
}
|
|
33
|
-
});
|
|
34
|
-
export var IconTable = function IconTable(props) {
|
|
35
|
-
return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? /*#__PURE__*/React.createElement(LazySuspense, {
|
|
36
|
-
fallback: null
|
|
37
|
-
}, /*#__PURE__*/React.createElement(IconTableLazy, props)) :
|
|
38
|
-
/*#__PURE__*/
|
|
39
|
-
// eslint-disable-next-line react/jsx-props-no-spreading -- pass icon props to the legacy component
|
|
40
|
-
React.createElement(IconTableLoadable, props);
|
|
41
|
-
};
|
|
42
|
-
IconTable.preload = function () {
|
|
43
|
-
return isExperimentEnabled('platform_editor_loosely_lazy_migration') ? IconTableLazy.preload() : IconTableLoadable.preload();
|
|
44
|
-
};
|
|
22
|
+
});
|
|
@@ -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 = "125.2.
|
|
22
|
+
var packageVersion = "125.2.1";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|