@atlaskit/editor-common 114.33.0 → 114.33.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 +14 -0
- package/dist/cjs/extensibility/Extension/Extension/index.js +2 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/portal/common.js +11 -1
- package/dist/cjs/react-node-view/NodeViewContentHole.js +23 -0
- package/dist/cjs/react-node-view/index.js +20 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/extensibility/Extension/Extension/index.js +2 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/portal/common.js +9 -1
- package/dist/es2019/react-node-view/NodeViewContentHole.js +13 -0
- package/dist/es2019/react-node-view/index.js +14 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/extensibility/Extension/Extension/index.js +2 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/portal/common.js +11 -1
- package/dist/esm/react-node-view/NodeViewContentHole.js +15 -0
- package/dist/esm/react-node-view/index.js +14 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/react-node-view/NodeViewContentHole.d.ts +6 -0
- package/dist/types/react-node-view/index.d.ts +2 -1
- package/dist/types-ts4.5/react-node-view/NodeViewContentHole.d.ts +6 -0
- package/dist/types-ts4.5/react-node-view/index.d.ts +2 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 114.33.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`ed7459903c172`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ed7459903c172) -
|
|
8
|
+
Updated media to display correctly when ssr streaming is used.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 114.33.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 114.33.0
|
|
4
18
|
|
|
5
19
|
### Minor Changes
|
|
@@ -15,6 +15,7 @@ var _classnames2 = _interopRequireDefault(require("classnames"));
|
|
|
15
15
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
17
|
var _hooks = require("../../../hooks");
|
|
18
|
+
var _NodeViewContentHole = require("../../../react-node-view/NodeViewContentHole");
|
|
18
19
|
var _ui = require("../../../ui");
|
|
19
20
|
var _utils = require("../../../utils");
|
|
20
21
|
var _shouldExtensionBreakout = require("../../utils/should-extension-breakout");
|
|
@@ -221,7 +222,7 @@ function ExtensionWithPluginState(props) {
|
|
|
221
222
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
222
223
|
,
|
|
223
224
|
className: contentClassNames
|
|
224
|
-
}, (0, _react2.jsx)(
|
|
225
|
+
}, (0, _react2.jsx)(_NodeViewContentHole.NodeViewContentHole, {
|
|
225
226
|
ref: handleContentDOMRef
|
|
226
227
|
}))))));
|
|
227
228
|
}
|
|
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "114.
|
|
22
|
+
var packageVersion = "114.33.1";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -99,7 +99,17 @@ var getPortalProviderAPI = exports.getPortalProviderAPI = function getPortalProv
|
|
|
99
99
|
var renderToStaticMarkup = getRenderToStaticMarkup();
|
|
100
100
|
var Children = children;
|
|
101
101
|
html = renderToStaticMarkup( /*#__PURE__*/_react.default.createElement(Children, null));
|
|
102
|
-
} catch (
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
104
|
+
var _Array$from$find$repl, _Array$from$find;
|
|
105
|
+
// Extract the nodeView type name from container classes, e.g. "mediaSingleView-content-wrap" → "mediaSingle"
|
|
106
|
+
var nodeTypeName = (_Array$from$find$repl = (_Array$from$find = Array.from(container.classList).find(function (c) {
|
|
107
|
+
return c.endsWith('View-content-wrap');
|
|
108
|
+
})) === null || _Array$from$find === void 0 ? void 0 : _Array$from$find.replace('View-content-wrap', '')) !== null && _Array$from$find$repl !== void 0 ? _Array$from$find$repl : 'unknown';
|
|
109
|
+
// eslint-disable-next-line no-console
|
|
110
|
+
console.warn("[EditorSSR] Failed to render \"".concat(nodeTypeName, "\" nodeView to static markup during SSR streaming. ") + 'The container will be empty. This is likely caused by a React hook ' + '(e.g. useSharedPluginStateWithSelector, useIntl) that requires a context ' + "not available during renderToStaticMarkup. Ensure the nodeView's render() " + 'is wrapped with Context Providers, or that the hook has an SSR-safe fallback.', error);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
103
113
|
container.innerHTML = html;
|
|
104
114
|
} else {
|
|
105
115
|
if (typeof onBeforeReactDomRender === 'function') {
|
|
@@ -0,0 +1,23 @@
|
|
|
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.NodeViewContentHole = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
|
+
var _isSsr = require("../core-utils/is-ssr");
|
|
13
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
14
|
+
/**
|
|
15
|
+
* A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
|
|
16
|
+
* It forwards a ref to the underlying div element, which can be used to access the content DOM for rendering the NodeView's content.
|
|
17
|
+
*/
|
|
18
|
+
var NodeViewContentHole = exports.NodeViewContentHole = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
|
|
19
|
+
return /*#__PURE__*/_react.default.createElement("div", (0, _extends2.default)({}, props, {
|
|
20
|
+
ref: ref,
|
|
21
|
+
"data-ssr-content-dom-ref": (0, _isSsr.isSSR)() && (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? '' : undefined
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
@@ -4,6 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
+
Object.defineProperty(exports, "NodeViewContentHole", {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function get() {
|
|
10
|
+
return _NodeViewContentHole.NodeViewContentHole;
|
|
11
|
+
}
|
|
12
|
+
});
|
|
7
13
|
exports.default = void 0;
|
|
8
14
|
Object.defineProperty(exports, "getInlineNodeViewProducer", {
|
|
9
15
|
enumerable: true,
|
|
@@ -22,13 +28,16 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
22
28
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
23
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
24
30
|
var _react = _interopRequireDefault(require("react"));
|
|
31
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
25
32
|
var _analytics = require("../analytics");
|
|
33
|
+
var _coreUtils = require("../core-utils");
|
|
26
34
|
var _eventDispatcher = require("../event-dispatcher");
|
|
27
35
|
var _ErrorBoundary = require("../ui/ErrorBoundary");
|
|
28
36
|
var _utils = require("../utils");
|
|
29
37
|
var _analytics2 = require("../utils/analytics");
|
|
30
38
|
var _generateUniqueNodeKey = require("./generateUniqueNodeKey");
|
|
31
39
|
var _getInlineNodeViewProducer = require("./getInlineNodeViewProducer");
|
|
40
|
+
var _NodeViewContentHole = require("./NodeViewContentHole");
|
|
32
41
|
// Disable no-re-export rule for entry point files
|
|
33
42
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
34
43
|
var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
@@ -110,6 +119,17 @@ var ReactNodeView = exports.default = /*#__PURE__*/function () {
|
|
|
110
119
|
this.renderReactComponent(function () {
|
|
111
120
|
return _this2.render(_this2.reactComponentProps, _this2.handleRef);
|
|
112
121
|
});
|
|
122
|
+
|
|
123
|
+
// During SSR, renderToStaticMarkup + container.innerHTML (in portal) clobbers the
|
|
124
|
+
// contentDOMWrapper that was appended above. The React ref callback
|
|
125
|
+
// (forwardRef) never fires in renderToStaticMarkup, so contentDOM is
|
|
126
|
+
// left detached. Re-attach it by finding the marked SSR ref target.
|
|
127
|
+
if ((0, _coreUtils.isSSR)() && this.domRef && (0, _expValEquals.expValEquals)('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
128
|
+
var refTarget = this.domRef.querySelector('[data-ssr-content-dom-ref]');
|
|
129
|
+
if (refTarget) {
|
|
130
|
+
this.handleRef(refTarget);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
113
133
|
}
|
|
114
134
|
trackingEnabled && (0, _utils.stopMeasureReactNodeViewRendered)({
|
|
115
135
|
nodeTypeName: this.node.type.name,
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "114.
|
|
27
|
+
var packageVersion = "114.33.1";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -12,6 +12,7 @@ import classnames from 'classnames';
|
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
14
14
|
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
15
|
+
import { NodeViewContentHole } from '../../../react-node-view/NodeViewContentHole';
|
|
15
16
|
import { overflowShadow } from '../../../ui';
|
|
16
17
|
import { calculateBreakoutStyles } from '../../../utils';
|
|
17
18
|
import { shouldExtensionBreakout } from '../../utils/should-extension-breakout';
|
|
@@ -217,7 +218,7 @@ function ExtensionWithPluginState(props) {
|
|
|
217
218
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
218
219
|
,
|
|
219
220
|
className: contentClassNames
|
|
220
|
-
}, jsx(
|
|
221
|
+
}, jsx(NodeViewContentHole, {
|
|
221
222
|
ref: handleContentDOMRef
|
|
222
223
|
}))))));
|
|
223
224
|
}
|
|
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
|
|
|
4
4
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
5
5
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
6
6
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
7
|
-
const packageVersion = "114.
|
|
7
|
+
const packageVersion = "114.33.1";
|
|
8
8
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
9
9
|
// Remove URL as it has UGC
|
|
10
10
|
// Ignored via go/ees007
|
|
@@ -78,7 +78,15 @@ export const getPortalProviderAPI = portalManager => {
|
|
|
78
78
|
const renderToStaticMarkup = getRenderToStaticMarkup();
|
|
79
79
|
const Children = children;
|
|
80
80
|
html = renderToStaticMarkup( /*#__PURE__*/React.createElement(Children, null));
|
|
81
|
-
} catch {
|
|
81
|
+
} catch (error) {
|
|
82
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
83
|
+
var _Array$from$find$repl, _Array$from$find;
|
|
84
|
+
// Extract the nodeView type name from container classes, e.g. "mediaSingleView-content-wrap" → "mediaSingle"
|
|
85
|
+
const nodeTypeName = (_Array$from$find$repl = (_Array$from$find = Array.from(container.classList).find(c => c.endsWith('View-content-wrap'))) === null || _Array$from$find === void 0 ? void 0 : _Array$from$find.replace('View-content-wrap', '')) !== null && _Array$from$find$repl !== void 0 ? _Array$from$find$repl : 'unknown';
|
|
86
|
+
// eslint-disable-next-line no-console
|
|
87
|
+
console.warn(`[EditorSSR] Failed to render "${nodeTypeName}" nodeView to static markup during SSR streaming. ` + 'The container will be empty. This is likely caused by a React hook ' + '(e.g. useSharedPluginStateWithSelector, useIntl) that requires a context ' + "not available during renderToStaticMarkup. Ensure the nodeView's render() " + 'is wrapped with Context Providers, or that the hook has an SSR-safe fallback.', error);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
82
90
|
container.innerHTML = html;
|
|
83
91
|
} else {
|
|
84
92
|
if (typeof onBeforeReactDomRender === 'function') {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
import { isSSR } from '../core-utils/is-ssr';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
|
|
8
|
+
* It forwards a ref to the underlying div element, which can be used to access the content DOM for rendering the NodeView's content.
|
|
9
|
+
*/
|
|
10
|
+
export const NodeViewContentHole = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
11
|
+
ref: ref,
|
|
12
|
+
"data-ssr-content-dom-ref": isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? '' : undefined
|
|
13
|
+
})));
|
|
@@ -4,13 +4,16 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
4
4
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
8
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
9
|
+
import { isSSR } from '../core-utils';
|
|
8
10
|
import { createDispatch } from '../event-dispatcher';
|
|
9
11
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
10
12
|
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
11
13
|
import { analyticsEventKey } from '../utils/analytics';
|
|
12
14
|
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
13
15
|
export { getInlineNodeViewProducer, inlineNodeViewClassname } from './getInlineNodeViewProducer';
|
|
16
|
+
export { NodeViewContentHole } from './NodeViewContentHole';
|
|
14
17
|
export default class ReactNodeView {
|
|
15
18
|
constructor(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
16
19
|
// Spreading props to pass through dynamic component props
|
|
@@ -82,6 +85,17 @@ export default class ReactNodeView {
|
|
|
82
85
|
});
|
|
83
86
|
if (!shouldSkipInitRender) {
|
|
84
87
|
this.renderReactComponent(() => this.render(this.reactComponentProps, this.handleRef));
|
|
88
|
+
|
|
89
|
+
// During SSR, renderToStaticMarkup + container.innerHTML (in portal) clobbers the
|
|
90
|
+
// contentDOMWrapper that was appended above. The React ref callback
|
|
91
|
+
// (forwardRef) never fires in renderToStaticMarkup, so contentDOM is
|
|
92
|
+
// left detached. Re-attach it by finding the marked SSR ref target.
|
|
93
|
+
if (isSSR() && this.domRef && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
94
|
+
const refTarget = this.domRef.querySelector('[data-ssr-content-dom-ref]');
|
|
95
|
+
if (refTarget) {
|
|
96
|
+
this.handleRef(refTarget);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
85
99
|
}
|
|
86
100
|
trackingEnabled && stopMeasureReactNodeViewRendered({
|
|
87
101
|
nodeTypeName: this.node.type.name,
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "114.
|
|
17
|
+
const packageVersion = "114.33.1";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -17,6 +17,7 @@ import classnames from 'classnames';
|
|
|
17
17
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
18
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
19
19
|
import { useSharedPluginStateWithSelector } from '../../../hooks';
|
|
20
|
+
import { NodeViewContentHole } from '../../../react-node-view/NodeViewContentHole';
|
|
20
21
|
import { overflowShadow } from '../../../ui';
|
|
21
22
|
import { calculateBreakoutStyles } from '../../../utils';
|
|
22
23
|
import { shouldExtensionBreakout } from '../../utils/should-extension-breakout';
|
|
@@ -214,7 +215,7 @@ function ExtensionWithPluginState(props) {
|
|
|
214
215
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
215
216
|
,
|
|
216
217
|
className: contentClassNames
|
|
217
|
-
}, jsx(
|
|
218
|
+
}, jsx(NodeViewContentHole, {
|
|
218
219
|
ref: handleContentDOMRef
|
|
219
220
|
}))))));
|
|
220
221
|
}
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "114.
|
|
13
|
+
var packageVersion = "114.33.1";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -88,7 +88,17 @@ export var getPortalProviderAPI = function getPortalProviderAPI(portalManager) {
|
|
|
88
88
|
var renderToStaticMarkup = getRenderToStaticMarkup();
|
|
89
89
|
var Children = children;
|
|
90
90
|
html = renderToStaticMarkup( /*#__PURE__*/React.createElement(Children, null));
|
|
91
|
-
} catch (
|
|
91
|
+
} catch (error) {
|
|
92
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
93
|
+
var _Array$from$find$repl, _Array$from$find;
|
|
94
|
+
// Extract the nodeView type name from container classes, e.g. "mediaSingleView-content-wrap" → "mediaSingle"
|
|
95
|
+
var nodeTypeName = (_Array$from$find$repl = (_Array$from$find = Array.from(container.classList).find(function (c) {
|
|
96
|
+
return c.endsWith('View-content-wrap');
|
|
97
|
+
})) === null || _Array$from$find === void 0 ? void 0 : _Array$from$find.replace('View-content-wrap', '')) !== null && _Array$from$find$repl !== void 0 ? _Array$from$find$repl : 'unknown';
|
|
98
|
+
// eslint-disable-next-line no-console
|
|
99
|
+
console.warn("[EditorSSR] Failed to render \"".concat(nodeTypeName, "\" nodeView to static markup during SSR streaming. ") + 'The container will be empty. This is likely caused by a React hook ' + '(e.g. useSharedPluginStateWithSelector, useIntl) that requires a context ' + "not available during renderToStaticMarkup. Ensure the nodeView's render() " + 'is wrapped with Context Providers, or that the hook has an SSR-safe fallback.', error);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
92
102
|
container.innerHTML = html;
|
|
93
103
|
} else {
|
|
94
104
|
if (typeof onBeforeReactDomRender === 'function') {
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
|
+
import { isSSR } from '../core-utils/is-ssr';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
|
|
8
|
+
* It forwards a ref to the underlying div element, which can be used to access the content DOM for rendering the NodeView's content.
|
|
9
|
+
*/
|
|
10
|
+
export var NodeViewContentHole = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
11
|
+
return /*#__PURE__*/React.createElement("div", _extends({}, props, {
|
|
12
|
+
ref: ref,
|
|
13
|
+
"data-ssr-content-dom-ref": isSSR() && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true) ? '' : undefined
|
|
14
|
+
}));
|
|
15
|
+
});
|
|
@@ -6,13 +6,16 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
6
6
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
import { ACTION_SUBJECT, ACTION_SUBJECT_ID } from '../analytics';
|
|
11
|
+
import { isSSR } from '../core-utils';
|
|
10
12
|
import { createDispatch } from '../event-dispatcher';
|
|
11
13
|
import { ErrorBoundary } from '../ui/ErrorBoundary';
|
|
12
14
|
import { getPerformanceOptions, startMeasureReactNodeViewRendered, stopMeasureReactNodeViewRendered } from '../utils';
|
|
13
15
|
import { analyticsEventKey } from '../utils/analytics';
|
|
14
16
|
import { generateUniqueNodeKey } from './generateUniqueNodeKey';
|
|
15
17
|
export { getInlineNodeViewProducer, inlineNodeViewClassname } from './getInlineNodeViewProducer';
|
|
18
|
+
export { NodeViewContentHole } from './NodeViewContentHole';
|
|
16
19
|
var ReactNodeView = /*#__PURE__*/function () {
|
|
17
20
|
function ReactNodeView(_node, view, getPos, portalProviderAPI, eventDispatcher, reactComponentProps,
|
|
18
21
|
// Spreading props to pass through dynamic component props
|
|
@@ -92,6 +95,17 @@ var ReactNodeView = /*#__PURE__*/function () {
|
|
|
92
95
|
this.renderReactComponent(function () {
|
|
93
96
|
return _this2.render(_this2.reactComponentProps, _this2.handleRef);
|
|
94
97
|
});
|
|
98
|
+
|
|
99
|
+
// During SSR, renderToStaticMarkup + container.innerHTML (in portal) clobbers the
|
|
100
|
+
// contentDOMWrapper that was appended above. The React ref callback
|
|
101
|
+
// (forwardRef) never fires in renderToStaticMarkup, so contentDOM is
|
|
102
|
+
// left detached. Re-attach it by finding the marked SSR ref target.
|
|
103
|
+
if (isSSR() && this.domRef && expValEquals('platform_editor_editor_ssr_streaming', 'isEnabled', true)) {
|
|
104
|
+
var refTarget = this.domRef.querySelector('[data-ssr-content-dom-ref]');
|
|
105
|
+
if (refTarget) {
|
|
106
|
+
this.handleRef(refTarget);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
95
109
|
}
|
|
96
110
|
trackingEnabled && stopMeasureReactNodeViewRendered({
|
|
97
111
|
nodeTypeName: this.node.type.name,
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "114.
|
|
24
|
+
var packageVersion = "114.33.1";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
|
|
4
|
+
* It forwards a ref to the underlying div element, which can be used to access the content DOM for rendering the NodeView's content.
|
|
5
|
+
*/
|
|
6
|
+
export declare const NodeViewContentHole: ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;
|
|
@@ -7,6 +7,7 @@ import type { ForwardRef, getPosHandler, ProsemirrorGetPosHandler, ReactComponen
|
|
|
7
7
|
export type { getPosHandler, ReactComponentProps, shouldUpdate, ProsemirrorGetPosHandler, ForwardRef, };
|
|
8
8
|
export type { InlineNodeViewComponentProps } from './getInlineNodeViewProducer';
|
|
9
9
|
export { getInlineNodeViewProducer, inlineNodeViewClassname } from './getInlineNodeViewProducer';
|
|
10
|
+
export { NodeViewContentHole } from './NodeViewContentHole';
|
|
10
11
|
export default class ReactNodeView<P = ReactComponentProps> implements NodeView {
|
|
11
12
|
private domRef?;
|
|
12
13
|
private contentDOMWrapper?;
|
|
@@ -39,7 +40,7 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
|
|
|
39
40
|
contentDOM?: HTMLElement | null | undefined;
|
|
40
41
|
dom: HTMLElement;
|
|
41
42
|
} | undefined;
|
|
42
|
-
handleRef: (node:
|
|
43
|
+
handleRef: (node: Element | null) => void;
|
|
43
44
|
private _handleRef;
|
|
44
45
|
render(props: P, forwardRef?: ForwardRef): React.ReactElement<any> | null;
|
|
45
46
|
update(node: PMNode, decorations: ReadonlyArray<Decoration>, _innerDecorations?: DecorationSource, validUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type ForwardRefExoticComponent, type HTMLAttributes, type RefAttributes } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A component that serves as a placeholder for the content DOM of a ProseMirror NodeView.
|
|
4
|
+
* It forwards a ref to the underlying div element, which can be used to access the content DOM for rendering the NodeView's content.
|
|
5
|
+
*/
|
|
6
|
+
export declare const NodeViewContentHole: ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & RefAttributes<HTMLDivElement>>;
|
|
@@ -7,6 +7,7 @@ import type { ForwardRef, getPosHandler, ProsemirrorGetPosHandler, ReactComponen
|
|
|
7
7
|
export type { getPosHandler, ReactComponentProps, shouldUpdate, ProsemirrorGetPosHandler, ForwardRef, };
|
|
8
8
|
export type { InlineNodeViewComponentProps } from './getInlineNodeViewProducer';
|
|
9
9
|
export { getInlineNodeViewProducer, inlineNodeViewClassname } from './getInlineNodeViewProducer';
|
|
10
|
+
export { NodeViewContentHole } from './NodeViewContentHole';
|
|
10
11
|
export default class ReactNodeView<P = ReactComponentProps> implements NodeView {
|
|
11
12
|
private domRef?;
|
|
12
13
|
private contentDOMWrapper?;
|
|
@@ -39,7 +40,7 @@ export default class ReactNodeView<P = ReactComponentProps> implements NodeView
|
|
|
39
40
|
contentDOM?: HTMLElement | null | undefined;
|
|
40
41
|
dom: HTMLElement;
|
|
41
42
|
} | undefined;
|
|
42
|
-
handleRef: (node:
|
|
43
|
+
handleRef: (node: Element | null) => void;
|
|
43
44
|
private _handleRef;
|
|
44
45
|
render(props: P, forwardRef?: ForwardRef): React.ReactElement<any> | null;
|
|
45
46
|
update(node: PMNode, decorations: ReadonlyArray<Decoration>, _innerDecorations?: DecorationSource, validUpdate?: (currentNode: PMNode, newNode: PMNode) => boolean): boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "114.33.
|
|
3
|
+
"version": "114.33.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/"
|
|
@@ -57,20 +57,20 @@
|
|
|
57
57
|
"@atlaskit/editor-tables": "^2.10.0",
|
|
58
58
|
"@atlaskit/editor-toolbar": "^1.5.0",
|
|
59
59
|
"@atlaskit/editor-toolbar-model": "^0.5.0",
|
|
60
|
-
"@atlaskit/emoji": "^70.
|
|
60
|
+
"@atlaskit/emoji": "^70.9.0",
|
|
61
61
|
"@atlaskit/icon": "^34.6.0",
|
|
62
62
|
"@atlaskit/link": "^3.4.0",
|
|
63
63
|
"@atlaskit/link-datasource": "^5.2.0",
|
|
64
64
|
"@atlaskit/link-picker": "^5.1.0",
|
|
65
65
|
"@atlaskit/media-card": "^80.5.0",
|
|
66
|
-
"@atlaskit/media-client": "^36.
|
|
66
|
+
"@atlaskit/media-client": "^36.3.0",
|
|
67
67
|
"@atlaskit/media-client-react": "^5.1.0",
|
|
68
68
|
"@atlaskit/media-common": "^13.3.0",
|
|
69
69
|
"@atlaskit/media-file-preview": "^0.17.0",
|
|
70
70
|
"@atlaskit/media-picker": "^71.3.0",
|
|
71
71
|
"@atlaskit/media-ui": "^29.2.0",
|
|
72
72
|
"@atlaskit/media-viewer": "^53.2.0",
|
|
73
|
-
"@atlaskit/mention": "^
|
|
73
|
+
"@atlaskit/mention": "^26.0.0",
|
|
74
74
|
"@atlaskit/menu": "^8.5.0",
|
|
75
75
|
"@atlaskit/object": "^1.0.0",
|
|
76
76
|
"@atlaskit/onboarding": "^14.6.0",
|