@atlaskit/editor-common 78.37.4 → 79.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/cjs/monitoring/error.js +1 -1
  3. package/dist/cjs/portal/index.js +12 -0
  4. package/dist/cjs/portal/usePortalProvider.js +40 -16
  5. package/dist/cjs/ui/DropList/index.js +1 -1
  6. package/dist/cjs/ui/PortalProvider/index.js +9 -9
  7. package/dist/es2019/monitoring/error.js +1 -1
  8. package/dist/es2019/portal/index.js +1 -1
  9. package/dist/es2019/portal/usePortalProvider.js +39 -19
  10. package/dist/es2019/ui/DropList/index.js +1 -1
  11. package/dist/es2019/ui/PortalProvider/index.js +2 -2
  12. package/dist/esm/monitoring/error.js +1 -1
  13. package/dist/esm/portal/index.js +1 -1
  14. package/dist/esm/portal/usePortalProvider.js +39 -17
  15. package/dist/esm/ui/DropList/index.js +1 -1
  16. package/dist/esm/ui/PortalProvider/index.js +8 -8
  17. package/dist/types/extensibility/extensionNodeView.d.ts +3 -2
  18. package/dist/types/portal/index.d.ts +2 -1
  19. package/dist/types/portal/usePortalProvider.d.ts +25 -3
  20. package/dist/types/react-node-view/index.d.ts +4 -3
  21. package/dist/types/selection-based-node-view/SelectionBasedNodeView.d.ts +8 -7
  22. package/dist/types/types/plugin-factory.d.ts +3 -2
  23. package/dist/types/ui/PortalProvider/index.d.ts +4 -4
  24. package/dist/types-ts4.5/extensibility/extensionNodeView.d.ts +3 -2
  25. package/dist/types-ts4.5/portal/index.d.ts +2 -1
  26. package/dist/types-ts4.5/portal/usePortalProvider.d.ts +25 -3
  27. package/dist/types-ts4.5/react-node-view/index.d.ts +4 -3
  28. package/dist/types-ts4.5/selection-based-node-view/SelectionBasedNodeView.d.ts +8 -7
  29. package/dist/types-ts4.5/types/plugin-factory.d.ts +3 -2
  30. package/dist/types-ts4.5/ui/PortalProvider/index.d.ts +4 -4
  31. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 79.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#95168](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/95168)
8
+ [`2091e194a817`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2091e194a817) -
9
+ Introduced new PortalProviderAPI behind a FF
10
+
3
11
  ## 78.37.4
4
12
 
5
13
  ### Patch Changes
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
16
16
  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 && Object.prototype.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; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "78.37.4";
19
+ var packageVersion = "79.0.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -15,6 +15,18 @@ Object.defineProperty(exports, "PortalManager", {
15
15
  return _PortalManager.PortalManager;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "createPortalRendererComponent", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _usePortalProvider.createPortalRendererComponent;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "getPortalProviderAPI", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _usePortalProvider.getPortalProviderAPI;
28
+ }
29
+ });
18
30
  Object.defineProperty(exports, "usePortalProvider", {
19
31
  enumerable: true,
20
32
  get: function get() {
@@ -5,6 +5,8 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.createPortalRendererComponent = createPortalRendererComponent;
9
+ exports.getPortalProviderAPI = void 0;
8
10
  exports.usePortalProvider = usePortalProvider;
9
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
12
  var _react = _interopRequireWildcard(require("react"));
@@ -38,6 +40,43 @@ function createPortalRendererComponent(portalManager) {
38
40
  };
39
41
  }
40
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
+
41
80
  /**
42
81
  * Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
43
82
  * @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
@@ -52,22 +91,7 @@ function usePortalProvider() {
52
91
  return createPortalRendererComponent(portalManager);
53
92
  }, [portalManager]);
54
93
  var portalProviderAPI = (0, _react.useMemo)(function () {
55
- var portalsMap = new Map();
56
- return {
57
- render: function render(key, children, container) {
58
- var portal = /*#__PURE__*/(0, _reactDom.createPortal)(children(), container, key);
59
- portalsMap.set(key, portalManager.registerPortal(key, portal));
60
- },
61
- remove: function remove(key) {
62
- var _portalsMap$get;
63
- (_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
64
- portalsMap.delete(key);
65
- },
66
- destroy: function destroy() {
67
- portalsMap.clear();
68
- portalManager.destroy();
69
- }
70
- };
94
+ return getPortalProviderAPI(portalManager);
71
95
  }, [portalManager]);
72
96
 
73
97
  // Cleanup on unmount
@@ -20,7 +20,7 @@ var _Layer = _interopRequireDefault(require("../Layer"));
20
20
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
21
21
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @jsx jsx */
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "78.37.4";
23
+ var packageVersion = "79.0.0";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  var DropList = /*#__PURE__*/function (_Component) {
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.PortalRenderer = exports.PortalProviderWithThemeProviders = exports.PortalProviderAPI = exports.PortalProvider = void 0;
7
+ exports.PortalRenderer = exports.PortalProviderWithThemeProviders = exports.PortalProvider = exports.LegacyPortalProviderAPI = void 0;
8
8
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
9
  var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
10
  var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
@@ -24,12 +24,12 @@ var _IntlProviderIfMissingWrapper = _interopRequireDefault(require("../IntlProvi
24
24
  var _class4;
25
25
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
26
26
  function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
27
- var PortalProviderAPI = exports.PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
28
- (0, _inherits2.default)(PortalProviderAPI, _EventDispatcher);
29
- var _super = _createSuper(PortalProviderAPI);
30
- function PortalProviderAPI(intl, onAnalyticsEvent, analyticsContext) {
27
+ var LegacyPortalProviderAPI = exports.LegacyPortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
28
+ (0, _inherits2.default)(LegacyPortalProviderAPI, _EventDispatcher);
29
+ var _super = _createSuper(LegacyPortalProviderAPI);
30
+ function LegacyPortalProviderAPI(intl, onAnalyticsEvent, analyticsContext) {
31
31
  var _this;
32
- (0, _classCallCheck2.default)(this, PortalProviderAPI);
32
+ (0, _classCallCheck2.default)(this, LegacyPortalProviderAPI);
33
33
  _this = _super.call(this);
34
34
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "portals", new Map());
35
35
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setContext", function (context) {
@@ -40,7 +40,7 @@ var PortalProviderAPI = exports.PortalProviderAPI = /*#__PURE__*/function (_Even
40
40
  _this.useAnalyticsContext = analyticsContext;
41
41
  return _this;
42
42
  }
43
- (0, _createClass2.default)(PortalProviderAPI, [{
43
+ (0, _createClass2.default)(LegacyPortalProviderAPI, [{
44
44
  key: "render",
45
45
  value: function render(children, container, key) {
46
46
  var hasAnalyticsContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
@@ -119,7 +119,7 @@ var PortalProviderAPI = exports.PortalProviderAPI = /*#__PURE__*/function (_Even
119
119
  }
120
120
  }
121
121
  }]);
122
- return PortalProviderAPI;
122
+ return LegacyPortalProviderAPI;
123
123
  }(_eventDispatcher.EventDispatcher);
124
124
  var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
125
125
  (0, _inherits2.default)(BasePortalProvider, _React$Component);
@@ -128,7 +128,7 @@ var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
128
128
  var _this3;
129
129
  (0, _classCallCheck2.default)(this, BasePortalProvider);
130
130
  _this3 = _super2.call(this, props);
131
- _this3.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext);
131
+ _this3.portalProviderAPI = new LegacyPortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext);
132
132
  return _this3;
133
133
  }
134
134
  (0, _createClass2.default)(BasePortalProvider, [{
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "78.37.4";
3
+ const packageVersion = "79.0.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -1,3 +1,3 @@
1
1
  export { PortalManager } from './PortalManager';
2
2
  export { PortalBucket } from './PortalBucket';
3
- export { usePortalProvider } from './usePortalProvider';
3
+ export { createPortalRendererComponent, usePortalProvider, getPortalProviderAPI } from './usePortalProvider';
@@ -2,7 +2,7 @@ import React, { useEffect, useLayoutEffect, useMemo, useState } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { PortalBucket } from './PortalBucket';
4
4
  import { PortalManager } from './PortalManager';
5
- function createPortalRendererComponent(portalManager) {
5
+ export function createPortalRendererComponent(portalManager) {
6
6
  return function PortalRenderer() {
7
7
  const [buckets, setBuckets] = useState(portalManager.getBuckets());
8
8
  useLayoutEffect(() => {
@@ -20,6 +20,43 @@ function createPortalRendererComponent(portalManager) {
20
20
  };
21
21
  }
22
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
+
23
60
  /**
24
61
  * Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
25
62
  * @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
@@ -29,24 +66,7 @@ function createPortalRendererComponent(portalManager) {
29
66
  export function usePortalProvider() {
30
67
  const portalManager = useMemo(() => new PortalManager(), []);
31
68
  const PortalRenderer = useMemo(() => createPortalRendererComponent(portalManager), [portalManager]);
32
- const portalProviderAPI = useMemo(() => {
33
- const portalsMap = new Map();
34
- return {
35
- render: (key, children, container) => {
36
- const portal = /*#__PURE__*/createPortal(children(), container, key);
37
- portalsMap.set(key, portalManager.registerPortal(key, portal));
38
- },
39
- remove: key => {
40
- var _portalsMap$get;
41
- (_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 ? void 0 : _portalsMap$get();
42
- portalsMap.delete(key);
43
- },
44
- destroy: () => {
45
- portalsMap.clear();
46
- portalManager.destroy();
47
- }
48
- };
49
- }, [portalManager]);
69
+ const portalProviderAPI = useMemo(() => getPortalProviderAPI(portalManager), [portalManager]);
50
70
 
51
71
  // Cleanup on unmount
52
72
  useEffect(() => {
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
7
7
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
8
8
  import Layer from '../Layer';
9
9
  const packageName = "@atlaskit/editor-common";
10
- const packageVersion = "78.37.4";
10
+ const packageVersion = "79.0.0";
11
11
  const halfFocusRing = 1;
12
12
  const dropOffset = '0, 8';
13
13
  class DropList extends Component {
@@ -8,7 +8,7 @@ import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stabl
8
8
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
9
9
  import { EventDispatcher } from '../../event-dispatcher';
10
10
  import IntlProviderIfMissingWrapper from '../IntlProviderIfMissingWrapper';
11
- export class PortalProviderAPI extends EventDispatcher {
11
+ export class LegacyPortalProviderAPI extends EventDispatcher {
12
12
  constructor(intl, onAnalyticsEvent, analyticsContext) {
13
13
  super();
14
14
  _defineProperty(this, "portals", new Map());
@@ -93,7 +93,7 @@ export class PortalProviderAPI extends EventDispatcher {
93
93
  class BasePortalProvider extends React.Component {
94
94
  constructor(props) {
95
95
  super(props);
96
- this.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext);
96
+ this.portalProviderAPI = new LegacyPortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext);
97
97
  }
98
98
  render() {
99
99
  return this.props.render(this.portalProviderAPI);
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "78.37.4";
9
+ var packageVersion = "79.0.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -1,3 +1,3 @@
1
1
  export { PortalManager } from './PortalManager';
2
2
  export { PortalBucket } from './PortalBucket';
3
- export { usePortalProvider } from './usePortalProvider';
3
+ export { createPortalRendererComponent, usePortalProvider, getPortalProviderAPI } from './usePortalProvider';
@@ -3,7 +3,7 @@ import React, { useEffect, useLayoutEffect, useMemo, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import { PortalBucket } from './PortalBucket';
5
5
  import { PortalManager } from './PortalManager';
6
- function createPortalRendererComponent(portalManager) {
6
+ export function createPortalRendererComponent(portalManager) {
7
7
  return function PortalRenderer() {
8
8
  var _useState = useState(portalManager.getBuckets()),
9
9
  _useState2 = _slicedToArray(_useState, 2),
@@ -28,6 +28,43 @@ function createPortalRendererComponent(portalManager) {
28
28
  };
29
29
  }
30
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
+
31
68
  /**
32
69
  * Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
33
70
  * @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
@@ -42,22 +79,7 @@ export function usePortalProvider() {
42
79
  return createPortalRendererComponent(portalManager);
43
80
  }, [portalManager]);
44
81
  var portalProviderAPI = useMemo(function () {
45
- var portalsMap = new Map();
46
- return {
47
- render: function render(key, children, container) {
48
- var portal = /*#__PURE__*/createPortal(children(), container, key);
49
- portalsMap.set(key, portalManager.registerPortal(key, portal));
50
- },
51
- remove: function remove(key) {
52
- var _portalsMap$get;
53
- (_portalsMap$get = portalsMap.get(key)) === null || _portalsMap$get === void 0 || _portalsMap$get();
54
- portalsMap.delete(key);
55
- },
56
- destroy: function destroy() {
57
- portalsMap.clear();
58
- portalManager.destroy();
59
- }
60
- };
82
+ return getPortalProviderAPI(portalManager);
61
83
  }, [portalManager]);
62
84
 
63
85
  // Cleanup on unmount
@@ -15,7 +15,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
15
15
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
16
16
  import Layer from '../Layer';
17
17
  var packageName = "@atlaskit/editor-common";
18
- var packageVersion = "78.37.4";
18
+ var packageVersion = "79.0.0";
19
19
  var halfFocusRing = 1;
20
20
  var dropOffset = '0, 8';
21
21
  var DropList = /*#__PURE__*/function (_Component) {
@@ -17,12 +17,12 @@ import { default as AnalyticsReactContext } from '@atlaskit/analytics-next-stabl
17
17
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../analytics';
18
18
  import { EventDispatcher } from '../../event-dispatcher';
19
19
  import IntlProviderIfMissingWrapper from '../IntlProviderIfMissingWrapper';
20
- export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
21
- _inherits(PortalProviderAPI, _EventDispatcher);
22
- var _super = _createSuper(PortalProviderAPI);
23
- function PortalProviderAPI(intl, onAnalyticsEvent, analyticsContext) {
20
+ export var LegacyPortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
21
+ _inherits(LegacyPortalProviderAPI, _EventDispatcher);
22
+ var _super = _createSuper(LegacyPortalProviderAPI);
23
+ function LegacyPortalProviderAPI(intl, onAnalyticsEvent, analyticsContext) {
24
24
  var _this;
25
- _classCallCheck(this, PortalProviderAPI);
25
+ _classCallCheck(this, LegacyPortalProviderAPI);
26
26
  _this = _super.call(this);
27
27
  _defineProperty(_assertThisInitialized(_this), "portals", new Map());
28
28
  _defineProperty(_assertThisInitialized(_this), "setContext", function (context) {
@@ -33,7 +33,7 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
33
33
  _this.useAnalyticsContext = analyticsContext;
34
34
  return _this;
35
35
  }
36
- _createClass(PortalProviderAPI, [{
36
+ _createClass(LegacyPortalProviderAPI, [{
37
37
  key: "render",
38
38
  value: function render(children, container, key) {
39
39
  var hasAnalyticsContext = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
@@ -112,7 +112,7 @@ export var PortalProviderAPI = /*#__PURE__*/function (_EventDispatcher) {
112
112
  }
113
113
  }
114
114
  }]);
115
- return PortalProviderAPI;
115
+ return LegacyPortalProviderAPI;
116
116
  }(EventDispatcher);
117
117
  var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
118
118
  _inherits(BasePortalProvider, _React$Component);
@@ -121,7 +121,7 @@ var BasePortalProvider = /*#__PURE__*/function (_React$Component) {
121
121
  var _this3;
122
122
  _classCallCheck(this, BasePortalProvider);
123
123
  _this3 = _super2.call(this, props);
124
- _this3.portalProviderAPI = new PortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext);
124
+ _this3.portalProviderAPI = new LegacyPortalProviderAPI(props.intl, props.onAnalyticsEvent, props.useAnalyticsContext);
125
125
  return _this3;
126
126
  }
127
127
  _createClass(BasePortalProvider, [{
@@ -3,11 +3,12 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { EventDispatcher } from '../event-dispatcher';
5
5
  import type { ExtensionHandlers } from '../extensions';
6
+ import type { PortalProviderAPI } from '../portal';
6
7
  import type { ProviderFactory } from '../provider-factory';
7
8
  import type { ForwardRef, getPosHandler } from '../react-node-view';
8
9
  import ReactNodeView from '../react-node-view';
9
10
  import type { EditorAppearance } from '../types';
10
- import type { PortalProviderAPI } from '../ui/PortalProvider';
11
+ import type { LegacyPortalProviderAPI } from '../ui/PortalProvider';
11
12
  import type { ExtensionsPluginInjectionAPI } from './types';
12
13
  interface ExtensionNodeViewOptions {
13
14
  appearance?: EditorAppearance;
@@ -28,5 +29,5 @@ export declare class ExtensionNode extends ReactNodeView {
28
29
  showMacroInteractionDesignUpdates: boolean;
29
30
  }, forwardRef: ForwardRef): JSX.Element;
30
31
  }
31
- export default function ExtensionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, extensionNodeViewOptions: ExtensionNodeViewOptions, pluginInjectionApi: ExtensionsPluginInjectionAPI, showMacroInteractionDesignUpdates?: boolean): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
32
+ export default function ExtensionNodeView(portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, extensionNodeViewOptions: ExtensionNodeViewOptions, pluginInjectionApi: ExtensionsPluginInjectionAPI, showMacroInteractionDesignUpdates?: boolean): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
32
33
  export {};
@@ -1,3 +1,4 @@
1
1
  export { PortalManager } from './PortalManager';
2
2
  export { PortalBucket } from './PortalBucket';
3
- export { usePortalProvider } from './usePortalProvider';
3
+ export { createPortalRendererComponent, usePortalProvider, getPortalProviderAPI, } from './usePortalProvider';
4
+ export type { PortalProviderAPI } from './usePortalProvider';
@@ -1,13 +1,35 @@
1
1
  import React from 'react';
2
- type RenderFn = (key: string, children: () => React.ReactChild | JSX.Element | null, container: HTMLElement) => void;
2
+ import { PortalManager } from './PortalManager';
3
+ type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string) => void;
3
4
  type RemoveFn = (key: string) => void;
4
- interface PortalProviderAPI {
5
+ type DestoryFn = () => void;
6
+ export interface PortalProviderAPI {
5
7
  render: RenderFn;
6
8
  remove: RemoveFn;
7
- destroy: () => void;
9
+ destroy: DestoryFn;
8
10
  }
9
11
  type PortalRendererComponent = () => JSX.Element;
10
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;
11
33
  /**
12
34
  * Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
13
35
  * @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { EventDispatcher } from '../event-dispatcher';
5
- import type { PortalProviderAPI } from '../ui/PortalProvider';
5
+ import type { PortalProviderAPI } from '../portal';
6
+ import type { LegacyPortalProviderAPI } from '../ui/PortalProvider';
6
7
  import type { ForwardRef, getPosHandler, ProsemirrorGetPosHandler, ReactComponentProps, shouldUpdate } from './types';
7
8
  export type { getPosHandler, ReactComponentProps, shouldUpdate, ProsemirrorGetPosHandler, ForwardRef, };
8
9
  export type { InlineNodeViewComponentProps } from './getInlineNodeViewProducer';
@@ -23,7 +24,7 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
23
24
  contentDOM: HTMLElement | null | undefined;
24
25
  node: PMNode;
25
26
  key: string;
26
- constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
27
+ constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
27
28
  /**
28
29
  * This method exists to move initialization logic out of the constructor,
29
30
  * so object can be initialized properly before calling render first time.
@@ -53,5 +54,5 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
53
54
  get dom(): HTMLElement;
54
55
  destroy(): void;
55
56
  private dispatchAnalyticsEvent;
56
- static fromComponent(component: React.ComponentType<React.PropsWithChildren<any>>, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, props?: ReactComponentProps, viewShouldUpdate?: (nextNode: PMNode) => boolean, hasIntlContext?: boolean): (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<ReactComponentProps>;
57
+ static fromComponent(component: React.ComponentType<React.PropsWithChildren<any>>, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, props?: ReactComponentProps, viewShouldUpdate?: (nextNode: PMNode) => boolean, hasIntlContext?: boolean): (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<ReactComponentProps>;
57
58
  }
@@ -1,9 +1,10 @@
1
- import React from 'react';
2
- import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import { EventDispatcher } from '../event-dispatcher';
5
- import ReactNodeView, { getPosHandler, ReactComponentProps, shouldUpdate } from '../react-node-view';
6
- import { PortalProviderAPI } from '../ui/PortalProvider';
1
+ import type React from 'react';
2
+ import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import { type EventDispatcher } from '../event-dispatcher';
5
+ import { type PortalProviderAPI } from '../portal';
6
+ import ReactNodeView, { type getPosHandler, type ReactComponentProps, type shouldUpdate } from '../react-node-view';
7
+ import type { LegacyPortalProviderAPI } from '../ui/PortalProvider';
7
8
  /**
8
9
  * A ReactNodeView that handles React components sensitive
9
10
  * to selection changes.
@@ -31,7 +32,7 @@ export declare class SelectionBasedNodeView<P = ReactComponentProps> extends Rea
31
32
  protected isSelectedNode: boolean;
32
33
  pos: number | undefined;
33
34
  posEnd: number | undefined;
34
- constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
35
+ constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
35
36
  /**
36
37
  * Update current node's start and end positions.
37
38
  *
@@ -2,9 +2,10 @@ import type { IntlShape } from 'react-intl-next';
2
2
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
4
4
  import type { Dispatch, EventDispatcher } from '../event-dispatcher';
5
+ import { type PortalProviderAPI } from '../portal';
5
6
  import type { ProviderFactory } from '../provider-factory';
6
7
  import type { SafePlugin } from '../safe-plugin';
7
- import type { PortalProviderAPI } from '../ui/PortalProvider';
8
+ import type { LegacyPortalProviderAPI } from '../ui/PortalProvider';
8
9
  import type { ErrorReporter } from '../utils';
9
10
  import type { EditorReactContext } from './editor-react-context';
10
11
  import type { FeatureFlags } from './feature-flags';
@@ -14,7 +15,7 @@ export type PMPluginFactoryParams = {
14
15
  eventDispatcher: EventDispatcher;
15
16
  providerFactory: ProviderFactory;
16
17
  errorReporter?: ErrorReporter;
17
- portalProviderAPI: PortalProviderAPI;
18
+ portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI;
18
19
  reactContext: () => EditorReactContext;
19
20
  dispatchAnalyticsEvent: DispatchAnalyticsEvent;
20
21
  featureFlags: FeatureFlags;
@@ -3,7 +3,7 @@ import type { IntlShape, WrappedComponentProps } from 'react-intl-next';
3
3
  import type { FireAnalyticsCallback } from '../../analytics';
4
4
  import { EventDispatcher } from '../../event-dispatcher';
5
5
  export type BasePortalProviderProps = {
6
- render: (portalProviderAPI: PortalProviderAPI) => React.ReactChild | JSX.Element | null;
6
+ render: (portalProviderAPI: LegacyPortalProviderAPI) => React.ReactChild | JSX.Element | null;
7
7
  onAnalyticsEvent?: FireAnalyticsCallback;
8
8
  useAnalyticsContext?: boolean;
9
9
  } & WrappedComponentProps;
@@ -17,7 +17,7 @@ type MountedPortal = {
17
17
  hasAnalyticsContext: boolean;
18
18
  hasIntlContext: boolean;
19
19
  };
20
- export declare class PortalProviderAPI extends EventDispatcher {
20
+ export declare class LegacyPortalProviderAPI extends EventDispatcher {
21
21
  portals: Map<HTMLElement, MountedPortal>;
22
22
  context: any;
23
23
  intl: IntlShape;
@@ -37,10 +37,10 @@ export declare const PortalProvider: React.FC<import("react-intl-next").WithIntl
37
37
  type PortalProviderWithThemeProvidersProps = Omit<BasePortalProviderProps, 'intl' | 'themeMode'>;
38
38
  export declare const PortalProviderWithThemeProviders: ({ onAnalyticsEvent, useAnalyticsContext, render, }: PortalProviderWithThemeProvidersProps) => JSX.Element;
39
39
  export declare class PortalRenderer extends React.Component<{
40
- portalProviderAPI: PortalProviderAPI;
40
+ portalProviderAPI: LegacyPortalProviderAPI;
41
41
  }, PortalRendererState> {
42
42
  constructor(props: {
43
- portalProviderAPI: PortalProviderAPI;
43
+ portalProviderAPI: LegacyPortalProviderAPI;
44
44
  });
45
45
  handleUpdate: (portals: Portals) => void;
46
46
  render(): JSX.Element;
@@ -3,11 +3,12 @@ import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { EventDispatcher } from '../event-dispatcher';
5
5
  import type { ExtensionHandlers } from '../extensions';
6
+ import type { PortalProviderAPI } from '../portal';
6
7
  import type { ProviderFactory } from '../provider-factory';
7
8
  import type { ForwardRef, getPosHandler } from '../react-node-view';
8
9
  import ReactNodeView from '../react-node-view';
9
10
  import type { EditorAppearance } from '../types';
10
- import type { PortalProviderAPI } from '../ui/PortalProvider';
11
+ import type { LegacyPortalProviderAPI } from '../ui/PortalProvider';
11
12
  import type { ExtensionsPluginInjectionAPI } from './types';
12
13
  interface ExtensionNodeViewOptions {
13
14
  appearance?: EditorAppearance;
@@ -28,5 +29,5 @@ export declare class ExtensionNode extends ReactNodeView {
28
29
  showMacroInteractionDesignUpdates: boolean;
29
30
  }, forwardRef: ForwardRef): JSX.Element;
30
31
  }
31
- export default function ExtensionNodeView(portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, extensionNodeViewOptions: ExtensionNodeViewOptions, pluginInjectionApi: ExtensionsPluginInjectionAPI, showMacroInteractionDesignUpdates?: boolean): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
32
+ export default function ExtensionNodeView(portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, extensionHandlers: ExtensionHandlers, extensionNodeViewOptions: ExtensionNodeViewOptions, pluginInjectionApi: ExtensionsPluginInjectionAPI, showMacroInteractionDesignUpdates?: boolean): (node: PmNode, view: EditorView, getPos: getPosHandler) => NodeView;
32
33
  export {};
@@ -1,3 +1,4 @@
1
1
  export { PortalManager } from './PortalManager';
2
2
  export { PortalBucket } from './PortalBucket';
3
- export { usePortalProvider } from './usePortalProvider';
3
+ export { createPortalRendererComponent, usePortalProvider, getPortalProviderAPI, } from './usePortalProvider';
4
+ export type { PortalProviderAPI } from './usePortalProvider';
@@ -1,16 +1,38 @@
1
1
  import React from 'react';
2
- type RenderFn = (key: string, children: () => React.ReactChild | JSX.Element | null, container: HTMLElement) => void;
2
+ import { PortalManager } from './PortalManager';
3
+ type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string) => void;
3
4
  type RemoveFn = (key: string) => void;
4
- interface PortalProviderAPI {
5
+ type DestoryFn = () => void;
6
+ export interface PortalProviderAPI {
5
7
  render: RenderFn;
6
8
  remove: RemoveFn;
7
- destroy: () => void;
9
+ destroy: DestoryFn;
8
10
  }
9
11
  type PortalRendererComponent = () => JSX.Element;
10
12
  type UsePortalProviderReturnType = [
11
13
  PortalProviderAPI,
12
14
  PortalRendererComponent
13
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;
14
36
  /**
15
37
  * Initializes PortalManager and creates PortalRendererComponent. Offers an API (portalProviderAPI) for managing portals.
16
38
  * @returns {[PortalProviderAPI, PortalRendererComponent]} An array containing two elements:
@@ -2,7 +2,8 @@ import React from 'react';
2
2
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { Decoration, DecorationSource, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
4
4
  import type { EventDispatcher } from '../event-dispatcher';
5
- import type { PortalProviderAPI } from '../ui/PortalProvider';
5
+ import type { PortalProviderAPI } from '../portal';
6
+ import type { LegacyPortalProviderAPI } from '../ui/PortalProvider';
6
7
  import type { ForwardRef, getPosHandler, ProsemirrorGetPosHandler, ReactComponentProps, shouldUpdate } from './types';
7
8
  export type { getPosHandler, ReactComponentProps, shouldUpdate, ProsemirrorGetPosHandler, ForwardRef, };
8
9
  export type { InlineNodeViewComponentProps } from './getInlineNodeViewProducer';
@@ -23,7 +24,7 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
23
24
  contentDOM: HTMLElement | null | undefined;
24
25
  node: PMNode;
25
26
  key: string;
26
- constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
27
+ constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps?: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasAnalyticsContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
27
28
  /**
28
29
  * This method exists to move initialization logic out of the constructor,
29
30
  * so object can be initialized properly before calling render first time.
@@ -53,5 +54,5 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
53
54
  get dom(): HTMLElement;
54
55
  destroy(): void;
55
56
  private dispatchAnalyticsEvent;
56
- static fromComponent(component: React.ComponentType<React.PropsWithChildren<any>>, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, props?: ReactComponentProps, viewShouldUpdate?: (nextNode: PMNode) => boolean, hasIntlContext?: boolean): (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<ReactComponentProps>;
57
+ static fromComponent(component: React.ComponentType<React.PropsWithChildren<any>>, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, props?: ReactComponentProps, viewShouldUpdate?: (nextNode: PMNode) => boolean, hasIntlContext?: boolean): (node: PMNode, view: EditorView, getPos: getPosHandler) => ReactNodeView<ReactComponentProps>;
57
58
  }
@@ -1,9 +1,10 @@
1
- import React from 'react';
2
- import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
- import { EditorView } from '@atlaskit/editor-prosemirror/view';
4
- import { EventDispatcher } from '../event-dispatcher';
5
- import ReactNodeView, { getPosHandler, ReactComponentProps, shouldUpdate } from '../react-node-view';
6
- import { PortalProviderAPI } from '../ui/PortalProvider';
1
+ import type React from 'react';
2
+ import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
4
+ import { type EventDispatcher } from '../event-dispatcher';
5
+ import { type PortalProviderAPI } from '../portal';
6
+ import ReactNodeView, { type getPosHandler, type ReactComponentProps, type shouldUpdate } from '../react-node-view';
7
+ import type { LegacyPortalProviderAPI } from '../ui/PortalProvider';
7
8
  /**
8
9
  * A ReactNodeView that handles React components sensitive
9
10
  * to selection changes.
@@ -31,7 +32,7 @@ export declare class SelectionBasedNodeView<P = ReactComponentProps> extends Rea
31
32
  protected isSelectedNode: boolean;
32
33
  pos: number | undefined;
33
34
  posEnd: number | undefined;
34
- constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
35
+ constructor(node: PMNode, view: EditorView, getPos: getPosHandler, portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI, eventDispatcher: EventDispatcher, reactComponentProps: P, reactComponent?: React.ComponentType<React.PropsWithChildren<any>>, hasContext?: boolean, viewShouldUpdate?: shouldUpdate, hasIntlContext?: boolean);
35
36
  /**
36
37
  * Update current node's start and end positions.
37
38
  *
@@ -2,9 +2,10 @@ import type { IntlShape } from 'react-intl-next';
2
2
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { DispatchAnalyticsEvent } from '../analytics/types/dispatch-analytics-event';
4
4
  import type { Dispatch, EventDispatcher } from '../event-dispatcher';
5
+ import { type PortalProviderAPI } from '../portal';
5
6
  import type { ProviderFactory } from '../provider-factory';
6
7
  import type { SafePlugin } from '../safe-plugin';
7
- import type { PortalProviderAPI } from '../ui/PortalProvider';
8
+ import type { LegacyPortalProviderAPI } from '../ui/PortalProvider';
8
9
  import type { ErrorReporter } from '../utils';
9
10
  import type { EditorReactContext } from './editor-react-context';
10
11
  import type { FeatureFlags } from './feature-flags';
@@ -14,7 +15,7 @@ export type PMPluginFactoryParams = {
14
15
  eventDispatcher: EventDispatcher;
15
16
  providerFactory: ProviderFactory;
16
17
  errorReporter?: ErrorReporter;
17
- portalProviderAPI: PortalProviderAPI;
18
+ portalProviderAPI: LegacyPortalProviderAPI | PortalProviderAPI;
18
19
  reactContext: () => EditorReactContext;
19
20
  dispatchAnalyticsEvent: DispatchAnalyticsEvent;
20
21
  featureFlags: FeatureFlags;
@@ -3,7 +3,7 @@ import type { IntlShape, WrappedComponentProps } from 'react-intl-next';
3
3
  import type { FireAnalyticsCallback } from '../../analytics';
4
4
  import { EventDispatcher } from '../../event-dispatcher';
5
5
  export type BasePortalProviderProps = {
6
- render: (portalProviderAPI: PortalProviderAPI) => React.ReactChild | JSX.Element | null;
6
+ render: (portalProviderAPI: LegacyPortalProviderAPI) => React.ReactChild | JSX.Element | null;
7
7
  onAnalyticsEvent?: FireAnalyticsCallback;
8
8
  useAnalyticsContext?: boolean;
9
9
  } & WrappedComponentProps;
@@ -17,7 +17,7 @@ type MountedPortal = {
17
17
  hasAnalyticsContext: boolean;
18
18
  hasIntlContext: boolean;
19
19
  };
20
- export declare class PortalProviderAPI extends EventDispatcher {
20
+ export declare class LegacyPortalProviderAPI extends EventDispatcher {
21
21
  portals: Map<HTMLElement, MountedPortal>;
22
22
  context: any;
23
23
  intl: IntlShape;
@@ -37,10 +37,10 @@ export declare const PortalProvider: React.FC<import("react-intl-next").WithIntl
37
37
  type PortalProviderWithThemeProvidersProps = Omit<BasePortalProviderProps, 'intl' | 'themeMode'>;
38
38
  export declare const PortalProviderWithThemeProviders: ({ onAnalyticsEvent, useAnalyticsContext, render, }: PortalProviderWithThemeProvidersProps) => JSX.Element;
39
39
  export declare class PortalRenderer extends React.Component<{
40
- portalProviderAPI: PortalProviderAPI;
40
+ portalProviderAPI: LegacyPortalProviderAPI;
41
41
  }, PortalRendererState> {
42
42
  constructor(props: {
43
- portalProviderAPI: PortalProviderAPI;
43
+ portalProviderAPI: LegacyPortalProviderAPI;
44
44
  });
45
45
  handleUpdate: (portals: Portals) => void;
46
46
  render(): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "78.37.4",
3
+ "version": "79.0.0",
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/"