@atlaskit/editor-common 94.14.0 → 94.14.2
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 +15 -0
- package/dist/cjs/extensibility/ExtensionComponent.js +1 -1
- package/dist/cjs/link/LinkSearch/index.js +2 -2
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/portal/common.js +76 -0
- package/dist/cjs/portal/usePortalProvider.js +4 -74
- package/dist/cjs/provider-factory/with-providers.js +2 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/Layer/index.js +2 -2
- package/dist/cjs/ui/Mention/index.js +1 -1
- package/dist/cjs/ui/Mention/mention-with-providers.js +1 -1
- package/dist/cjs/ui/Popup/index.js +2 -2
- package/dist/cjs/utils/imageLoader.js +1 -1
- package/dist/cjs/utils/withFeatureFlaggedComponent.js +1 -1
- package/dist/cjs/with-plugin-state/index.js +1 -1
- package/dist/es2019/extensibility/ExtensionComponent.js +1 -1
- package/dist/es2019/link/LinkSearch/index.js +2 -2
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/portal/common.js +57 -0
- package/dist/es2019/portal/usePortalProvider.js +2 -58
- package/dist/es2019/provider-factory/with-providers.js +2 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/Layer/index.js +2 -2
- package/dist/es2019/ui/Mention/index.js +1 -1
- package/dist/es2019/ui/Mention/mention-with-providers.js +1 -1
- package/dist/es2019/ui/Popup/index.js +2 -2
- package/dist/es2019/utils/imageLoader.js +1 -1
- package/dist/es2019/utils/withFeatureFlaggedComponent.js +1 -1
- package/dist/es2019/with-plugin-state/index.js +1 -1
- package/dist/esm/extensibility/ExtensionComponent.js +1 -1
- package/dist/esm/link/LinkSearch/index.js +2 -2
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/portal/common.js +65 -0
- package/dist/esm/portal/usePortalProvider.js +2 -66
- package/dist/esm/provider-factory/with-providers.js +2 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/Layer/index.js +2 -2
- package/dist/esm/ui/Mention/index.js +1 -1
- package/dist/esm/ui/Mention/mention-with-providers.js +1 -1
- package/dist/esm/ui/Popup/index.js +2 -2
- package/dist/esm/utils/imageLoader.js +1 -1
- package/dist/esm/utils/withFeatureFlaggedComponent.js +1 -1
- package/dist/esm/with-plugin-state/index.js +1 -1
- package/dist/types/portal/common.d.ts +33 -0
- package/dist/types/portal/index.d.ts +1 -1
- package/dist/types/portal/usePortalProvider.d.ts +1 -33
- package/dist/types/types/plugin-factory.d.ts +1 -0
- package/dist/types/utils/withFeatureFlaggedComponent.d.ts +1 -1
- package/dist/types-ts4.5/portal/common.d.ts +36 -0
- package/dist/types-ts4.5/portal/index.d.ts +1 -1
- package/dist/types-ts4.5/portal/usePortalProvider.d.ts +1 -36
- package/dist/types-ts4.5/types/plugin-factory.d.ts +1 -0
- package/dist/types-ts4.5/utils/withFeatureFlaggedComponent.d.ts +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 94.14.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#160699](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/160699)
|
|
8
|
+
[`3f6d3eca921ed`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f6d3eca921ed) -
|
|
9
|
+
ED-25575: migrate panel plugin node rendering to portals
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 94.14.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 94.14.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
|
@@ -524,7 +524,7 @@ var ExtensionComponentInner = /*#__PURE__*/function (_Component2) {
|
|
|
524
524
|
return ExtensionComponentInner;
|
|
525
525
|
}(_react.Component);
|
|
526
526
|
var ExtensionComponent = exports.ExtensionComponent = function ExtensionComponent(props) {
|
|
527
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
527
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_extension_component_v2')) {
|
|
528
528
|
return /*#__PURE__*/_react.default.createElement(ExtensionComponentNew, props);
|
|
529
529
|
}
|
|
530
530
|
return /*#__PURE__*/_react.default.createElement(ExtensionComponentOld, props);
|
|
@@ -203,7 +203,7 @@ var RecentLink = /*#__PURE__*/function (_React$Component) {
|
|
|
203
203
|
(0, _createClass2.default)(RecentLink, [{
|
|
204
204
|
key: "UNSAFE_componentWillReceiveProps",
|
|
205
205
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
206
|
-
if (!(0, _platformFeatureFlags.fg)('
|
|
206
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
207
207
|
if (this.props.defaultUrl !== nextProps.defaultUrl) {
|
|
208
208
|
this.setState(function (state) {
|
|
209
209
|
if (state.url !== nextProps.defaultUrl) {
|
|
@@ -222,7 +222,7 @@ var RecentLink = /*#__PURE__*/function (_React$Component) {
|
|
|
222
222
|
key: "componentDidUpdate",
|
|
223
223
|
value: function componentDidUpdate(prevProps) {
|
|
224
224
|
var _this2 = this;
|
|
225
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
225
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
226
226
|
if (prevProps.defaultUrl !== this.props.defaultUrl) {
|
|
227
227
|
this.setState(function (state) {
|
|
228
228
|
if (state.url !== _this2.props.defaultUrl) {
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "94.14.
|
|
20
|
+
var packageVersion = "94.14.2";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.createPortalRendererComponent = createPortalRendererComponent;
|
|
9
|
+
exports.getPortalProviderAPI = void 0;
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _reactDom = require("react-dom");
|
|
13
|
+
var _PortalBucket = require("./PortalBucket");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function createPortalRendererComponent(portalManager) {
|
|
17
|
+
return function PortalRenderer() {
|
|
18
|
+
var _useState = (0, _react.useState)(portalManager.getBuckets()),
|
|
19
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
20
|
+
buckets = _useState2[0],
|
|
21
|
+
setBuckets = _useState2[1];
|
|
22
|
+
(0, _react.useLayoutEffect)(function () {
|
|
23
|
+
portalManager.registerPortalRenderer(setBuckets);
|
|
24
|
+
return function () {
|
|
25
|
+
portalManager.unregisterPortalRenderer();
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
var portalsElements = (0, _react.useMemo)(function () {
|
|
29
|
+
return buckets.map(function (_, i) {
|
|
30
|
+
return /*#__PURE__*/_react.default.createElement(_PortalBucket.PortalBucket, {
|
|
31
|
+
key: i,
|
|
32
|
+
id: i,
|
|
33
|
+
portalManager: portalManager
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
}, [buckets]);
|
|
37
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, portalsElements);
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Creates a portal provider for managing multiple React portals. The provider
|
|
43
|
+
* facilitates rendering, removing, and destroying portals managed by a given
|
|
44
|
+
* PortalManager.
|
|
45
|
+
*
|
|
46
|
+
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
47
|
+
* is responsible for registering, managing, and destroying portals.
|
|
48
|
+
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
49
|
+
* portals.
|
|
50
|
+
* - `render(children, container, key)` Renders a new React portal with the given
|
|
51
|
+
* children, mounts it into the specified DOM container, and registers it
|
|
52
|
+
* with the PortalManager using a unique key.
|
|
53
|
+
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
54
|
+
* and deregisters it from the PortalManager.
|
|
55
|
+
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
56
|
+
* destroy method on the PortalManager to clean up any resources.
|
|
57
|
+
*
|
|
58
|
+
*/
|
|
59
|
+
var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
|
|
60
|
+
var portalsMap = new Map();
|
|
61
|
+
return {
|
|
62
|
+
render: function render(children, container, key) {
|
|
63
|
+
var portal = /*#__PURE__*/(0, _reactDom.createPortal)(children(), container, key);
|
|
64
|
+
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
65
|
+
},
|
|
66
|
+
remove: function remove(key) {
|
|
67
|
+
var _portalsMap$get;
|
|
68
|
+
(_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
|
|
69
|
+
portalsMap.delete(key);
|
|
70
|
+
},
|
|
71
|
+
destroy: function destroy() {
|
|
72
|
+
portalsMap.clear();
|
|
73
|
+
portalManager.destroy();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
};
|
|
@@ -1,82 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
|
-
exports.createPortalRendererComponent = createPortalRendererComponent;
|
|
9
|
-
exports.getPortalProviderAPI = void 0;
|
|
10
6
|
exports.usePortalProvider = usePortalProvider;
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var _reactDom = require("react-dom");
|
|
14
|
-
var _PortalBucket = require("./PortalBucket");
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _common = require("./common");
|
|
15
9
|
var _PortalManager = require("./PortalManager");
|
|
16
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
17
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
-
function createPortalRendererComponent(portalManager) {
|
|
19
|
-
return function PortalRenderer() {
|
|
20
|
-
var _useState = (0, _react.useState)(portalManager.getBuckets()),
|
|
21
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
22
|
-
buckets = _useState2[0],
|
|
23
|
-
setBuckets = _useState2[1];
|
|
24
|
-
(0, _react.useLayoutEffect)(function () {
|
|
25
|
-
portalManager.registerPortalRenderer(setBuckets);
|
|
26
|
-
return function () {
|
|
27
|
-
portalManager.unregisterPortalRenderer();
|
|
28
|
-
};
|
|
29
|
-
}, []);
|
|
30
|
-
var portalsElements = (0, _react.useMemo)(function () {
|
|
31
|
-
return buckets.map(function (_, i) {
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(_PortalBucket.PortalBucket, {
|
|
33
|
-
key: i,
|
|
34
|
-
id: i,
|
|
35
|
-
portalManager: portalManager
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
}, [buckets]);
|
|
39
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, portalsElements);
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Creates a portal provider for managing multiple React portals. The provider
|
|
45
|
-
* facilitates rendering, removing, and destroying portals managed by a given
|
|
46
|
-
* PortalManager.
|
|
47
|
-
*
|
|
48
|
-
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
49
|
-
* is responsible for registering, managing, and destroying portals.
|
|
50
|
-
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
51
|
-
* portals.
|
|
52
|
-
* - `render(children, container, key)` Renders a new React portal with the given
|
|
53
|
-
* children, mounts it into the specified DOM container, and registers it
|
|
54
|
-
* with the PortalManager using a unique key.
|
|
55
|
-
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
56
|
-
* and deregisters it from the PortalManager.
|
|
57
|
-
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
58
|
-
* destroy method on the PortalManager to clean up any resources.
|
|
59
|
-
*
|
|
60
|
-
*/
|
|
61
|
-
var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
|
|
62
|
-
var portalsMap = new Map();
|
|
63
|
-
return {
|
|
64
|
-
render: function render(children, container, key) {
|
|
65
|
-
var portal = /*#__PURE__*/(0, _reactDom.createPortal)(children(), container, key);
|
|
66
|
-
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
67
|
-
},
|
|
68
|
-
remove: function remove(key) {
|
|
69
|
-
var _portalsMap$get;
|
|
70
|
-
(_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
|
|
71
|
-
portalsMap.delete(key);
|
|
72
|
-
},
|
|
73
|
-
destroy: function destroy() {
|
|
74
|
-
portalsMap.clear();
|
|
75
|
-
portalManager.destroy();
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
};
|
|
79
|
-
|
|
80
10
|
/**
|
|
81
11
|
* Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
|
|
82
12
|
* @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
|
|
@@ -88,10 +18,10 @@ function usePortalProvider() {
|
|
|
88
18
|
return new _PortalManager.PortalManager();
|
|
89
19
|
}, []);
|
|
90
20
|
var PortalRenderer = (0, _react.useMemo)(function () {
|
|
91
|
-
return createPortalRendererComponent(portalManager);
|
|
21
|
+
return (0, _common.createPortalRendererComponent)(portalManager);
|
|
92
22
|
}, [portalManager]);
|
|
93
23
|
var portalProviderAPI = (0, _react.useMemo)(function () {
|
|
94
|
-
return getPortalProviderAPI(portalManager);
|
|
24
|
+
return (0, _common.getPortalProviderAPI)(portalManager);
|
|
95
25
|
}, [portalManager]);
|
|
96
26
|
|
|
97
27
|
// Cleanup on unmount
|
|
@@ -43,7 +43,7 @@ var WithProviders = exports.WithProviders = /*#__PURE__*/function (_PureComponen
|
|
|
43
43
|
_this.mounted = false;
|
|
44
44
|
var _providers = {};
|
|
45
45
|
_this.props.providers.forEach(function (name) {
|
|
46
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
46
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
47
47
|
var providerPromise = props.providerFactory.subscribe(name, _this.handleProviderIfMounted);
|
|
48
48
|
_providers[name] = providerPromise;
|
|
49
49
|
} else {
|
|
@@ -64,7 +64,7 @@ var WithProviders = exports.WithProviders = /*#__PURE__*/function (_PureComponen
|
|
|
64
64
|
key: "UNSAFE_componentWillMount",
|
|
65
65
|
value: function UNSAFE_componentWillMount() {
|
|
66
66
|
var _this2 = this;
|
|
67
|
-
if (!(0, _platformFeatureFlags.fg)('
|
|
67
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
68
68
|
var _this$props = this.props,
|
|
69
69
|
providers = _this$props.providers,
|
|
70
70
|
providerFactory = _this$props.providerFactory;
|
|
@@ -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 = "94.14.
|
|
27
|
+
var packageVersion = "94.14.2";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -79,7 +79,7 @@ var Layer = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
79
79
|
}, {
|
|
80
80
|
key: "UNSAFE_componentWillReceiveProps",
|
|
81
81
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
82
|
-
if (!(0, _platformFeatureFlags.fg)('
|
|
82
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
83
83
|
this.applyPopper(nextProps);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
@@ -88,7 +88,7 @@ var Layer = exports.default = /*#__PURE__*/function (_Component) {
|
|
|
88
88
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
89
89
|
var onPositioned = this.props.onPositioned;
|
|
90
90
|
var hasExtractedStyles = this.state.hasExtractedStyles;
|
|
91
|
-
if (this.props !== prevProps && (0, _platformFeatureFlags.fg)('
|
|
91
|
+
if (this.props !== prevProps && (0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
92
92
|
this.applyPopper(this.props);
|
|
93
93
|
}
|
|
94
94
|
|
|
@@ -37,7 +37,7 @@ var Mention = exports.default = /*#__PURE__*/function (_PureComponent) {
|
|
|
37
37
|
localId = _this$props.localId;
|
|
38
38
|
var mentionProvider = providers.mentionProvider,
|
|
39
39
|
profilecardProvider = providers.profilecardProvider;
|
|
40
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
40
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_mention_with_provider_fix')) {
|
|
41
41
|
return /*#__PURE__*/_react.default.createElement(_mentionWithProviders.MentionWithProviders, {
|
|
42
42
|
id: id,
|
|
43
43
|
text: text,
|
|
@@ -58,7 +58,7 @@ var MentionWithProviders = exports.MentionWithProviders = function MentionWithPr
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
}, [profilecardProviderResolver]);
|
|
61
|
-
var MentionComponent = profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? _mentionWithProfilecard.default : _element.ResourcedMention;
|
|
61
|
+
var MentionComponent = profilecardProvider && profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? _mentionWithProfilecard.default : _element.ResourcedMention;
|
|
62
62
|
return /*#__PURE__*/_react.default.createElement(MentionComponent, {
|
|
63
63
|
id: id,
|
|
64
64
|
text: text,
|
|
@@ -208,7 +208,7 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
208
208
|
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
209
209
|
// We are delaying `updatePosition` otherwise it happens before the children
|
|
210
210
|
// get rendered and we end up with a wrong position
|
|
211
|
-
if (!(0, _platformFeatureFlags.fg)('
|
|
211
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
212
212
|
this.scheduledUpdatePosition(newProps);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
@@ -251,7 +251,7 @@ var Popup = exports.default = /*#__PURE__*/function (_React$Component) {
|
|
|
251
251
|
key: "componentDidUpdate",
|
|
252
252
|
value: function componentDidUpdate(prevProps) {
|
|
253
253
|
this.handleChangedFocusTrapProp(prevProps);
|
|
254
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
254
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
255
255
|
if (this.props !== prevProps) {
|
|
256
256
|
this.scheduledUpdatePosition(prevProps);
|
|
257
257
|
}
|
|
@@ -185,7 +185,7 @@ var withImageLoaderNew = function withImageLoaderNew(Wrapped) {
|
|
|
185
185
|
}(_react.Component);
|
|
186
186
|
};
|
|
187
187
|
var withImageLoader = exports.withImageLoader = function withImageLoader(Wrapped) {
|
|
188
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
188
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
189
189
|
return withImageLoaderNew(Wrapped);
|
|
190
190
|
}
|
|
191
191
|
return withImageLoaderOld(Wrapped);
|
|
@@ -10,7 +10,7 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
10
10
|
* This function is used to switch between two components based on a feature flag
|
|
11
11
|
* @param ComponentOld
|
|
12
12
|
* @param ComponentNext
|
|
13
|
-
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('
|
|
13
|
+
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('platform_editor_react18_phase2_v2')
|
|
14
14
|
* @returns
|
|
15
15
|
*/
|
|
16
16
|
var withFeatureFlaggedComponent = exports.withFeatureFlaggedComponent = function withFeatureFlaggedComponent(ComponentOld, ComponentNext, featureFlagFn) {
|
|
@@ -78,7 +78,7 @@ var WithPluginState = exports.WithPluginState = /*#__PURE__*/function (_React$Co
|
|
|
78
78
|
(0, _createClass2.default)(WithPluginState, [{
|
|
79
79
|
key: "render",
|
|
80
80
|
value: function render() {
|
|
81
|
-
if ((0, _platformFeatureFlags.fg)('
|
|
81
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_react18_phase2_v2')) {
|
|
82
82
|
return /*#__PURE__*/_react.default.createElement(WithPluginStateNew, this.props);
|
|
83
83
|
}
|
|
84
84
|
return /*#__PURE__*/_react.default.createElement(WithPluginStateOld, this.props);
|
|
@@ -452,7 +452,7 @@ class ExtensionComponentInner extends Component {
|
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
454
|
export const ExtensionComponent = props => {
|
|
455
|
-
if (fg('
|
|
455
|
+
if (fg('platform_editor_react18_extension_component_v2')) {
|
|
456
456
|
return /*#__PURE__*/React.createElement(ExtensionComponentNew, props);
|
|
457
457
|
}
|
|
458
458
|
return /*#__PURE__*/React.createElement(ExtensionComponentOld, props);
|
|
@@ -140,7 +140,7 @@ class RecentLink extends React.Component {
|
|
|
140
140
|
};
|
|
141
141
|
}
|
|
142
142
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
143
|
-
if (!fg('
|
|
143
|
+
if (!fg('platform_editor_react18_phase2_v2')) {
|
|
144
144
|
if (this.props.defaultUrl !== nextProps.defaultUrl) {
|
|
145
145
|
this.setState(state => {
|
|
146
146
|
if (state.url !== nextProps.defaultUrl) {
|
|
@@ -156,7 +156,7 @@ class RecentLink extends React.Component {
|
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
componentDidUpdate(prevProps) {
|
|
159
|
-
if (fg('
|
|
159
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
160
160
|
if (prevProps.defaultUrl !== this.props.defaultUrl) {
|
|
161
161
|
this.setState(state => {
|
|
162
162
|
if (state.url !== this.props.defaultUrl) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "94.14.
|
|
4
|
+
const packageVersion = "94.14.2";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import React, { useLayoutEffect, useMemo, useState } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import { PortalBucket } from './PortalBucket';
|
|
4
|
+
export function createPortalRendererComponent(portalManager) {
|
|
5
|
+
return function PortalRenderer() {
|
|
6
|
+
const [buckets, setBuckets] = useState(portalManager.getBuckets());
|
|
7
|
+
useLayoutEffect(() => {
|
|
8
|
+
portalManager.registerPortalRenderer(setBuckets);
|
|
9
|
+
return () => {
|
|
10
|
+
portalManager.unregisterPortalRenderer();
|
|
11
|
+
};
|
|
12
|
+
}, []);
|
|
13
|
+
const portalsElements = useMemo(() => buckets.map((_, i) => /*#__PURE__*/React.createElement(PortalBucket, {
|
|
14
|
+
key: i,
|
|
15
|
+
id: i,
|
|
16
|
+
portalManager: portalManager
|
|
17
|
+
})), [buckets]);
|
|
18
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, portalsElements);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates a portal provider for managing multiple React portals. The provider
|
|
24
|
+
* facilitates rendering, removing, and destroying portals managed by a given
|
|
25
|
+
* PortalManager.
|
|
26
|
+
*
|
|
27
|
+
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
28
|
+
* is responsible for registering, managing, and destroying portals.
|
|
29
|
+
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
30
|
+
* portals.
|
|
31
|
+
* - `render(children, container, key)` Renders a new React portal with the given
|
|
32
|
+
* children, mounts it into the specified DOM container, and registers it
|
|
33
|
+
* with the PortalManager using a unique key.
|
|
34
|
+
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
35
|
+
* and deregisters it from the PortalManager.
|
|
36
|
+
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
37
|
+
* destroy method on the PortalManager to clean up any resources.
|
|
38
|
+
*
|
|
39
|
+
*/
|
|
40
|
+
export const getPortalProviderAPI = portalManager => {
|
|
41
|
+
const portalsMap = new Map();
|
|
42
|
+
return {
|
|
43
|
+
render: (children, container, key) => {
|
|
44
|
+
const portal = /*#__PURE__*/createPortal(children(), container, key);
|
|
45
|
+
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
46
|
+
},
|
|
47
|
+
remove: key => {
|
|
48
|
+
var _portalsMap$get;
|
|
49
|
+
(_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 ? void 0 : _portalsMap$get();
|
|
50
|
+
portalsMap.delete(key);
|
|
51
|
+
},
|
|
52
|
+
destroy: () => {
|
|
53
|
+
portalsMap.clear();
|
|
54
|
+
portalManager.destroy();
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -1,62 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import { PortalBucket } from './PortalBucket';
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { createPortalRendererComponent, getPortalProviderAPI } from './common';
|
|
4
3
|
import { PortalManager } from './PortalManager';
|
|
5
|
-
export function createPortalRendererComponent(portalManager) {
|
|
6
|
-
return function PortalRenderer() {
|
|
7
|
-
const [buckets, setBuckets] = useState(portalManager.getBuckets());
|
|
8
|
-
useLayoutEffect(() => {
|
|
9
|
-
portalManager.registerPortalRenderer(setBuckets);
|
|
10
|
-
return () => {
|
|
11
|
-
portalManager.unregisterPortalRenderer();
|
|
12
|
-
};
|
|
13
|
-
}, []);
|
|
14
|
-
const portalsElements = useMemo(() => buckets.map((_, i) => /*#__PURE__*/React.createElement(PortalBucket, {
|
|
15
|
-
key: i,
|
|
16
|
-
id: i,
|
|
17
|
-
portalManager: portalManager
|
|
18
|
-
})), [buckets]);
|
|
19
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, portalsElements);
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Creates a portal provider for managing multiple React portals. The provider
|
|
25
|
-
* facilitates rendering, removing, and destroying portals managed by a given
|
|
26
|
-
* PortalManager.
|
|
27
|
-
*
|
|
28
|
-
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
29
|
-
* is responsible for registering, managing, and destroying portals.
|
|
30
|
-
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
31
|
-
* portals.
|
|
32
|
-
* - `render(children, container, key)` Renders a new React portal with the given
|
|
33
|
-
* children, mounts it into the specified DOM container, and registers it
|
|
34
|
-
* with the PortalManager using a unique key.
|
|
35
|
-
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
36
|
-
* and deregisters it from the PortalManager.
|
|
37
|
-
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
38
|
-
* destroy method on the PortalManager to clean up any resources.
|
|
39
|
-
*
|
|
40
|
-
*/
|
|
41
|
-
export const getPortalProviderAPI = portalManager => {
|
|
42
|
-
const portalsMap = new Map();
|
|
43
|
-
return {
|
|
44
|
-
render: (children, container, key) => {
|
|
45
|
-
const portal = /*#__PURE__*/createPortal(children(), container, key);
|
|
46
|
-
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
47
|
-
},
|
|
48
|
-
remove: key => {
|
|
49
|
-
var _portalsMap$get;
|
|
50
|
-
(_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 ? void 0 : _portalsMap$get();
|
|
51
|
-
portalsMap.delete(key);
|
|
52
|
-
},
|
|
53
|
-
destroy: () => {
|
|
54
|
-
portalsMap.clear();
|
|
55
|
-
portalManager.destroy();
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
|
|
60
4
|
/**
|
|
61
5
|
* Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
|
|
62
6
|
* @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
|
|
@@ -27,7 +27,7 @@ export class WithProviders extends PureComponent {
|
|
|
27
27
|
this.mounted = false;
|
|
28
28
|
const _providers = {};
|
|
29
29
|
this.props.providers.forEach(name => {
|
|
30
|
-
if (fg('
|
|
30
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
31
31
|
const providerPromise = props.providerFactory.subscribe(name, this.handleProviderIfMounted);
|
|
32
32
|
_providers[name] = providerPromise;
|
|
33
33
|
} else {
|
|
@@ -42,7 +42,7 @@ export class WithProviders extends PureComponent {
|
|
|
42
42
|
this.mounted = true;
|
|
43
43
|
}
|
|
44
44
|
UNSAFE_componentWillMount() {
|
|
45
|
-
if (!fg('
|
|
45
|
+
if (!fg('platform_editor_react18_phase2_v2')) {
|
|
46
46
|
const {
|
|
47
47
|
providers,
|
|
48
48
|
providerFactory
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "94.14.
|
|
16
|
+
const packageVersion = "94.14.2";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
class DropList extends Component {
|
|
@@ -50,7 +50,7 @@ export default class Layer extends Component {
|
|
|
50
50
|
this.applyPopper(this.props);
|
|
51
51
|
}
|
|
52
52
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
53
|
-
if (!fg('
|
|
53
|
+
if (!fg('platform_editor_react18_phase2_v2')) {
|
|
54
54
|
this.applyPopper(nextProps);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
@@ -61,7 +61,7 @@ export default class Layer extends Component {
|
|
|
61
61
|
const {
|
|
62
62
|
hasExtractedStyles
|
|
63
63
|
} = this.state;
|
|
64
|
-
if (this.props !== prevProps && fg('
|
|
64
|
+
if (this.props !== prevProps && fg('platform_editor_react18_phase2_v2')) {
|
|
65
65
|
this.applyPopper(this.props);
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -19,7 +19,7 @@ export default class Mention extends PureComponent {
|
|
|
19
19
|
mentionProvider,
|
|
20
20
|
profilecardProvider
|
|
21
21
|
} = providers;
|
|
22
|
-
if (fg('
|
|
22
|
+
if (fg('platform_editor_react18_mention_with_provider_fix')) {
|
|
23
23
|
return /*#__PURE__*/React.createElement(MentionWithProviders, {
|
|
24
24
|
id: id,
|
|
25
25
|
text: text,
|
|
@@ -37,7 +37,7 @@ export const MentionWithProviders = ({
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
}, [profilecardProviderResolver]);
|
|
40
|
-
const MentionComponent = profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? ResourcedMentionWithProfilecard : ResourcedMention;
|
|
40
|
+
const MentionComponent = profilecardProvider && profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? ResourcedMentionWithProfilecard : ResourcedMention;
|
|
41
41
|
return /*#__PURE__*/React.createElement(MentionComponent, {
|
|
42
42
|
id: id,
|
|
43
43
|
text: text,
|
|
@@ -168,7 +168,7 @@ export default class Popup extends React.Component {
|
|
|
168
168
|
UNSAFE_componentWillReceiveProps(newProps) {
|
|
169
169
|
// We are delaying `updatePosition` otherwise it happens before the children
|
|
170
170
|
// get rendered and we end up with a wrong position
|
|
171
|
-
if (!fg('
|
|
171
|
+
if (!fg('platform_editor_react18_phase2_v2')) {
|
|
172
172
|
this.scheduledUpdatePosition(newProps);
|
|
173
173
|
}
|
|
174
174
|
}
|
|
@@ -204,7 +204,7 @@ export default class Popup extends React.Component {
|
|
|
204
204
|
}
|
|
205
205
|
componentDidUpdate(prevProps) {
|
|
206
206
|
this.handleChangedFocusTrapProp(prevProps);
|
|
207
|
-
if (fg('
|
|
207
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
208
208
|
if (this.props !== prevProps) {
|
|
209
209
|
this.scheduledUpdatePosition(prevProps);
|
|
210
210
|
}
|
|
@@ -133,7 +133,7 @@ const withImageLoaderNew = Wrapped => class WithImageLoader extends Component {
|
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
export const withImageLoader = Wrapped => {
|
|
136
|
-
if (fg('
|
|
136
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
137
137
|
return withImageLoaderNew(Wrapped);
|
|
138
138
|
}
|
|
139
139
|
return withImageLoaderOld(Wrapped);
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
* This function is used to switch between two components based on a feature flag
|
|
5
5
|
* @param ComponentOld
|
|
6
6
|
* @param ComponentNext
|
|
7
|
-
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('
|
|
7
|
+
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('platform_editor_react18_phase2_v2')
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
export const withFeatureFlaggedComponent = (ComponentOld, ComponentNext, featureFlagFn) => {
|
|
@@ -57,7 +57,7 @@ class WithPluginState extends React.Component {
|
|
|
57
57
|
super(props);
|
|
58
58
|
}
|
|
59
59
|
render() {
|
|
60
|
-
if (fg('
|
|
60
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
61
61
|
return /*#__PURE__*/React.createElement(WithPluginStateNew, this.props);
|
|
62
62
|
}
|
|
63
63
|
return /*#__PURE__*/React.createElement(WithPluginStateOld, this.props);
|
|
@@ -518,7 +518,7 @@ var ExtensionComponentInner = /*#__PURE__*/function (_Component2) {
|
|
|
518
518
|
return ExtensionComponentInner;
|
|
519
519
|
}(Component);
|
|
520
520
|
export var ExtensionComponent = function ExtensionComponent(props) {
|
|
521
|
-
if (fg('
|
|
521
|
+
if (fg('platform_editor_react18_extension_component_v2')) {
|
|
522
522
|
return /*#__PURE__*/React.createElement(ExtensionComponentNew, props);
|
|
523
523
|
}
|
|
524
524
|
return /*#__PURE__*/React.createElement(ExtensionComponentOld, props);
|
|
@@ -196,7 +196,7 @@ var RecentLink = /*#__PURE__*/function (_React$Component) {
|
|
|
196
196
|
_createClass(RecentLink, [{
|
|
197
197
|
key: "UNSAFE_componentWillReceiveProps",
|
|
198
198
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
199
|
-
if (!fg('
|
|
199
|
+
if (!fg('platform_editor_react18_phase2_v2')) {
|
|
200
200
|
if (this.props.defaultUrl !== nextProps.defaultUrl) {
|
|
201
201
|
this.setState(function (state) {
|
|
202
202
|
if (state.url !== nextProps.defaultUrl) {
|
|
@@ -215,7 +215,7 @@ var RecentLink = /*#__PURE__*/function (_React$Component) {
|
|
|
215
215
|
key: "componentDidUpdate",
|
|
216
216
|
value: function componentDidUpdate(prevProps) {
|
|
217
217
|
var _this2 = this;
|
|
218
|
-
if (fg('
|
|
218
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
219
219
|
if (prevProps.defaultUrl !== this.props.defaultUrl) {
|
|
220
220
|
this.setState(function (state) {
|
|
221
221
|
if (state.url !== _this2.props.defaultUrl) {
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "94.14.
|
|
10
|
+
var packageVersion = "94.14.2";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import React, { useLayoutEffect, useMemo, useState } from 'react';
|
|
3
|
+
import { createPortal } from 'react-dom';
|
|
4
|
+
import { PortalBucket } from './PortalBucket';
|
|
5
|
+
export function createPortalRendererComponent(portalManager) {
|
|
6
|
+
return function PortalRenderer() {
|
|
7
|
+
var _useState = useState(portalManager.getBuckets()),
|
|
8
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
9
|
+
buckets = _useState2[0],
|
|
10
|
+
setBuckets = _useState2[1];
|
|
11
|
+
useLayoutEffect(function () {
|
|
12
|
+
portalManager.registerPortalRenderer(setBuckets);
|
|
13
|
+
return function () {
|
|
14
|
+
portalManager.unregisterPortalRenderer();
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
var portalsElements = useMemo(function () {
|
|
18
|
+
return buckets.map(function (_, i) {
|
|
19
|
+
return /*#__PURE__*/React.createElement(PortalBucket, {
|
|
20
|
+
key: i,
|
|
21
|
+
id: i,
|
|
22
|
+
portalManager: portalManager
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}, [buckets]);
|
|
26
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, portalsElements);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Creates a portal provider for managing multiple React portals. The provider
|
|
32
|
+
* facilitates rendering, removing, and destroying portals managed by a given
|
|
33
|
+
* PortalManager.
|
|
34
|
+
*
|
|
35
|
+
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
36
|
+
* is responsible for registering, managing, and destroying portals.
|
|
37
|
+
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
38
|
+
* portals.
|
|
39
|
+
* - `render(children, container, key)` Renders a new React portal with the given
|
|
40
|
+
* children, mounts it into the specified DOM container, and registers it
|
|
41
|
+
* with the PortalManager using a unique key.
|
|
42
|
+
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
43
|
+
* and deregisters it from the PortalManager.
|
|
44
|
+
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
45
|
+
* destroy method on the PortalManager to clean up any resources.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
export var getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
|
|
49
|
+
var portalsMap = new Map();
|
|
50
|
+
return {
|
|
51
|
+
render: function render(children, container, key) {
|
|
52
|
+
var portal = /*#__PURE__*/createPortal(children(), container, key);
|
|
53
|
+
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
54
|
+
},
|
|
55
|
+
remove: function remove(key) {
|
|
56
|
+
var _portalsMap$get;
|
|
57
|
+
(_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
|
|
58
|
+
portalsMap.delete(key);
|
|
59
|
+
},
|
|
60
|
+
destroy: function destroy() {
|
|
61
|
+
portalsMap.clear();
|
|
62
|
+
portalManager.destroy();
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
@@ -1,70 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import { createPortal } from 'react-dom';
|
|
4
|
-
import { PortalBucket } from './PortalBucket';
|
|
1
|
+
import { useEffect, useMemo } from 'react';
|
|
2
|
+
import { createPortalRendererComponent, getPortalProviderAPI } from './common';
|
|
5
3
|
import { PortalManager } from './PortalManager';
|
|
6
|
-
export function createPortalRendererComponent(portalManager) {
|
|
7
|
-
return function PortalRenderer() {
|
|
8
|
-
var _useState = useState(portalManager.getBuckets()),
|
|
9
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
10
|
-
buckets = _useState2[0],
|
|
11
|
-
setBuckets = _useState2[1];
|
|
12
|
-
useLayoutEffect(function () {
|
|
13
|
-
portalManager.registerPortalRenderer(setBuckets);
|
|
14
|
-
return function () {
|
|
15
|
-
portalManager.unregisterPortalRenderer();
|
|
16
|
-
};
|
|
17
|
-
}, []);
|
|
18
|
-
var portalsElements = useMemo(function () {
|
|
19
|
-
return buckets.map(function (_, i) {
|
|
20
|
-
return /*#__PURE__*/React.createElement(PortalBucket, {
|
|
21
|
-
key: i,
|
|
22
|
-
id: i,
|
|
23
|
-
portalManager: portalManager
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
}, [buckets]);
|
|
27
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, portalsElements);
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates a portal provider for managing multiple React portals. The provider
|
|
33
|
-
* facilitates rendering, removing, and destroying portals managed by a given
|
|
34
|
-
* PortalManager.
|
|
35
|
-
*
|
|
36
|
-
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
37
|
-
* is responsible for registering, managing, and destroying portals.
|
|
38
|
-
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
39
|
-
* portals.
|
|
40
|
-
* - `render(children, container, key)` Renders a new React portal with the given
|
|
41
|
-
* children, mounts it into the specified DOM container, and registers it
|
|
42
|
-
* with the PortalManager using a unique key.
|
|
43
|
-
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
44
|
-
* and deregisters it from the PortalManager.
|
|
45
|
-
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
46
|
-
* destroy method on the PortalManager to clean up any resources.
|
|
47
|
-
*
|
|
48
|
-
*/
|
|
49
|
-
export var getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
|
|
50
|
-
var portalsMap = new Map();
|
|
51
|
-
return {
|
|
52
|
-
render: function render(children, container, key) {
|
|
53
|
-
var portal = /*#__PURE__*/createPortal(children(), container, key);
|
|
54
|
-
portalsMap.set(key, portalManager.registerPortal(key, portal));
|
|
55
|
-
},
|
|
56
|
-
remove: function remove(key) {
|
|
57
|
-
var _portalsMap$get;
|
|
58
|
-
(_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
|
|
59
|
-
portalsMap.delete(key);
|
|
60
|
-
},
|
|
61
|
-
destroy: function destroy() {
|
|
62
|
-
portalsMap.clear();
|
|
63
|
-
portalManager.destroy();
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
|
|
68
4
|
/**
|
|
69
5
|
* Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
|
|
70
6
|
* @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
|
|
@@ -37,7 +37,7 @@ export var WithProviders = /*#__PURE__*/function (_PureComponent) {
|
|
|
37
37
|
_this.mounted = false;
|
|
38
38
|
var _providers = {};
|
|
39
39
|
_this.props.providers.forEach(function (name) {
|
|
40
|
-
if (fg('
|
|
40
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
41
41
|
var providerPromise = props.providerFactory.subscribe(name, _this.handleProviderIfMounted);
|
|
42
42
|
_providers[name] = providerPromise;
|
|
43
43
|
} else {
|
|
@@ -58,7 +58,7 @@ export var WithProviders = /*#__PURE__*/function (_PureComponent) {
|
|
|
58
58
|
key: "UNSAFE_componentWillMount",
|
|
59
59
|
value: function UNSAFE_componentWillMount() {
|
|
60
60
|
var _this2 = this;
|
|
61
|
-
if (!fg('
|
|
61
|
+
if (!fg('platform_editor_react18_phase2_v2')) {
|
|
62
62
|
var _this$props = this.props,
|
|
63
63
|
providers = _this$props.providers,
|
|
64
64
|
providerFactory = _this$props.providerFactory;
|
|
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
21
21
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "94.14.
|
|
24
|
+
var packageVersion = "94.14.2";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -69,7 +69,7 @@ var Layer = /*#__PURE__*/function (_Component) {
|
|
|
69
69
|
}, {
|
|
70
70
|
key: "UNSAFE_componentWillReceiveProps",
|
|
71
71
|
value: function UNSAFE_componentWillReceiveProps(nextProps) {
|
|
72
|
-
if (!fg('
|
|
72
|
+
if (!fg('platform_editor_react18_phase2_v2')) {
|
|
73
73
|
this.applyPopper(nextProps);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -78,7 +78,7 @@ var Layer = /*#__PURE__*/function (_Component) {
|
|
|
78
78
|
value: function componentDidUpdate(prevProps, prevState) {
|
|
79
79
|
var onPositioned = this.props.onPositioned;
|
|
80
80
|
var hasExtractedStyles = this.state.hasExtractedStyles;
|
|
81
|
-
if (this.props !== prevProps && fg('
|
|
81
|
+
if (this.props !== prevProps && fg('platform_editor_react18_phase2_v2')) {
|
|
82
82
|
this.applyPopper(this.props);
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -28,7 +28,7 @@ var Mention = /*#__PURE__*/function (_PureComponent) {
|
|
|
28
28
|
localId = _this$props.localId;
|
|
29
29
|
var mentionProvider = providers.mentionProvider,
|
|
30
30
|
profilecardProvider = providers.profilecardProvider;
|
|
31
|
-
if (fg('
|
|
31
|
+
if (fg('platform_editor_react18_mention_with_provider_fix')) {
|
|
32
32
|
return /*#__PURE__*/React.createElement(MentionWithProviders, {
|
|
33
33
|
id: id,
|
|
34
34
|
text: text,
|
|
@@ -48,7 +48,7 @@ export var MentionWithProviders = function MentionWithProviders(_ref) {
|
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
}, [profilecardProviderResolver]);
|
|
51
|
-
var MentionComponent = profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? ResourcedMentionWithProfilecard : ResourcedMention;
|
|
51
|
+
var MentionComponent = profilecardProvider && profilecardProviderResolver && GENERIC_USER_IDS.indexOf(id) === -1 ? ResourcedMentionWithProfilecard : ResourcedMention;
|
|
52
52
|
return /*#__PURE__*/React.createElement(MentionComponent, {
|
|
53
53
|
id: id,
|
|
54
54
|
text: text,
|
|
@@ -195,7 +195,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
195
195
|
value: function UNSAFE_componentWillReceiveProps(newProps) {
|
|
196
196
|
// We are delaying `updatePosition` otherwise it happens before the children
|
|
197
197
|
// get rendered and we end up with a wrong position
|
|
198
|
-
if (!fg('
|
|
198
|
+
if (!fg('platform_editor_react18_phase2_v2')) {
|
|
199
199
|
this.scheduledUpdatePosition(newProps);
|
|
200
200
|
}
|
|
201
201
|
}
|
|
@@ -238,7 +238,7 @@ var Popup = /*#__PURE__*/function (_React$Component) {
|
|
|
238
238
|
key: "componentDidUpdate",
|
|
239
239
|
value: function componentDidUpdate(prevProps) {
|
|
240
240
|
this.handleChangedFocusTrapProp(prevProps);
|
|
241
|
-
if (fg('
|
|
241
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
242
242
|
if (this.props !== prevProps) {
|
|
243
243
|
this.scheduledUpdatePosition(prevProps);
|
|
244
244
|
}
|
|
@@ -175,7 +175,7 @@ var withImageLoaderNew = function withImageLoaderNew(Wrapped) {
|
|
|
175
175
|
}(Component);
|
|
176
176
|
};
|
|
177
177
|
export var withImageLoader = function withImageLoader(Wrapped) {
|
|
178
|
-
if (fg('
|
|
178
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
179
179
|
return withImageLoaderNew(Wrapped);
|
|
180
180
|
}
|
|
181
181
|
return withImageLoaderOld(Wrapped);
|
|
@@ -4,7 +4,7 @@ import React from 'react';
|
|
|
4
4
|
* This function is used to switch between two components based on a feature flag
|
|
5
5
|
* @param ComponentOld
|
|
6
6
|
* @param ComponentNext
|
|
7
|
-
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('
|
|
7
|
+
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('platform_editor_react18_phase2_v2')
|
|
8
8
|
* @returns
|
|
9
9
|
*/
|
|
10
10
|
export var withFeatureFlaggedComponent = function withFeatureFlaggedComponent(ComponentOld, ComponentNext, featureFlagFn) {
|
|
@@ -71,7 +71,7 @@ var WithPluginState = /*#__PURE__*/function (_React$Component) {
|
|
|
71
71
|
_createClass(WithPluginState, [{
|
|
72
72
|
key: "render",
|
|
73
73
|
value: function render() {
|
|
74
|
-
if (fg('
|
|
74
|
+
if (fg('platform_editor_react18_phase2_v2')) {
|
|
75
75
|
return /*#__PURE__*/React.createElement(WithPluginStateNew, this.props);
|
|
76
76
|
}
|
|
77
77
|
return /*#__PURE__*/React.createElement(WithPluginStateOld, this.props);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type PortalManager } from './PortalManager';
|
|
3
|
+
type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string) => void;
|
|
4
|
+
type RemoveFn = (key: string) => void;
|
|
5
|
+
type DestoryFn = () => void;
|
|
6
|
+
export interface PortalProviderAPI {
|
|
7
|
+
render: RenderFn;
|
|
8
|
+
remove: RemoveFn;
|
|
9
|
+
destroy: DestoryFn;
|
|
10
|
+
}
|
|
11
|
+
export type PortalRendererComponent = () => JSX.Element;
|
|
12
|
+
export type UsePortalProviderReturnType = [PortalProviderAPI, PortalRendererComponent];
|
|
13
|
+
export declare function createPortalRendererComponent(portalManager: PortalManager): () => JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* Creates a portal provider for managing multiple React portals. The provider
|
|
16
|
+
* facilitates rendering, removing, and destroying portals managed by a given
|
|
17
|
+
* PortalManager.
|
|
18
|
+
*
|
|
19
|
+
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
20
|
+
* is responsible for registering, managing, and destroying portals.
|
|
21
|
+
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
22
|
+
* portals.
|
|
23
|
+
* - `render(children, container, key)` Renders a new React portal with the given
|
|
24
|
+
* children, mounts it into the specified DOM container, and registers it
|
|
25
|
+
* with the PortalManager using a unique key.
|
|
26
|
+
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
27
|
+
* and deregisters it from the PortalManager.
|
|
28
|
+
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
29
|
+
* destroy method on the PortalManager to clean up any resources.
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
export declare const getPortalProviderAPI: (portalManager: PortalManager) => PortalProviderAPI;
|
|
33
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PortalManager } from './PortalManager';
|
|
2
2
|
export { PortalBucket } from './PortalBucket';
|
|
3
3
|
export { usePortalProvider } from './usePortalProvider';
|
|
4
|
-
export type { PortalProviderAPI } from './
|
|
4
|
+
export type { PortalProviderAPI } from './common';
|
|
@@ -1,35 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PortalManager } from './PortalManager';
|
|
3
|
-
type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string) => void;
|
|
4
|
-
type RemoveFn = (key: string) => void;
|
|
5
|
-
type DestoryFn = () => void;
|
|
6
|
-
export interface PortalProviderAPI {
|
|
7
|
-
render: RenderFn;
|
|
8
|
-
remove: RemoveFn;
|
|
9
|
-
destroy: DestoryFn;
|
|
10
|
-
}
|
|
11
|
-
type PortalRendererComponent = () => JSX.Element;
|
|
12
|
-
type UsePortalProviderReturnType = [PortalProviderAPI, PortalRendererComponent];
|
|
13
|
-
export declare function createPortalRendererComponent(portalManager: PortalManager): () => JSX.Element;
|
|
14
|
-
/**
|
|
15
|
-
* Creates a portal provider for managing multiple React portals. The provider
|
|
16
|
-
* facilitates rendering, removing, and destroying portals managed by a given
|
|
17
|
-
* PortalManager.
|
|
18
|
-
*
|
|
19
|
-
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
20
|
-
* is responsible for registering, managing, and destroying portals.
|
|
21
|
-
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
22
|
-
* portals.
|
|
23
|
-
* - `render(children, container, key)` Renders a new React portal with the given
|
|
24
|
-
* children, mounts it into the specified DOM container, and registers it
|
|
25
|
-
* with the PortalManager using a unique key.
|
|
26
|
-
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
27
|
-
* and deregisters it from the PortalManager.
|
|
28
|
-
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
29
|
-
* destroy method on the PortalManager to clean up any resources.
|
|
30
|
-
*
|
|
31
|
-
*/
|
|
32
|
-
export declare const getPortalProviderAPI: (portalManager: PortalManager) => PortalProviderAPI;
|
|
1
|
+
import { type UsePortalProviderReturnType } from './common';
|
|
33
2
|
/**
|
|
34
3
|
* Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
|
|
35
4
|
* @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
|
|
@@ -37,4 +6,3 @@ export declare const getPortalProviderAPI: (portalManager: PortalManager) => Por
|
|
|
37
6
|
* 2. PortalRenderer: A React component responsible for rendering the portal content.
|
|
38
7
|
*/
|
|
39
8
|
export declare function usePortalProvider(): UsePortalProviderReturnType;
|
|
40
|
-
export {};
|
|
@@ -14,6 +14,7 @@ export type PMPluginFactoryParams = {
|
|
|
14
14
|
providerFactory: ProviderFactory;
|
|
15
15
|
errorReporter?: ErrorReporter;
|
|
16
16
|
portalProviderAPI: PortalProviderAPI;
|
|
17
|
+
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
17
18
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
18
19
|
featureFlags: FeatureFlags;
|
|
19
20
|
getIntl: () => IntlShape;
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
* This function is used to switch between two components based on a feature flag
|
|
4
4
|
* @param ComponentOld
|
|
5
5
|
* @param ComponentNext
|
|
6
|
-
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('
|
|
6
|
+
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('platform_editor_react18_phase2_v2')
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
9
|
export declare const withFeatureFlaggedComponent: <P extends object>(ComponentOld: React.ComponentType<P>, ComponentNext: React.ComponentType<P>, featureFlagFn: () => boolean) => (props: P) => JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type PortalManager } from './PortalManager';
|
|
3
|
+
type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string) => void;
|
|
4
|
+
type RemoveFn = (key: string) => void;
|
|
5
|
+
type DestoryFn = () => void;
|
|
6
|
+
export interface PortalProviderAPI {
|
|
7
|
+
render: RenderFn;
|
|
8
|
+
remove: RemoveFn;
|
|
9
|
+
destroy: DestoryFn;
|
|
10
|
+
}
|
|
11
|
+
export type PortalRendererComponent = () => JSX.Element;
|
|
12
|
+
export type UsePortalProviderReturnType = [
|
|
13
|
+
PortalProviderAPI,
|
|
14
|
+
PortalRendererComponent
|
|
15
|
+
];
|
|
16
|
+
export declare function createPortalRendererComponent(portalManager: PortalManager): () => JSX.Element;
|
|
17
|
+
/**
|
|
18
|
+
* Creates a portal provider for managing multiple React portals. The provider
|
|
19
|
+
* facilitates rendering, removing, and destroying portals managed by a given
|
|
20
|
+
* PortalManager.
|
|
21
|
+
*
|
|
22
|
+
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
23
|
+
* is responsible for registering, managing, and destroying portals.
|
|
24
|
+
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
25
|
+
* portals.
|
|
26
|
+
* - `render(children, container, key)` Renders a new React portal with the given
|
|
27
|
+
* children, mounts it into the specified DOM container, and registers it
|
|
28
|
+
* with the PortalManager using a unique key.
|
|
29
|
+
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
30
|
+
* and deregisters it from the PortalManager.
|
|
31
|
+
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
32
|
+
* destroy method on the PortalManager to clean up any resources.
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
export declare const getPortalProviderAPI: (portalManager: PortalManager) => PortalProviderAPI;
|
|
36
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { PortalManager } from './PortalManager';
|
|
2
2
|
export { PortalBucket } from './PortalBucket';
|
|
3
3
|
export { usePortalProvider } from './usePortalProvider';
|
|
4
|
-
export type { PortalProviderAPI } from './
|
|
4
|
+
export type { PortalProviderAPI } from './common';
|
|
@@ -1,38 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { PortalManager } from './PortalManager';
|
|
3
|
-
type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string) => void;
|
|
4
|
-
type RemoveFn = (key: string) => void;
|
|
5
|
-
type DestoryFn = () => void;
|
|
6
|
-
export interface PortalProviderAPI {
|
|
7
|
-
render: RenderFn;
|
|
8
|
-
remove: RemoveFn;
|
|
9
|
-
destroy: DestoryFn;
|
|
10
|
-
}
|
|
11
|
-
type PortalRendererComponent = () => JSX.Element;
|
|
12
|
-
type UsePortalProviderReturnType = [
|
|
13
|
-
PortalProviderAPI,
|
|
14
|
-
PortalRendererComponent
|
|
15
|
-
];
|
|
16
|
-
export declare function createPortalRendererComponent(portalManager: PortalManager): () => JSX.Element;
|
|
17
|
-
/**
|
|
18
|
-
* Creates a portal provider for managing multiple React portals. The provider
|
|
19
|
-
* facilitates rendering, removing, and destroying portals managed by a given
|
|
20
|
-
* PortalManager.
|
|
21
|
-
*
|
|
22
|
-
* @param {PortalManager} portalManager - An instance of a PortalManager which
|
|
23
|
-
* is responsible for registering, managing, and destroying portals.
|
|
24
|
-
* @returns {PortalProviderAPI} An object containing methods to render, remove, and destroy
|
|
25
|
-
* portals.
|
|
26
|
-
* - `render(children, container, key)` Renders a new React portal with the given
|
|
27
|
-
* children, mounts it into the specified DOM container, and registers it
|
|
28
|
-
* with the PortalManager using a unique key.
|
|
29
|
-
* - `remove(key)` Removes a previously rendered portal identified by its key
|
|
30
|
-
* and deregisters it from the PortalManager.
|
|
31
|
-
* - `destroy()` Clears all portals managed by this provider and invokes the
|
|
32
|
-
* destroy method on the PortalManager to clean up any resources.
|
|
33
|
-
*
|
|
34
|
-
*/
|
|
35
|
-
export declare const getPortalProviderAPI: (portalManager: PortalManager) => PortalProviderAPI;
|
|
1
|
+
import { type UsePortalProviderReturnType } from './common';
|
|
36
2
|
/**
|
|
37
3
|
* Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
|
|
38
4
|
* @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
|
|
@@ -40,4 +6,3 @@ export declare const getPortalProviderAPI: (portalManager: PortalManager) => Por
|
|
|
40
6
|
* 2. PortalRenderer: A React component responsible for rendering the portal content.
|
|
41
7
|
*/
|
|
42
8
|
export declare function usePortalProvider(): UsePortalProviderReturnType;
|
|
43
|
-
export {};
|
|
@@ -14,6 +14,7 @@ export type PMPluginFactoryParams = {
|
|
|
14
14
|
providerFactory: ProviderFactory;
|
|
15
15
|
errorReporter?: ErrorReporter;
|
|
16
16
|
portalProviderAPI: PortalProviderAPI;
|
|
17
|
+
nodeViewPortalProviderAPI: PortalProviderAPI;
|
|
17
18
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
18
19
|
featureFlags: FeatureFlags;
|
|
19
20
|
getIntl: () => IntlShape;
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
* This function is used to switch between two components based on a feature flag
|
|
4
4
|
* @param ComponentOld
|
|
5
5
|
* @param ComponentNext
|
|
6
|
-
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('
|
|
6
|
+
* @param featureFlagFn function that returns a boolean value to switch to the next component, e.g. () => fg('platform_editor_react18_phase2_v2')
|
|
7
7
|
* @returns
|
|
8
8
|
*/
|
|
9
9
|
export declare const withFeatureFlaggedComponent: <P extends object>(ComponentOld: React.ComponentType<P>, ComponentNext: React.ComponentType<P>, featureFlagFn: () => boolean) => (props: P) => JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "94.14.
|
|
3
|
+
"version": "94.14.2",
|
|
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/"
|
|
@@ -110,7 +110,7 @@
|
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@atlaskit/activity-provider": "^2.4.0",
|
|
112
112
|
"@atlaskit/adf-schema": "^44.2.0",
|
|
113
|
-
"@atlaskit/adf-utils": "^19.
|
|
113
|
+
"@atlaskit/adf-utils": "^19.11.0",
|
|
114
114
|
"@atlaskit/analytics-listeners": "^8.11.0",
|
|
115
115
|
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
116
116
|
"@atlaskit/analytics-next": "^10.1.0",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"@atlaskit/media-file-preview": "^0.9.0",
|
|
138
138
|
"@atlaskit/media-picker": "^67.0.0",
|
|
139
139
|
"@atlaskit/media-ui": "^26.0.0",
|
|
140
|
-
"@atlaskit/media-viewer": "49.2.
|
|
140
|
+
"@atlaskit/media-viewer": "49.2.7",
|
|
141
141
|
"@atlaskit/mention": "^23.3.0",
|
|
142
142
|
"@atlaskit/menu": "^2.13.0",
|
|
143
143
|
"@atlaskit/onboarding": "^12.1.0",
|
|
@@ -250,16 +250,16 @@
|
|
|
250
250
|
"editor_code_block_wrapping_language_change_bug": {
|
|
251
251
|
"type": "boolean"
|
|
252
252
|
},
|
|
253
|
-
"
|
|
253
|
+
"platform_editor_react18_mention_with_provider_fix": {
|
|
254
254
|
"type": "boolean"
|
|
255
255
|
},
|
|
256
|
-
"
|
|
256
|
+
"platform_editor_react18_phase2_v2": {
|
|
257
257
|
"type": "boolean"
|
|
258
258
|
},
|
|
259
259
|
"use-effect-in-use-previous-props": {
|
|
260
260
|
"type": "boolean"
|
|
261
261
|
},
|
|
262
|
-
"
|
|
262
|
+
"platform_editor_react18_extension_component_v2": {
|
|
263
263
|
"type": "boolean"
|
|
264
264
|
},
|
|
265
265
|
"platform-datasources-enable-two-way-sync": {
|