@atlaskit/editor-common 102.11.1 → 102.11.3

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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 102.11.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128680](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128680)
8
+ [`c621508ab44f7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c621508ab44f7) -
9
+ Fixes rendering delay under virtualization
10
+
11
+ ## 102.11.2
12
+
13
+ ### Patch Changes
14
+
15
+ - [#128123](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128123)
16
+ [`ab71af4c9be90`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ab71af4c9be90) -
17
+ [ux] [ED-26947] Implement media pixel resizing editor
18
+ - Updated dependencies
19
+
3
20
  ## 102.11.1
4
21
 
5
22
  ### Patch Changes
@@ -21,6 +21,11 @@ var pixelEntryMessages = exports.pixelEntryMessages = (0, _reactIntlNext.defineM
21
21
  defaultMessage: 'Max width {maxWidth}px',
22
22
  description: 'The width input aria label'
23
23
  },
24
+ inputWidthLabel: {
25
+ id: 'fabric.editor.media.pixelEntry.inputWidthLabel',
26
+ defaultMessage: 'Width',
27
+ description: 'The label displayed next to the width input'
28
+ },
24
29
  inputHeightTooltip: {
25
30
  id: 'fabric.editor.media.pixelEntry.inputHeightTooltip',
26
31
  defaultMessage: 'Height',
@@ -50,5 +55,10 @@ var pixelEntryMessages = exports.pixelEntryMessages = (0, _reactIntlNext.defineM
50
55
  id: 'fabric.editor.media.pixelEntry.migrationButtonTooltip',
51
56
  defaultMessage: 'Migrate from percentage to fixed pixel sizing',
52
57
  description: 'The tooltip displayed on the migration button'
58
+ },
59
+ closePixelEntry: {
60
+ id: 'fabric.editor.media.pixelEntry.closePixelEntry',
61
+ defaultMessage: 'Close',
62
+ description: 'The text give to the close button used to close the pixel inputs and go back to main toolbar'
53
63
  }
54
64
  });
@@ -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 = "102.11.1";
20
+ var packageVersion = "102.11.3";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -5,6 +5,7 @@ var _typeof = require("@babel/runtime/helpers/typeof");
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.PortalRenderWrapperInner = void 0;
8
9
  exports.createPortalRendererComponent = createPortalRendererComponent;
9
10
  exports.getPortalProviderAPI = void 0;
10
11
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
@@ -41,6 +42,23 @@ function createPortalRendererComponent(portalManager) {
41
42
  };
42
43
  }
43
44
 
45
+ /**
46
+ * Wraps the children of a portal to allow for React rendering
47
+ * lifecycle hook to be exposed, primarily for node virtualization.
48
+ */
49
+ var PortalRenderWrapperInner = exports.PortalRenderWrapperInner = function PortalRenderWrapperInner(_ref) {
50
+ var getChildren = _ref.getChildren,
51
+ onBeforeRender = _ref.onBeforeRender;
52
+ (0, _react.useLayoutEffect)(function () {
53
+ if (onBeforeRender) {
54
+ onBeforeRender();
55
+ }
56
+ }, [onBeforeRender]);
57
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, getChildren());
58
+ };
59
+ var PortalRenderWrapper = /*#__PURE__*/(0, _react.memo)(PortalRenderWrapperInner);
60
+ PortalRenderWrapper.displayName = 'PortalRenderWrapper';
61
+
44
62
  /**
45
63
  * Creates a portal provider for managing multiple React portals. The provider
46
64
  * facilitates rendering, removing, and destroying portals managed by a given
@@ -62,9 +80,17 @@ function createPortalRendererComponent(portalManager) {
62
80
  var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
63
81
  var portalsMap = new Map();
64
82
  return {
65
- render: function render(children, container, key) {
66
- var portal = /*#__PURE__*/(0, _reactDom.createPortal)(children(), container, key);
67
- portalsMap.set(key, portalManager.registerPortal(key, portal));
83
+ render: function render(children, container, key, onBeforeReactDomRender) {
84
+ if (typeof onBeforeReactDomRender === 'function') {
85
+ var portal = /*#__PURE__*/(0, _reactDom.createPortal)( /*#__PURE__*/_react.default.createElement(PortalRenderWrapper, {
86
+ getChildren: children,
87
+ onBeforeRender: onBeforeReactDomRender
88
+ }), container, key);
89
+ portalsMap.set(key, portalManager.registerPortal(key, portal));
90
+ } else {
91
+ var _portal = /*#__PURE__*/(0, _reactDom.createPortal)(children(), container, key);
92
+ portalsMap.set(key, portalManager.registerPortal(key, _portal));
93
+ }
68
94
  },
69
95
  remove: function remove(key) {
70
96
  var _portalsMap$get;
@@ -15,6 +15,12 @@ Object.defineProperty(exports, "PortalManager", {
15
15
  return _PortalManager.PortalManager;
16
16
  }
17
17
  });
18
+ Object.defineProperty(exports, "PortalRenderWrapperInner", {
19
+ enumerable: true,
20
+ get: function get() {
21
+ return _common.PortalRenderWrapperInner;
22
+ }
23
+ });
18
24
  Object.defineProperty(exports, "usePortalProvider", {
19
25
  enumerable: true,
20
26
  get: function get() {
@@ -22,5 +28,6 @@ Object.defineProperty(exports, "usePortalProvider", {
22
28
  }
23
29
  });
24
30
  var _PortalManager = require("./PortalManager");
31
+ var _common = require("./common");
25
32
  var _PortalBucket = require("./PortalBucket");
26
33
  var _usePortalProvider = require("./usePortalProvider");
@@ -100,12 +100,22 @@ function createNodeView(_ref) {
100
100
  var domRef = document.createElement('span');
101
101
  domRef.contentEditable = 'false';
102
102
  setDomAttrs(nodeViewParams.node, domRef);
103
+ var fallbackRef = {
104
+ current: null
105
+ };
103
106
 
104
107
  // @see ED-3790
105
108
  // something gets messed up during mutation processing inside of a
106
109
  // nodeView if DOM structure has nested plain "div"s, it doesn't see the
107
110
  // difference between them and it kills the nodeView
108
111
  domRef.classList.add("".concat(nodeViewParams.node.type.name, "View-content-wrap"), "".concat(inlineNodeViewClassname));
112
+ function onBeforeReactDomRender() {
113
+ if (!fallbackRef.current) {
114
+ return;
115
+ }
116
+ domRef.removeChild(fallbackRef.current);
117
+ fallbackRef.current = null;
118
+ }
109
119
 
110
120
  // This util is shared for tracking rendering, and the ErrorBoundary that
111
121
  // is setup to wrap the Component when rendering
@@ -128,7 +138,7 @@ function createNodeView(_ref) {
128
138
  nodeViewParams: nodeViewParams,
129
139
  Component: Component,
130
140
  extraComponentProps: extraComponentProps
131
- }), domRef, key);
141
+ }), domRef, key, enableVirtualization ? onBeforeReactDomRender : undefined);
132
142
  }
133
143
  var didRenderComponentWithIntersectionObserver = false;
134
144
  var destroyed = false;
@@ -137,6 +147,7 @@ function createNodeView(_ref) {
137
147
  var _currentNode$type;
138
148
  if (canRenderFallback(currentNode) && typeof ((_currentNode$type = currentNode.type) === null || _currentNode$type === void 0 || (_currentNode$type = _currentNode$type.spec) === null || _currentNode$type === void 0 ? void 0 : _currentNode$type.toDOM) === 'function') {
139
149
  var fallback = _model.DOMSerializer.renderSpec(document, currentNode.type.spec.toDOM(currentNode));
150
+ fallbackRef.current = fallback.dom;
140
151
  domRef.replaceChildren(fallback.dom);
141
152
  }
142
153
  }
@@ -145,7 +156,6 @@ function createNodeView(_ref) {
145
156
  if (domRef) {
146
157
  removeIntersectionObserver = observer.observe(domRef, function () {
147
158
  if (!didRenderComponentWithIntersectionObserver && !destroyed) {
148
- domRef.replaceChildren();
149
159
  renderComponent();
150
160
  didRenderComponentWithIntersectionObserver = true;
151
161
  }
@@ -243,6 +253,7 @@ function createNodeView(_ref) {
243
253
  // of HTMLSpanElement type however once the node view has
244
254
  // been destroyed no other consumers should still be using it.
245
255
  domRef = undefined;
256
+ fallbackRef.current = null;
246
257
  if (virtualizeNode) {
247
258
  destroyed = true;
248
259
  }
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "102.11.1";
26
+ var packageVersion = "102.11.3";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -15,6 +15,11 @@ export const pixelEntryMessages = defineMessages({
15
15
  defaultMessage: 'Max width {maxWidth}px',
16
16
  description: 'The width input aria label'
17
17
  },
18
+ inputWidthLabel: {
19
+ id: 'fabric.editor.media.pixelEntry.inputWidthLabel',
20
+ defaultMessage: 'Width',
21
+ description: 'The label displayed next to the width input'
22
+ },
18
23
  inputHeightTooltip: {
19
24
  id: 'fabric.editor.media.pixelEntry.inputHeightTooltip',
20
25
  defaultMessage: 'Height',
@@ -44,5 +49,10 @@ export const pixelEntryMessages = defineMessages({
44
49
  id: 'fabric.editor.media.pixelEntry.migrationButtonTooltip',
45
50
  defaultMessage: 'Migrate from percentage to fixed pixel sizing',
46
51
  description: 'The tooltip displayed on the migration button'
52
+ },
53
+ closePixelEntry: {
54
+ id: 'fabric.editor.media.pixelEntry.closePixelEntry',
55
+ defaultMessage: 'Close',
56
+ description: 'The text give to the close button used to close the pixel inputs and go back to main toolbar'
47
57
  }
48
58
  });
@@ -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 = "102.11.1";
4
+ const packageVersion = "102.11.3";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -1,4 +1,4 @@
1
- import React, { useLayoutEffect, useMemo, useState } from 'react';
1
+ import React, { memo, useLayoutEffect, useMemo, useState } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { PortalBucket } from './PortalBucket';
4
4
  export function createPortalRendererComponent(portalManager) {
@@ -22,6 +22,24 @@ export function createPortalRendererComponent(portalManager) {
22
22
  };
23
23
  }
24
24
 
25
+ /**
26
+ * Wraps the children of a portal to allow for React rendering
27
+ * lifecycle hook to be exposed, primarily for node virtualization.
28
+ */
29
+ export const PortalRenderWrapperInner = ({
30
+ getChildren,
31
+ onBeforeRender
32
+ }) => {
33
+ useLayoutEffect(() => {
34
+ if (onBeforeRender) {
35
+ onBeforeRender();
36
+ }
37
+ }, [onBeforeRender]);
38
+ return /*#__PURE__*/React.createElement(React.Fragment, null, getChildren());
39
+ };
40
+ const PortalRenderWrapper = /*#__PURE__*/memo(PortalRenderWrapperInner);
41
+ PortalRenderWrapper.displayName = 'PortalRenderWrapper';
42
+
25
43
  /**
26
44
  * Creates a portal provider for managing multiple React portals. The provider
27
45
  * facilitates rendering, removing, and destroying portals managed by a given
@@ -43,9 +61,17 @@ export function createPortalRendererComponent(portalManager) {
43
61
  export const getPortalProviderAPI = portalManager => {
44
62
  const portalsMap = new Map();
45
63
  return {
46
- render: (children, container, key) => {
47
- const portal = /*#__PURE__*/createPortal(children(), container, key);
48
- portalsMap.set(key, portalManager.registerPortal(key, portal));
64
+ render: (children, container, key, onBeforeReactDomRender) => {
65
+ if (typeof onBeforeReactDomRender === 'function') {
66
+ const portal = /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(PortalRenderWrapper, {
67
+ getChildren: children,
68
+ onBeforeRender: onBeforeReactDomRender
69
+ }), container, key);
70
+ portalsMap.set(key, portalManager.registerPortal(key, portal));
71
+ } else {
72
+ const portal = /*#__PURE__*/createPortal(children(), container, key);
73
+ portalsMap.set(key, portalManager.registerPortal(key, portal));
74
+ }
49
75
  },
50
76
  remove: key => {
51
77
  var _portalsMap$get;
@@ -2,5 +2,6 @@
2
2
  /* eslint-disable @atlaskit/editor/no-re-export */
3
3
 
4
4
  export { PortalManager } from './PortalManager';
5
+ export { PortalRenderWrapperInner } from './common';
5
6
  export { PortalBucket } from './PortalBucket';
6
7
  export { usePortalProvider } from './usePortalProvider';
@@ -90,12 +90,22 @@ function createNodeView({
90
90
  let domRef = document.createElement('span');
91
91
  domRef.contentEditable = 'false';
92
92
  setDomAttrs(nodeViewParams.node, domRef);
93
+ const fallbackRef = {
94
+ current: null
95
+ };
93
96
 
94
97
  // @see ED-3790
95
98
  // something gets messed up during mutation processing inside of a
96
99
  // nodeView if DOM structure has nested plain "div"s, it doesn't see the
97
100
  // difference between them and it kills the nodeView
98
101
  domRef.classList.add(`${nodeViewParams.node.type.name}View-content-wrap`, `${inlineNodeViewClassname}`);
102
+ function onBeforeReactDomRender() {
103
+ if (!fallbackRef.current) {
104
+ return;
105
+ }
106
+ domRef.removeChild(fallbackRef.current);
107
+ fallbackRef.current = null;
108
+ }
99
109
 
100
110
  // This util is shared for tracking rendering, and the ErrorBoundary that
101
111
  // is setup to wrap the Component when rendering
@@ -118,7 +128,7 @@ function createNodeView({
118
128
  nodeViewParams,
119
129
  Component,
120
130
  extraComponentProps
121
- }), domRef, key);
131
+ }), domRef, key, enableVirtualization ? onBeforeReactDomRender : undefined);
122
132
  }
123
133
  let didRenderComponentWithIntersectionObserver = false;
124
134
  let destroyed = false;
@@ -127,6 +137,7 @@ function createNodeView({
127
137
  var _currentNode$type, _currentNode$type$spe;
128
138
  if (canRenderFallback(currentNode) && typeof ((_currentNode$type = currentNode.type) === null || _currentNode$type === void 0 ? void 0 : (_currentNode$type$spe = _currentNode$type.spec) === null || _currentNode$type$spe === void 0 ? void 0 : _currentNode$type$spe.toDOM) === 'function') {
129
139
  const fallback = DOMSerializer.renderSpec(document, currentNode.type.spec.toDOM(currentNode));
140
+ fallbackRef.current = fallback.dom;
130
141
  domRef.replaceChildren(fallback.dom);
131
142
  }
132
143
  }
@@ -135,7 +146,6 @@ function createNodeView({
135
146
  if (domRef) {
136
147
  removeIntersectionObserver = observer.observe(domRef, () => {
137
148
  if (!didRenderComponentWithIntersectionObserver && !destroyed) {
138
- domRef.replaceChildren();
139
149
  renderComponent();
140
150
  didRenderComponentWithIntersectionObserver = true;
141
151
  }
@@ -237,6 +247,7 @@ function createNodeView({
237
247
  // of HTMLSpanElement type however once the node view has
238
248
  // been destroyed no other consumers should still be using it.
239
249
  domRef = undefined;
250
+ fallbackRef.current = null;
240
251
  if (virtualizeNode) {
241
252
  destroyed = true;
242
253
  }
@@ -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 = "102.11.1";
16
+ const packageVersion = "102.11.3";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -15,6 +15,11 @@ export var pixelEntryMessages = defineMessages({
15
15
  defaultMessage: 'Max width {maxWidth}px',
16
16
  description: 'The width input aria label'
17
17
  },
18
+ inputWidthLabel: {
19
+ id: 'fabric.editor.media.pixelEntry.inputWidthLabel',
20
+ defaultMessage: 'Width',
21
+ description: 'The label displayed next to the width input'
22
+ },
18
23
  inputHeightTooltip: {
19
24
  id: 'fabric.editor.media.pixelEntry.inputHeightTooltip',
20
25
  defaultMessage: 'Height',
@@ -44,5 +49,10 @@ export var pixelEntryMessages = defineMessages({
44
49
  id: 'fabric.editor.media.pixelEntry.migrationButtonTooltip',
45
50
  defaultMessage: 'Migrate from percentage to fixed pixel sizing',
46
51
  description: 'The tooltip displayed on the migration button'
52
+ },
53
+ closePixelEntry: {
54
+ id: 'fabric.editor.media.pixelEntry.closePixelEntry',
55
+ defaultMessage: 'Close',
56
+ description: 'The text give to the close button used to close the pixel inputs and go back to main toolbar'
47
57
  }
48
58
  });
@@ -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 = "102.11.1";
10
+ var packageVersion = "102.11.3";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -1,5 +1,5 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
- import React, { useLayoutEffect, useMemo, useState } from 'react';
2
+ import React, { memo, useLayoutEffect, useMemo, useState } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
4
  import { PortalBucket } from './PortalBucket';
5
5
  export function createPortalRendererComponent(portalManager) {
@@ -30,6 +30,23 @@ export function createPortalRendererComponent(portalManager) {
30
30
  };
31
31
  }
32
32
 
33
+ /**
34
+ * Wraps the children of a portal to allow for React rendering
35
+ * lifecycle hook to be exposed, primarily for node virtualization.
36
+ */
37
+ export var PortalRenderWrapperInner = function PortalRenderWrapperInner(_ref) {
38
+ var getChildren = _ref.getChildren,
39
+ onBeforeRender = _ref.onBeforeRender;
40
+ useLayoutEffect(function () {
41
+ if (onBeforeRender) {
42
+ onBeforeRender();
43
+ }
44
+ }, [onBeforeRender]);
45
+ return /*#__PURE__*/React.createElement(React.Fragment, null, getChildren());
46
+ };
47
+ var PortalRenderWrapper = /*#__PURE__*/memo(PortalRenderWrapperInner);
48
+ PortalRenderWrapper.displayName = 'PortalRenderWrapper';
49
+
33
50
  /**
34
51
  * Creates a portal provider for managing multiple React portals. The provider
35
52
  * facilitates rendering, removing, and destroying portals managed by a given
@@ -51,9 +68,17 @@ export function createPortalRendererComponent(portalManager) {
51
68
  export var getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
52
69
  var portalsMap = new Map();
53
70
  return {
54
- render: function render(children, container, key) {
55
- var portal = /*#__PURE__*/createPortal(children(), container, key);
56
- portalsMap.set(key, portalManager.registerPortal(key, portal));
71
+ render: function render(children, container, key, onBeforeReactDomRender) {
72
+ if (typeof onBeforeReactDomRender === 'function') {
73
+ var portal = /*#__PURE__*/createPortal( /*#__PURE__*/React.createElement(PortalRenderWrapper, {
74
+ getChildren: children,
75
+ onBeforeRender: onBeforeReactDomRender
76
+ }), container, key);
77
+ portalsMap.set(key, portalManager.registerPortal(key, portal));
78
+ } else {
79
+ var _portal = /*#__PURE__*/createPortal(children(), container, key);
80
+ portalsMap.set(key, portalManager.registerPortal(key, _portal));
81
+ }
57
82
  },
58
83
  remove: function remove(key) {
59
84
  var _portalsMap$get;
@@ -2,5 +2,6 @@
2
2
  /* eslint-disable @atlaskit/editor/no-re-export */
3
3
 
4
4
  export { PortalManager } from './PortalManager';
5
+ export { PortalRenderWrapperInner } from './common';
5
6
  export { PortalBucket } from './PortalBucket';
6
7
  export { usePortalProvider } from './usePortalProvider';
@@ -95,12 +95,22 @@ function createNodeView(_ref) {
95
95
  var domRef = document.createElement('span');
96
96
  domRef.contentEditable = 'false';
97
97
  setDomAttrs(nodeViewParams.node, domRef);
98
+ var fallbackRef = {
99
+ current: null
100
+ };
98
101
 
99
102
  // @see ED-3790
100
103
  // something gets messed up during mutation processing inside of a
101
104
  // nodeView if DOM structure has nested plain "div"s, it doesn't see the
102
105
  // difference between them and it kills the nodeView
103
106
  domRef.classList.add("".concat(nodeViewParams.node.type.name, "View-content-wrap"), "".concat(inlineNodeViewClassname));
107
+ function onBeforeReactDomRender() {
108
+ if (!fallbackRef.current) {
109
+ return;
110
+ }
111
+ domRef.removeChild(fallbackRef.current);
112
+ fallbackRef.current = null;
113
+ }
104
114
 
105
115
  // This util is shared for tracking rendering, and the ErrorBoundary that
106
116
  // is setup to wrap the Component when rendering
@@ -123,7 +133,7 @@ function createNodeView(_ref) {
123
133
  nodeViewParams: nodeViewParams,
124
134
  Component: Component,
125
135
  extraComponentProps: extraComponentProps
126
- }), domRef, key);
136
+ }), domRef, key, enableVirtualization ? onBeforeReactDomRender : undefined);
127
137
  }
128
138
  var didRenderComponentWithIntersectionObserver = false;
129
139
  var destroyed = false;
@@ -132,6 +142,7 @@ function createNodeView(_ref) {
132
142
  var _currentNode$type;
133
143
  if (canRenderFallback(currentNode) && typeof ((_currentNode$type = currentNode.type) === null || _currentNode$type === void 0 || (_currentNode$type = _currentNode$type.spec) === null || _currentNode$type === void 0 ? void 0 : _currentNode$type.toDOM) === 'function') {
134
144
  var fallback = DOMSerializer.renderSpec(document, currentNode.type.spec.toDOM(currentNode));
145
+ fallbackRef.current = fallback.dom;
135
146
  domRef.replaceChildren(fallback.dom);
136
147
  }
137
148
  }
@@ -140,7 +151,6 @@ function createNodeView(_ref) {
140
151
  if (domRef) {
141
152
  removeIntersectionObserver = observer.observe(domRef, function () {
142
153
  if (!didRenderComponentWithIntersectionObserver && !destroyed) {
143
- domRef.replaceChildren();
144
154
  renderComponent();
145
155
  didRenderComponentWithIntersectionObserver = true;
146
156
  }
@@ -238,6 +248,7 @@ function createNodeView(_ref) {
238
248
  // of HTMLSpanElement type however once the node view has
239
249
  // been destroyed no other consumers should still be using it.
240
250
  domRef = undefined;
251
+ fallbackRef.current = null;
241
252
  if (virtualizeNode) {
242
253
  destroyed = true;
243
254
  }
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "102.11.1";
23
+ var packageVersion = "102.11.3";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -14,6 +14,11 @@ export declare const pixelEntryMessages: {
14
14
  defaultMessage: string;
15
15
  description: string;
16
16
  };
17
+ inputWidthLabel: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
17
22
  inputHeightTooltip: {
18
23
  id: string;
19
24
  defaultMessage: string;
@@ -44,4 +49,9 @@ export declare const pixelEntryMessages: {
44
49
  defaultMessage: string;
45
50
  description: string;
46
51
  };
52
+ closePixelEntry: {
53
+ id: string;
54
+ defaultMessage: string;
55
+ description: string;
56
+ };
47
57
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type PortalManager } from './PortalManager';
3
- type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string) => void;
3
+ type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string, onBeforeReactDomRender?: () => void) => void;
4
4
  type RemoveFn = (key: string) => void;
5
5
  type DestoryFn = () => void;
6
6
  export interface PortalProviderAPI {
@@ -11,6 +11,14 @@ export interface PortalProviderAPI {
11
11
  export type PortalRendererComponent = () => JSX.Element;
12
12
  export type UsePortalProviderReturnType = [PortalProviderAPI, PortalRendererComponent];
13
13
  export declare function createPortalRendererComponent(portalManager: PortalManager): () => React.JSX.Element;
14
+ /**
15
+ * Wraps the children of a portal to allow for React rendering
16
+ * lifecycle hook to be exposed, primarily for node virtualization.
17
+ */
18
+ export declare const PortalRenderWrapperInner: ({ getChildren, onBeforeRender, }: {
19
+ getChildren: () => React.ReactNode;
20
+ onBeforeRender: () => void;
21
+ }) => React.JSX.Element;
14
22
  /**
15
23
  * Creates a portal provider for managing multiple React portals. The provider
16
24
  * facilitates rendering, removing, and destroying portals managed by a given
@@ -1,4 +1,5 @@
1
1
  export { PortalManager } from './PortalManager';
2
+ export { PortalRenderWrapperInner } from './common';
2
3
  export { PortalBucket } from './PortalBucket';
3
4
  export { usePortalProvider } from './usePortalProvider';
4
5
  export type { PortalProviderAPI } from './common';
@@ -14,6 +14,11 @@ export declare const pixelEntryMessages: {
14
14
  defaultMessage: string;
15
15
  description: string;
16
16
  };
17
+ inputWidthLabel: {
18
+ id: string;
19
+ defaultMessage: string;
20
+ description: string;
21
+ };
17
22
  inputHeightTooltip: {
18
23
  id: string;
19
24
  defaultMessage: string;
@@ -44,4 +49,9 @@ export declare const pixelEntryMessages: {
44
49
  defaultMessage: string;
45
50
  description: string;
46
51
  };
52
+ closePixelEntry: {
53
+ id: string;
54
+ defaultMessage: string;
55
+ description: string;
56
+ };
47
57
  };
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { type PortalManager } from './PortalManager';
3
- type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string) => void;
3
+ type RenderFn = (children: () => React.ReactChild | JSX.Element | null, container: HTMLElement, key: string, onBeforeReactDomRender?: () => void) => void;
4
4
  type RemoveFn = (key: string) => void;
5
5
  type DestoryFn = () => void;
6
6
  export interface PortalProviderAPI {
@@ -14,6 +14,14 @@ export type UsePortalProviderReturnType = [
14
14
  PortalRendererComponent
15
15
  ];
16
16
  export declare function createPortalRendererComponent(portalManager: PortalManager): () => React.JSX.Element;
17
+ /**
18
+ * Wraps the children of a portal to allow for React rendering
19
+ * lifecycle hook to be exposed, primarily for node virtualization.
20
+ */
21
+ export declare const PortalRenderWrapperInner: ({ getChildren, onBeforeRender, }: {
22
+ getChildren: () => React.ReactNode;
23
+ onBeforeRender: () => void;
24
+ }) => React.JSX.Element;
17
25
  /**
18
26
  * Creates a portal provider for managing multiple React portals. The provider
19
27
  * facilitates rendering, removing, and destroying portals managed by a given
@@ -1,4 +1,5 @@
1
1
  export { PortalManager } from './PortalManager';
2
+ export { PortalRenderWrapperInner } from './common';
2
3
  export { PortalBucket } from './PortalBucket';
3
4
  export { usePortalProvider } from './usePortalProvider';
4
5
  export type { PortalProviderAPI } from './common';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "102.11.1",
3
+ "version": "102.11.3",
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/"
@@ -152,7 +152,7 @@
152
152
  "@atlaskit/onboarding": "^13.0.0",
153
153
  "@atlaskit/platform-feature-flags": "^1.1.0",
154
154
  "@atlaskit/popper": "^7.0.0",
155
- "@atlaskit/primitives": "^14.1.0",
155
+ "@atlaskit/primitives": "^14.2.0",
156
156
  "@atlaskit/profilecard": "^23.4.0",
157
157
  "@atlaskit/section-message": "^8.2.0",
158
158
  "@atlaskit/smart-card": "^36.0.0",