@atlaskit/renderer 114.12.0 → 114.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +28 -0
- package/afm-jira/tsconfig.json +3 -0
- package/dist/cjs/react/nodes/mediaSingle/index.js +4 -2
- package/dist/cjs/react/nodes/table/colgroup.js +2 -5
- package/dist/cjs/react/nodes/table.js +2 -1
- package/dist/cjs/react/nodes/tableNew.js +4 -6
- package/dist/cjs/react/utils/EditorMediaClientProvider.js +23 -8
- package/dist/cjs/ui/Renderer/breakout-ssr.js +51 -49
- package/dist/cjs/ui/Renderer/index.js +11 -3
- package/dist/es2019/react/nodes/mediaSingle/index.js +4 -2
- package/dist/es2019/react/nodes/table/colgroup.js +2 -5
- package/dist/es2019/react/nodes/table.js +2 -1
- package/dist/es2019/react/nodes/tableNew.js +4 -6
- package/dist/es2019/react/utils/EditorMediaClientProvider.js +25 -10
- package/dist/es2019/ui/Renderer/breakout-ssr.js +51 -49
- package/dist/es2019/ui/Renderer/index.js +11 -3
- package/dist/esm/react/nodes/mediaSingle/index.js +4 -2
- package/dist/esm/react/nodes/table/colgroup.js +2 -5
- package/dist/esm/react/nodes/table.js +2 -1
- package/dist/esm/react/nodes/tableNew.js +4 -6
- package/dist/esm/react/utils/EditorMediaClientProvider.js +25 -10
- package/dist/esm/ui/Renderer/breakout-ssr.js +51 -49
- package/dist/esm/ui/Renderer/index.js +11 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ui/renderer-props.d.ts +6 -1
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/ui/renderer-props.d.ts +6 -1
- package/package.json +14 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 114.13.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#148846](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148846)
|
|
8
|
+
[`b98e0ab69e871`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b98e0ab69e871) -
|
|
9
|
+
Add new Renderer prop createSerializer to allow Confluence to implement progressive rendering of
|
|
10
|
+
ADF
|
|
11
|
+
(https://hello.atlassian.net/wiki/spaces/~lmarinov/pages/5177285037/COMPLEXIT+Progressive+rendering+of+ADF)
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
17
|
+
## 114.12.1
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#148000](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148000)
|
|
22
|
+
[`3dc4d377d546d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3dc4d377d546d) -
|
|
23
|
+
CONFCLOUD-81409 - speed up renderer media client under FG platform_editor_speedup_media_client
|
|
24
|
+
- [#148201](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148201)
|
|
25
|
+
[`8e811f1840de7`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8e811f1840de7) -
|
|
26
|
+
Either actively or pre-emptively fixes a bug with keyframe animations in CJS and ESM distribution
|
|
27
|
+
targets for packages using Compiled CSS-in-JS. This may not affect this package, but the change
|
|
28
|
+
was made so a future migration does not accidentally break it.
|
|
29
|
+
- Updated dependencies
|
|
30
|
+
|
|
3
31
|
## 114.12.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -13,6 +13,8 @@ var _react2 = require("@emotion/react");
|
|
|
13
13
|
var _reactIntlNext = require("react-intl-next");
|
|
14
14
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
15
15
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
16
|
+
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
17
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
18
|
var _style = require("../../../ui/Renderer/style");
|
|
17
19
|
var _AnnotationRangeContext = require("../../../ui/annotations/contexts/AnnotationRangeContext");
|
|
18
20
|
var _AnnotationHoverContext = require("../../../ui/annotations/contexts/AnnotationHoverContext");
|
|
@@ -139,7 +141,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
139
141
|
var padding = isFullPage ? _style.FullPagePadding * 2 : 0;
|
|
140
142
|
var calcDimensions = (0, _react.useCallback)(function (mediaContainerWidth) {
|
|
141
143
|
var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
142
|
-
var maxWidth = containerWidth;
|
|
144
|
+
var maxWidth = (0, _coreUtils.isSSR)() && widthAttr && (0, _platformFeatureFlags.fg)('platform_editor_fix_image_size_diff_during_ssr') ? Math.max(widthAttr, containerWidth) : containerWidth;
|
|
143
145
|
var maxHeight = height / width * maxWidth;
|
|
144
146
|
var cardDimensions = {
|
|
145
147
|
width: "".concat(maxWidth, "px"),
|
|
@@ -160,7 +162,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
160
162
|
cardDimensions: cardDimensions,
|
|
161
163
|
lineLength: lineLength
|
|
162
164
|
};
|
|
163
|
-
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width]);
|
|
165
|
+
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width, widthAttr]);
|
|
164
166
|
var originalDimensions = (0, _react.useMemo)(function () {
|
|
165
167
|
return {
|
|
166
168
|
width: width,
|
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.Colgroup = void 0;
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = _interopRequireDefault(require("react"));
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
12
11
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
12
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
@@ -199,9 +198,7 @@ var Colgroup = exports.Colgroup = function Colgroup(props) {
|
|
|
199
198
|
}
|
|
200
199
|
return /*#__PURE__*/_react.default.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/_react.default.createElement("col", {
|
|
201
200
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
202
|
-
style:
|
|
203
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
204
|
-
{
|
|
201
|
+
style: {
|
|
205
202
|
width: _editorSharedStyles.akEditorTableNumberColumnWidth
|
|
206
203
|
},
|
|
207
204
|
"data-test-id": 'num'
|
|
@@ -212,7 +209,7 @@ var Colgroup = exports.Colgroup = function Colgroup(props) {
|
|
|
212
209
|
// eslint-disable-next-line react/no-array-index-key, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
213
210
|
_react.default.createElement("col", {
|
|
214
211
|
key: idx,
|
|
215
|
-
style:
|
|
212
|
+
style: style
|
|
216
213
|
})
|
|
217
214
|
);
|
|
218
215
|
}));
|
|
@@ -14,6 +14,7 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
14
14
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
16
|
var _react = _interopRequireDefault(require("react"));
|
|
17
|
+
var _browser = require("@atlaskit/editor-common/browser");
|
|
17
18
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
18
19
|
var _ui = require("@atlaskit/editor-common/ui");
|
|
19
20
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -616,7 +617,7 @@ var TableWithShadows = (0, _ui.overflowShadow)(TableProcessor, {
|
|
|
616
617
|
});
|
|
617
618
|
var TableWithWidth = function TableWithWidth(props) {
|
|
618
619
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
619
|
-
if ((0, _platformFeatureFlags.fg)('platform-ssr-table-resize')) {
|
|
620
|
+
if (!_browser.browser.safari && (0, _platformFeatureFlags.fg)('platform-ssr-table-resize')) {
|
|
620
621
|
var _props$columnWidths;
|
|
621
622
|
var colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
|
|
622
623
|
return total + val;
|
|
@@ -343,7 +343,6 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
343
343
|
var _this$props = this.props,
|
|
344
344
|
isNumberColumnEnabled = _this$props.isNumberColumnEnabled,
|
|
345
345
|
layout = _this$props.layout,
|
|
346
|
-
renderWidth = _this$props.renderWidth,
|
|
347
346
|
columnWidths = _this$props.columnWidths,
|
|
348
347
|
stickyHeaders = _this$props.stickyHeaders,
|
|
349
348
|
tableNode = _this$props.tableNode,
|
|
@@ -379,7 +378,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
379
378
|
,
|
|
380
379
|
style: {
|
|
381
380
|
display: 'flex',
|
|
382
|
-
justifyContent:
|
|
381
|
+
justifyContent: "".concat(tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout)
|
|
383
382
|
}
|
|
384
383
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
385
384
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -387,7 +386,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
387
386
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
388
387
|
,
|
|
389
388
|
style: {
|
|
390
|
-
width: "min(calc(100cqw - ".concat(gutterPadding, "px) ").concat(tableWidthAttribute)
|
|
389
|
+
width: "min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(tableWidthAttribute, ")")
|
|
391
390
|
}
|
|
392
391
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
393
392
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -403,7 +402,6 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
403
402
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
404
403
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
405
404
|
className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
406
|
-
"data-number-column": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.isNumberColumnEnabled,
|
|
407
405
|
"data-layout": this.updatedLayout,
|
|
408
406
|
"data-testid": "table-container",
|
|
409
407
|
ref: this.props.handleRef
|
|
@@ -414,7 +412,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
414
412
|
"data-testid": "sticky-scrollbar-sentinel-top"
|
|
415
413
|
}), stickyHeaders && tableNode && tableCanBeSticky(tableNode, children) && /*#__PURE__*/_react.default.createElement(_sticky.StickyTable, {
|
|
416
414
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
417
|
-
renderWidth:
|
|
415
|
+
renderWidth: 0,
|
|
418
416
|
tableWidth: "inherit",
|
|
419
417
|
layout: layout,
|
|
420
418
|
handleRef: this.props.handleRef,
|
|
@@ -444,7 +442,7 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
444
442
|
columnWidths: columnWidths,
|
|
445
443
|
layout: layout,
|
|
446
444
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
447
|
-
renderWidth:
|
|
445
|
+
renderWidth: 0,
|
|
448
446
|
tableNode: tableNode,
|
|
449
447
|
rendererAppearance: rendererAppearance,
|
|
450
448
|
isInsideOfBlockNode: isInsideOfBlockNode,
|
|
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _mediaClientReact = require("@atlaskit/media-client-react");
|
|
12
12
|
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
13
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
14
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
14
15
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
16
|
var EditorMediaClientProvider = exports.EditorMediaClientProvider = function EditorMediaClientProvider(_ref) {
|
|
@@ -19,13 +20,14 @@ var EditorMediaClientProvider = exports.EditorMediaClientProvider = function Edi
|
|
|
19
20
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
20
21
|
mediaClientConfig = _useState2[0],
|
|
21
22
|
setMediaClientConfig = _useState2[1];
|
|
22
|
-
var
|
|
23
|
+
var oldMediaProvider = (0, _providerFactory.useProvider)('mediaProvider');
|
|
24
|
+
var mediaProvider = (0, _providerFactory.useProviderLayout)('mediaProvider');
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* If a mediaClientConfig is provided then we will force
|
|
26
28
|
* skip the mediaClient from context
|
|
27
29
|
*/
|
|
28
|
-
var shouldSkipContext = Boolean((ssr === null || ssr === void 0 ? void 0 : ssr.config) || mediaProvider);
|
|
30
|
+
var shouldSkipContext = Boolean((ssr === null || ssr === void 0 ? void 0 : ssr.config) || oldMediaProvider || mediaProvider);
|
|
29
31
|
var contextMediaClient = (0, _react.useContext)(_mediaClientReact.MediaClientContext);
|
|
30
32
|
|
|
31
33
|
// MediaClientProvider currently requires a mediaClientConfig
|
|
@@ -40,12 +42,25 @@ var EditorMediaClientProvider = exports.EditorMediaClientProvider = function Edi
|
|
|
40
42
|
// and provide a top level mediaClient context
|
|
41
43
|
// This is useful for testing and creating examples.
|
|
42
44
|
(0, _react.useEffect)(function () {
|
|
43
|
-
if (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
if (!(0, _platformFeatureFlags.fg)('platform_editor_speedup_media_client')) {
|
|
46
|
+
if (ssr !== null && ssr !== void 0 && ssr.config) {
|
|
47
|
+
setMediaClientConfig(ssr.config);
|
|
48
|
+
} else if (oldMediaProvider) {
|
|
49
|
+
oldMediaProvider.then(function (provider) {
|
|
50
|
+
setMediaClientConfig(provider.viewMediaClientConfig);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}, [oldMediaProvider, ssr]);
|
|
55
|
+
(0, _react.useLayoutEffect)(function () {
|
|
56
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_speedup_media_client')) {
|
|
57
|
+
if (ssr !== null && ssr !== void 0 && ssr.config) {
|
|
58
|
+
setMediaClientConfig(ssr.config);
|
|
59
|
+
} else if (mediaProvider) {
|
|
60
|
+
mediaProvider.then(function (provider) {
|
|
61
|
+
setMediaClientConfig(provider.viewMediaClientConfig);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
49
64
|
}
|
|
50
65
|
}, [mediaProvider, ssr]);
|
|
51
66
|
return /*#__PURE__*/_react.default.createElement(_mediaClientReact.MediaClientContext.Provider, {
|
|
@@ -51,7 +51,7 @@ var breakoutInlineScriptContext = exports.breakoutInlineScriptContext = "\n var
|
|
|
51
51
|
|
|
52
52
|
// Ignored via go/ees005
|
|
53
53
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
-
function applyBreakoutAfterSSR(id, breakoutConsts,
|
|
54
|
+
function applyBreakoutAfterSSR(id, breakoutConsts, shouldSkipBreakoutScript) {
|
|
55
55
|
var MEDIA_NODE_TYPE = 'mediaSingle';
|
|
56
56
|
var WIDE_LAYOUT_MODES = ['full-width', 'wide', 'custom'];
|
|
57
57
|
function findUp(element, condition) {
|
|
@@ -77,21 +77,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, isFeatureFlagEnabled) {
|
|
|
77
77
|
if (item.target.nodeType !== Node.ELEMENT_NODE) {
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
81
|
-
/**
|
|
82
|
-
* The mutation observer is only called once per added node.
|
|
83
|
-
* The above condition only deals with direct children of <div class="ak-renderer-document" />
|
|
84
|
-
* When it is initially called on the direct children, not all the sub children have loaded.
|
|
85
|
-
* So nested media elements which are not immediately loaded as sub children are not available in the above conditional.
|
|
86
|
-
* Thus adding this conditional to deal with all media elements directly.
|
|
87
|
-
*/
|
|
88
|
-
// Ignored via go/ees005
|
|
89
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
90
|
-
item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
|
|
91
|
-
// Ignored via go/ees005
|
|
92
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
93
|
-
applyMediaBreakout(item.target);
|
|
94
|
-
}
|
|
95
80
|
|
|
96
81
|
// Remove with feature gate 'platform-ssr-table-resize'
|
|
97
82
|
// Ignored via go/ees005
|
|
@@ -113,45 +98,62 @@ function applyBreakoutAfterSSR(id, breakoutConsts, isFeatureFlagEnabled) {
|
|
|
113
98
|
}
|
|
114
99
|
|
|
115
100
|
// When flag is on we are using CSS to calculate the table width thus don't need logic below to set the width and left.
|
|
116
|
-
if (
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
120
|
-
var rendererWidth = renderer.offsetWidth;
|
|
121
|
-
var effectiveWidth = rendererWidth - breakoutConsts.padding;
|
|
122
|
-
width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
|
|
123
|
-
} else if (resizedBreakout) {
|
|
124
|
-
width = breakoutConsts.calcBreakoutWithCustomWidth(mode, node.dataset.width || null,
|
|
125
|
-
// Ignored via go/ees005
|
|
126
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
127
|
-
renderer.offsetWidth);
|
|
128
|
-
} else {
|
|
129
|
-
// Ignored via go/ees005
|
|
130
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
131
|
-
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
132
|
-
}
|
|
133
|
-
if (node.style.width === width) {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
node.style.width = width;
|
|
101
|
+
if (shouldSkipBreakoutScript && node.classList.contains('pm-table-container')) {
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
137
104
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
//
|
|
141
|
-
|
|
105
|
+
// use breakout script for all other types of nodes
|
|
106
|
+
if (node.classList.contains('pm-table-container') && mode === 'custom') {
|
|
107
|
+
// Ignored via go/ees005
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
109
|
+
var rendererWidth = renderer.offsetWidth;
|
|
110
|
+
var effectiveWidth = rendererWidth - breakoutConsts.padding;
|
|
111
|
+
width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
|
|
112
|
+
} else if (resizedBreakout) {
|
|
113
|
+
width = breakoutConsts.calcBreakoutWithCustomWidth(mode, node.dataset.width || null,
|
|
142
114
|
// Ignored via go/ees005
|
|
143
115
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
116
|
+
renderer.offsetWidth);
|
|
117
|
+
} else {
|
|
118
|
+
// Ignored via go/ees005
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
120
|
+
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
121
|
+
}
|
|
122
|
+
if (node.style.width === width) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
node.style.width = width;
|
|
126
|
+
|
|
127
|
+
// Tables require some special logic, as they are not using common css transform approach,
|
|
128
|
+
// because it breaks with sticky headers. This logic is copied from a table node:
|
|
129
|
+
// https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
|
|
130
|
+
if (node.classList.contains('pm-table-container') &&
|
|
131
|
+
// Ignored via go/ees005
|
|
132
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
133
|
+
!renderer.classList.contains('is-full-width')) {
|
|
134
|
+
var lineLength = breakoutConsts.calcLineLength();
|
|
135
|
+
var left = lineLength / 2 - parseInt(width) / 2;
|
|
136
|
+
if (left < 0 && parseInt(width) > lineLength) {
|
|
137
|
+
node.style.left = left + 'px';
|
|
138
|
+
} else {
|
|
139
|
+
node.style.left = '';
|
|
152
140
|
}
|
|
153
141
|
}
|
|
154
142
|
});
|
|
143
|
+
} else if (
|
|
144
|
+
/**
|
|
145
|
+
* The mutation observer is only called once per added node.
|
|
146
|
+
* The above condition only deals with direct children of <div class="ak-renderer-document" />
|
|
147
|
+
* When it is initially called on the direct children, not all the sub children have loaded.
|
|
148
|
+
* So nested media elements which are not immediately loaded as sub children are not available in the above conditional.
|
|
149
|
+
* Thus adding this conditional to deal with all media elements directly.
|
|
150
|
+
*/
|
|
151
|
+
// Ignored via go/ees005
|
|
152
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
153
|
+
item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
|
|
154
|
+
// Ignored via go/ees005
|
|
155
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
156
|
+
applyMediaBreakout(item.target);
|
|
155
157
|
}
|
|
156
158
|
});
|
|
157
159
|
});
|
|
@@ -59,7 +59,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
59
59
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
60
60
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
61
61
|
var packageName = "@atlaskit/renderer";
|
|
62
|
-
var packageVersion = "114.
|
|
62
|
+
var packageVersion = "114.13.0";
|
|
63
63
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
64
64
|
containerName: 'ak-renderer-wrapper',
|
|
65
65
|
containerType: 'inline-size',
|
|
@@ -254,9 +254,17 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
254
254
|
}, [createRendererContext, providerFactory, _fireAnalyticsEvent]);
|
|
255
255
|
var serializer = (0, _react.useMemo)(function () {
|
|
256
256
|
var _props$startPos;
|
|
257
|
-
|
|
257
|
+
var init = deriveSerializerProps(_objectSpread(_objectSpread({}, props), {}, {
|
|
258
258
|
startPos: (_props$startPos = props.startPos) !== null && _props$startPos !== void 0 ? _props$startPos : 0
|
|
259
|
-
}))
|
|
259
|
+
}));
|
|
260
|
+
if ((0, _platformFeatureFlags.fg)('cc_complexit_fe_progressive_adf_rendering')) {
|
|
261
|
+
var _props$createSerializ;
|
|
262
|
+
var newSerializer = (_props$createSerializ = props.createSerializer) === null || _props$createSerializ === void 0 ? void 0 : _props$createSerializ.call(props, init);
|
|
263
|
+
if (newSerializer) {
|
|
264
|
+
return newSerializer;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
return new _.ReactSerializer(init);
|
|
260
268
|
}, [deriveSerializerProps, props]);
|
|
261
269
|
var localRef = (0, _react.useRef)(null);
|
|
262
270
|
var editorRef = props.innerRef || localRef;
|
|
@@ -10,6 +10,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
10
10
|
import { injectIntl } from 'react-intl-next';
|
|
11
11
|
import { MediaSingle as UIMediaSingle, WidthContext } from '@atlaskit/editor-common/ui';
|
|
12
12
|
import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
13
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
15
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
14
16
|
import { useAnnotationRangeDispatch } from '../../../ui/annotations/contexts/AnnotationRangeContext';
|
|
15
17
|
import { useAnnotationHoverDispatch } from '../../../ui/annotations/contexts/AnnotationHoverContext';
|
|
@@ -125,7 +127,7 @@ const MediaSingleWithChildren = props => {
|
|
|
125
127
|
const padding = isFullPage ? FullPagePadding * 2 : 0;
|
|
126
128
|
const calcDimensions = useCallback(mediaContainerWidth => {
|
|
127
129
|
const containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
128
|
-
const maxWidth = containerWidth;
|
|
130
|
+
const maxWidth = isSSR() && widthAttr && fg('platform_editor_fix_image_size_diff_during_ssr') ? Math.max(widthAttr, containerWidth) : containerWidth;
|
|
129
131
|
const maxHeight = height / width * maxWidth;
|
|
130
132
|
const cardDimensions = {
|
|
131
133
|
width: `${maxWidth}px`,
|
|
@@ -146,7 +148,7 @@ const MediaSingleWithChildren = props => {
|
|
|
146
148
|
cardDimensions,
|
|
147
149
|
lineLength
|
|
148
150
|
};
|
|
149
|
-
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width]);
|
|
151
|
+
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width, widthAttr]);
|
|
150
152
|
const originalDimensions = useMemo(() => ({
|
|
151
153
|
width,
|
|
152
154
|
height
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
4
3
|
import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
|
|
5
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -191,9 +190,7 @@ export const Colgroup = props => {
|
|
|
191
190
|
}
|
|
192
191
|
return /*#__PURE__*/React.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/React.createElement("col", {
|
|
193
192
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
194
|
-
style:
|
|
195
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
196
|
-
{
|
|
193
|
+
style: {
|
|
197
194
|
width: akEditorTableNumberColumnWidth
|
|
198
195
|
},
|
|
199
196
|
"data-test-id": 'num'
|
|
@@ -203,6 +200,6 @@ export const Colgroup = props => {
|
|
|
203
200
|
// eslint-disable-next-line react/no-array-index-key, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
204
201
|
React.createElement("col", {
|
|
205
202
|
key: idx,
|
|
206
|
-
style:
|
|
203
|
+
style: style
|
|
207
204
|
})));
|
|
208
205
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
import React from 'react';
|
|
4
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
4
5
|
import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
5
6
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
6
7
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -557,7 +558,7 @@ const TableWithShadows = overflowShadow(TableProcessor, {
|
|
|
557
558
|
});
|
|
558
559
|
const TableWithWidth = props => {
|
|
559
560
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
560
|
-
if (fg('platform-ssr-table-resize')) {
|
|
561
|
+
if (!browser.safari && fg('platform-ssr-table-resize')) {
|
|
561
562
|
var _props$columnWidths;
|
|
562
563
|
const colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce((total, val) => total + val, 0)) || 0;
|
|
563
564
|
if (colWidthsSum || props.allowTableResizing) {
|
|
@@ -288,7 +288,6 @@ export class TableContainer extends React.Component {
|
|
|
288
288
|
const {
|
|
289
289
|
isNumberColumnEnabled,
|
|
290
290
|
layout,
|
|
291
|
-
renderWidth,
|
|
292
291
|
columnWidths,
|
|
293
292
|
stickyHeaders,
|
|
294
293
|
tableNode,
|
|
@@ -327,7 +326,7 @@ export class TableContainer extends React.Component {
|
|
|
327
326
|
,
|
|
328
327
|
style: {
|
|
329
328
|
display: 'flex',
|
|
330
|
-
justifyContent:
|
|
329
|
+
justifyContent: `${tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout}`
|
|
331
330
|
}
|
|
332
331
|
}, /*#__PURE__*/React.createElement("div", {
|
|
333
332
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -335,7 +334,7 @@ export class TableContainer extends React.Component {
|
|
|
335
334
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
336
335
|
,
|
|
337
336
|
style: {
|
|
338
|
-
width: `min(calc(100cqw - ${gutterPadding}px) ${tableWidthAttribute}`
|
|
337
|
+
width: `min(calc(100cqw - ${gutterPadding}px), ${tableWidthAttribute})`
|
|
339
338
|
}
|
|
340
339
|
}, /*#__PURE__*/React.createElement("div", {
|
|
341
340
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -358,7 +357,6 @@ export class TableContainer extends React.Component {
|
|
|
358
357
|
}, /*#__PURE__*/React.createElement("div", {
|
|
359
358
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
360
359
|
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames || ''}`,
|
|
361
|
-
"data-number-column": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.isNumberColumnEnabled,
|
|
362
360
|
"data-layout": this.updatedLayout,
|
|
363
361
|
"data-testid": "table-container",
|
|
364
362
|
ref: this.props.handleRef
|
|
@@ -369,7 +367,7 @@ export class TableContainer extends React.Component {
|
|
|
369
367
|
"data-testid": "sticky-scrollbar-sentinel-top"
|
|
370
368
|
}), stickyHeaders && tableNode && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
|
|
371
369
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
372
|
-
renderWidth:
|
|
370
|
+
renderWidth: 0,
|
|
373
371
|
tableWidth: "inherit",
|
|
374
372
|
layout: layout,
|
|
375
373
|
handleRef: this.props.handleRef,
|
|
@@ -399,7 +397,7 @@ export class TableContainer extends React.Component {
|
|
|
399
397
|
columnWidths: columnWidths,
|
|
400
398
|
layout: layout,
|
|
401
399
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
402
|
-
renderWidth:
|
|
400
|
+
renderWidth: 0,
|
|
403
401
|
tableNode: tableNode,
|
|
404
402
|
rendererAppearance: rendererAppearance,
|
|
405
403
|
isInsideOfBlockNode: isInsideOfBlockNode,
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
1
|
+
import React, { useContext, useEffect, useLayoutEffect, useMemo, useState } from 'react';
|
|
2
2
|
import { MediaClientContext, getMediaClient } from '@atlaskit/media-client-react';
|
|
3
|
-
import { useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
3
|
+
import { useProviderLayout, useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
5
|
export const EditorMediaClientProvider = ({
|
|
5
6
|
children,
|
|
6
7
|
ssr
|
|
7
8
|
}) => {
|
|
8
9
|
const [mediaClientConfig, setMediaClientConfig] = useState();
|
|
9
|
-
const
|
|
10
|
+
const oldMediaProvider = useProvider('mediaProvider');
|
|
11
|
+
const mediaProvider = useProviderLayout('mediaProvider');
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* If a mediaClientConfig is provided then we will force
|
|
13
15
|
* skip the mediaClient from context
|
|
14
16
|
*/
|
|
15
|
-
const shouldSkipContext = Boolean((ssr === null || ssr === void 0 ? void 0 : ssr.config) || mediaProvider);
|
|
17
|
+
const shouldSkipContext = Boolean((ssr === null || ssr === void 0 ? void 0 : ssr.config) || oldMediaProvider || mediaProvider);
|
|
16
18
|
const contextMediaClient = useContext(MediaClientContext);
|
|
17
19
|
|
|
18
20
|
// MediaClientProvider currently requires a mediaClientConfig
|
|
@@ -25,12 +27,25 @@ export const EditorMediaClientProvider = ({
|
|
|
25
27
|
// and provide a top level mediaClient context
|
|
26
28
|
// This is useful for testing and creating examples.
|
|
27
29
|
useEffect(() => {
|
|
28
|
-
if (
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
if (!fg('platform_editor_speedup_media_client')) {
|
|
31
|
+
if (ssr !== null && ssr !== void 0 && ssr.config) {
|
|
32
|
+
setMediaClientConfig(ssr.config);
|
|
33
|
+
} else if (oldMediaProvider) {
|
|
34
|
+
oldMediaProvider.then(provider => {
|
|
35
|
+
setMediaClientConfig(provider.viewMediaClientConfig);
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}, [oldMediaProvider, ssr]);
|
|
40
|
+
useLayoutEffect(() => {
|
|
41
|
+
if (fg('platform_editor_speedup_media_client')) {
|
|
42
|
+
if (ssr !== null && ssr !== void 0 && ssr.config) {
|
|
43
|
+
setMediaClientConfig(ssr.config);
|
|
44
|
+
} else if (mediaProvider) {
|
|
45
|
+
mediaProvider.then(provider => {
|
|
46
|
+
setMediaClientConfig(provider.viewMediaClientConfig);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
34
49
|
}
|
|
35
50
|
}, [mediaProvider, ssr]);
|
|
36
51
|
return /*#__PURE__*/React.createElement(MediaClientContext.Provider, {
|
|
@@ -60,7 +60,7 @@ export const breakoutInlineScriptContext = `
|
|
|
60
60
|
|
|
61
61
|
// Ignored via go/ees005
|
|
62
62
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
-
function applyBreakoutAfterSSR(id, breakoutConsts,
|
|
63
|
+
function applyBreakoutAfterSSR(id, breakoutConsts, shouldSkipBreakoutScript) {
|
|
64
64
|
const MEDIA_NODE_TYPE = 'mediaSingle';
|
|
65
65
|
const WIDE_LAYOUT_MODES = ['full-width', 'wide', 'custom'];
|
|
66
66
|
function findUp(element, condition) {
|
|
@@ -86,21 +86,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, isFeatureFlagEnabled) {
|
|
|
86
86
|
if (item.target.nodeType !== Node.ELEMENT_NODE) {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
|
-
if (
|
|
90
|
-
/**
|
|
91
|
-
* The mutation observer is only called once per added node.
|
|
92
|
-
* The above condition only deals with direct children of <div class="ak-renderer-document" />
|
|
93
|
-
* When it is initially called on the direct children, not all the sub children have loaded.
|
|
94
|
-
* So nested media elements which are not immediately loaded as sub children are not available in the above conditional.
|
|
95
|
-
* Thus adding this conditional to deal with all media elements directly.
|
|
96
|
-
*/
|
|
97
|
-
// Ignored via go/ees005
|
|
98
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
99
|
-
item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
|
|
100
|
-
// Ignored via go/ees005
|
|
101
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
102
|
-
applyMediaBreakout(item.target);
|
|
103
|
-
}
|
|
104
89
|
|
|
105
90
|
// Remove with feature gate 'platform-ssr-table-resize'
|
|
106
91
|
// Ignored via go/ees005
|
|
@@ -122,45 +107,62 @@ function applyBreakoutAfterSSR(id, breakoutConsts, isFeatureFlagEnabled) {
|
|
|
122
107
|
}
|
|
123
108
|
|
|
124
109
|
// When flag is on we are using CSS to calculate the table width thus don't need logic below to set the width and left.
|
|
125
|
-
if (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
129
|
-
const rendererWidth = renderer.offsetWidth;
|
|
130
|
-
const effectiveWidth = rendererWidth - breakoutConsts.padding;
|
|
131
|
-
width = `${Math.min(parseInt(node.style.width), effectiveWidth)}px`;
|
|
132
|
-
} else if (resizedBreakout) {
|
|
133
|
-
width = breakoutConsts.calcBreakoutWithCustomWidth(mode, node.dataset.width || null,
|
|
134
|
-
// Ignored via go/ees005
|
|
135
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
136
|
-
renderer.offsetWidth);
|
|
137
|
-
} else {
|
|
138
|
-
// Ignored via go/ees005
|
|
139
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
140
|
-
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
141
|
-
}
|
|
142
|
-
if (node.style.width === width) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
node.style.width = width;
|
|
110
|
+
if (shouldSkipBreakoutScript && node.classList.contains('pm-table-container')) {
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
146
113
|
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
//
|
|
150
|
-
|
|
114
|
+
// use breakout script for all other types of nodes
|
|
115
|
+
if (node.classList.contains('pm-table-container') && mode === 'custom') {
|
|
116
|
+
// Ignored via go/ees005
|
|
117
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
118
|
+
const rendererWidth = renderer.offsetWidth;
|
|
119
|
+
const effectiveWidth = rendererWidth - breakoutConsts.padding;
|
|
120
|
+
width = `${Math.min(parseInt(node.style.width), effectiveWidth)}px`;
|
|
121
|
+
} else if (resizedBreakout) {
|
|
122
|
+
width = breakoutConsts.calcBreakoutWithCustomWidth(mode, node.dataset.width || null,
|
|
151
123
|
// Ignored via go/ees005
|
|
152
124
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
125
|
+
renderer.offsetWidth);
|
|
126
|
+
} else {
|
|
127
|
+
// Ignored via go/ees005
|
|
128
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
129
|
+
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
130
|
+
}
|
|
131
|
+
if (node.style.width === width) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
node.style.width = width;
|
|
135
|
+
|
|
136
|
+
// Tables require some special logic, as they are not using common css transform approach,
|
|
137
|
+
// because it breaks with sticky headers. This logic is copied from a table node:
|
|
138
|
+
// https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
|
|
139
|
+
if (node.classList.contains('pm-table-container') &&
|
|
140
|
+
// Ignored via go/ees005
|
|
141
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
142
|
+
!renderer.classList.contains('is-full-width')) {
|
|
143
|
+
const lineLength = breakoutConsts.calcLineLength();
|
|
144
|
+
const left = lineLength / 2 - parseInt(width) / 2;
|
|
145
|
+
if (left < 0 && parseInt(width) > lineLength) {
|
|
146
|
+
node.style.left = left + 'px';
|
|
147
|
+
} else {
|
|
148
|
+
node.style.left = '';
|
|
161
149
|
}
|
|
162
150
|
}
|
|
163
151
|
});
|
|
152
|
+
} else if (
|
|
153
|
+
/**
|
|
154
|
+
* The mutation observer is only called once per added node.
|
|
155
|
+
* The above condition only deals with direct children of <div class="ak-renderer-document" />
|
|
156
|
+
* When it is initially called on the direct children, not all the sub children have loaded.
|
|
157
|
+
* So nested media elements which are not immediately loaded as sub children are not available in the above conditional.
|
|
158
|
+
* Thus adding this conditional to deal with all media elements directly.
|
|
159
|
+
*/
|
|
160
|
+
// Ignored via go/ees005
|
|
161
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
162
|
+
item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
|
|
163
|
+
// Ignored via go/ees005
|
|
164
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
165
|
+
applyMediaBreakout(item.target);
|
|
164
166
|
}
|
|
165
167
|
});
|
|
166
168
|
});
|
|
@@ -46,7 +46,7 @@ import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
|
46
46
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
47
47
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
48
48
|
const packageName = "@atlaskit/renderer";
|
|
49
|
-
const packageVersion = "114.
|
|
49
|
+
const packageVersion = "114.13.0";
|
|
50
50
|
const setAsQueryContainerStyles = css({
|
|
51
51
|
containerName: 'ak-renderer-wrapper',
|
|
52
52
|
containerType: 'inline-size',
|
|
@@ -247,10 +247,18 @@ export const RendererFunctionalComponent = props => {
|
|
|
247
247
|
}, [createRendererContext, providerFactory, fireAnalyticsEvent]);
|
|
248
248
|
const serializer = useMemo(() => {
|
|
249
249
|
var _props$startPos;
|
|
250
|
-
|
|
250
|
+
const init = deriveSerializerProps({
|
|
251
251
|
...props,
|
|
252
252
|
startPos: (_props$startPos = props.startPos) !== null && _props$startPos !== void 0 ? _props$startPos : 0
|
|
253
|
-
})
|
|
253
|
+
});
|
|
254
|
+
if (fg('cc_complexit_fe_progressive_adf_rendering')) {
|
|
255
|
+
var _props$createSerializ;
|
|
256
|
+
const newSerializer = (_props$createSerializ = props.createSerializer) === null || _props$createSerializ === void 0 ? void 0 : _props$createSerializ.call(props, init);
|
|
257
|
+
if (newSerializer) {
|
|
258
|
+
return newSerializer;
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return new ReactSerializer(init);
|
|
254
262
|
}, [deriveSerializerProps, props]);
|
|
255
263
|
const localRef = useRef(null);
|
|
256
264
|
const editorRef = props.innerRef || localRef;
|
|
@@ -11,6 +11,8 @@ import { css, jsx } from '@emotion/react';
|
|
|
11
11
|
import { injectIntl } from 'react-intl-next';
|
|
12
12
|
import { MediaSingle as UIMediaSingle, WidthContext } from '@atlaskit/editor-common/ui';
|
|
13
13
|
import { akEditorFullWidthLayoutWidth, akEditorDefaultLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
14
|
+
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
16
|
import { FullPagePadding } from '../../../ui/Renderer/style';
|
|
15
17
|
import { useAnnotationRangeDispatch } from '../../../ui/annotations/contexts/AnnotationRangeContext';
|
|
16
18
|
import { useAnnotationHoverDispatch } from '../../../ui/annotations/contexts/AnnotationHoverContext';
|
|
@@ -128,7 +130,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
128
130
|
var padding = isFullPage ? FullPagePadding * 2 : 0;
|
|
129
131
|
var calcDimensions = useCallback(function (mediaContainerWidth) {
|
|
130
132
|
var containerWidth = getMediaContainerWidth(mediaContainerWidth, layout);
|
|
131
|
-
var maxWidth = containerWidth;
|
|
133
|
+
var maxWidth = isSSR() && widthAttr && fg('platform_editor_fix_image_size_diff_during_ssr') ? Math.max(widthAttr, containerWidth) : containerWidth;
|
|
132
134
|
var maxHeight = height / width * maxWidth;
|
|
133
135
|
var cardDimensions = {
|
|
134
136
|
width: "".concat(maxWidth, "px"),
|
|
@@ -149,7 +151,7 @@ var MediaSingleWithChildren = function MediaSingleWithChildren(props) {
|
|
|
149
151
|
cardDimensions: cardDimensions,
|
|
150
152
|
lineLength: lineLength
|
|
151
153
|
};
|
|
152
|
-
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width]);
|
|
154
|
+
}, [height, isFullWidth, isInsideOfBlockNode, layout, padding, rendererAppearance, width, widthAttr]);
|
|
153
155
|
var originalDimensions = useMemo(function () {
|
|
154
156
|
return {
|
|
155
157
|
width: width,
|
|
@@ -2,7 +2,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
3
|
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; }
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
5
|
import { tableCellBorderWidth, tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
7
6
|
import { akEditorTableNumberColumnWidth, akEditorTableLegacyCellMinWidth } from '@atlaskit/editor-shared-styles';
|
|
8
7
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -193,9 +192,7 @@ export var Colgroup = function Colgroup(props) {
|
|
|
193
192
|
}
|
|
194
193
|
return /*#__PURE__*/React.createElement("colgroup", null, isNumberColumnEnabled && /*#__PURE__*/React.createElement("col", {
|
|
195
194
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop, @atlaskit/ui-styling-standard/no-imported-style-values -- Ignored via go/DSP-18766
|
|
196
|
-
style:
|
|
197
|
-
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-imported-style-values
|
|
198
|
-
{
|
|
195
|
+
style: {
|
|
199
196
|
width: akEditorTableNumberColumnWidth
|
|
200
197
|
},
|
|
201
198
|
"data-test-id": 'num'
|
|
@@ -206,7 +203,7 @@ export var Colgroup = function Colgroup(props) {
|
|
|
206
203
|
// eslint-disable-next-line react/no-array-index-key, @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
207
204
|
React.createElement("col", {
|
|
208
205
|
key: idx,
|
|
209
|
-
style:
|
|
206
|
+
style: style
|
|
210
207
|
})
|
|
211
208
|
);
|
|
212
209
|
}));
|
|
@@ -12,6 +12,7 @@ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length)
|
|
|
12
12
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
13
13
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
14
14
|
import React from 'react';
|
|
15
|
+
import { browser } from '@atlaskit/editor-common/browser';
|
|
15
16
|
import { TableSharedCssClassName, tableMarginTop } from '@atlaskit/editor-common/styles';
|
|
16
17
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
17
18
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -611,7 +612,7 @@ var TableWithShadows = overflowShadow(TableProcessor, {
|
|
|
611
612
|
});
|
|
612
613
|
var TableWithWidth = function TableWithWidth(props) {
|
|
613
614
|
// eslint-disable-next-line @atlaskit/platform/ensure-feature-flag-prefix
|
|
614
|
-
if (fg('platform-ssr-table-resize')) {
|
|
615
|
+
if (!browser.safari && fg('platform-ssr-table-resize')) {
|
|
615
616
|
var _props$columnWidths;
|
|
616
617
|
var colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
|
|
617
618
|
return total + val;
|
|
@@ -337,7 +337,6 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
337
337
|
var _this$props = this.props,
|
|
338
338
|
isNumberColumnEnabled = _this$props.isNumberColumnEnabled,
|
|
339
339
|
layout = _this$props.layout,
|
|
340
|
-
renderWidth = _this$props.renderWidth,
|
|
341
340
|
columnWidths = _this$props.columnWidths,
|
|
342
341
|
stickyHeaders = _this$props.stickyHeaders,
|
|
343
342
|
tableNode = _this$props.tableNode,
|
|
@@ -373,7 +372,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
373
372
|
,
|
|
374
373
|
style: {
|
|
375
374
|
display: 'flex',
|
|
376
|
-
justifyContent:
|
|
375
|
+
justifyContent: "".concat(tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout)
|
|
377
376
|
}
|
|
378
377
|
}, /*#__PURE__*/React.createElement("div", {
|
|
379
378
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -381,7 +380,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
381
380
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop
|
|
382
381
|
,
|
|
383
382
|
style: {
|
|
384
|
-
width: "min(calc(100cqw - ".concat(gutterPadding, "px) ").concat(tableWidthAttribute)
|
|
383
|
+
width: "min(calc(100cqw - ".concat(gutterPadding, "px), ").concat(tableWidthAttribute, ")")
|
|
385
384
|
}
|
|
386
385
|
}, /*#__PURE__*/React.createElement("div", {
|
|
387
386
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
@@ -397,7 +396,6 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
397
396
|
}, /*#__PURE__*/React.createElement("div", {
|
|
398
397
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
399
398
|
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
400
|
-
"data-number-column": tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.isNumberColumnEnabled,
|
|
401
399
|
"data-layout": this.updatedLayout,
|
|
402
400
|
"data-testid": "table-container",
|
|
403
401
|
ref: this.props.handleRef
|
|
@@ -408,7 +406,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
408
406
|
"data-testid": "sticky-scrollbar-sentinel-top"
|
|
409
407
|
}), stickyHeaders && tableNode && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
|
|
410
408
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
411
|
-
renderWidth:
|
|
409
|
+
renderWidth: 0,
|
|
412
410
|
tableWidth: "inherit",
|
|
413
411
|
layout: layout,
|
|
414
412
|
handleRef: this.props.handleRef,
|
|
@@ -438,7 +436,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
438
436
|
columnWidths: columnWidths,
|
|
439
437
|
layout: layout,
|
|
440
438
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
441
|
-
renderWidth:
|
|
439
|
+
renderWidth: 0,
|
|
442
440
|
tableNode: tableNode,
|
|
443
441
|
rendererAppearance: rendererAppearance,
|
|
444
442
|
isInsideOfBlockNode: isInsideOfBlockNode,
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
-
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
2
|
+
import React, { useContext, useEffect, useLayoutEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { MediaClientContext, getMediaClient } from '@atlaskit/media-client-react';
|
|
4
|
-
import { useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
4
|
+
import { useProviderLayout, useProvider } from '@atlaskit/editor-common/provider-factory';
|
|
5
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
6
|
export var EditorMediaClientProvider = function EditorMediaClientProvider(_ref) {
|
|
6
7
|
var children = _ref.children,
|
|
7
8
|
ssr = _ref.ssr;
|
|
@@ -9,13 +10,14 @@ export var EditorMediaClientProvider = function EditorMediaClientProvider(_ref)
|
|
|
9
10
|
_useState2 = _slicedToArray(_useState, 2),
|
|
10
11
|
mediaClientConfig = _useState2[0],
|
|
11
12
|
setMediaClientConfig = _useState2[1];
|
|
12
|
-
var
|
|
13
|
+
var oldMediaProvider = useProvider('mediaProvider');
|
|
14
|
+
var mediaProvider = useProviderLayout('mediaProvider');
|
|
13
15
|
|
|
14
16
|
/**
|
|
15
17
|
* If a mediaClientConfig is provided then we will force
|
|
16
18
|
* skip the mediaClient from context
|
|
17
19
|
*/
|
|
18
|
-
var shouldSkipContext = Boolean((ssr === null || ssr === void 0 ? void 0 : ssr.config) || mediaProvider);
|
|
20
|
+
var shouldSkipContext = Boolean((ssr === null || ssr === void 0 ? void 0 : ssr.config) || oldMediaProvider || mediaProvider);
|
|
19
21
|
var contextMediaClient = useContext(MediaClientContext);
|
|
20
22
|
|
|
21
23
|
// MediaClientProvider currently requires a mediaClientConfig
|
|
@@ -30,12 +32,25 @@ export var EditorMediaClientProvider = function EditorMediaClientProvider(_ref)
|
|
|
30
32
|
// and provide a top level mediaClient context
|
|
31
33
|
// This is useful for testing and creating examples.
|
|
32
34
|
useEffect(function () {
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
35
|
+
if (!fg('platform_editor_speedup_media_client')) {
|
|
36
|
+
if (ssr !== null && ssr !== void 0 && ssr.config) {
|
|
37
|
+
setMediaClientConfig(ssr.config);
|
|
38
|
+
} else if (oldMediaProvider) {
|
|
39
|
+
oldMediaProvider.then(function (provider) {
|
|
40
|
+
setMediaClientConfig(provider.viewMediaClientConfig);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}, [oldMediaProvider, ssr]);
|
|
45
|
+
useLayoutEffect(function () {
|
|
46
|
+
if (fg('platform_editor_speedup_media_client')) {
|
|
47
|
+
if (ssr !== null && ssr !== void 0 && ssr.config) {
|
|
48
|
+
setMediaClientConfig(ssr.config);
|
|
49
|
+
} else if (mediaProvider) {
|
|
50
|
+
mediaProvider.then(function (provider) {
|
|
51
|
+
setMediaClientConfig(provider.viewMediaClientConfig);
|
|
52
|
+
});
|
|
53
|
+
}
|
|
39
54
|
}
|
|
40
55
|
}, [mediaProvider, ssr]);
|
|
41
56
|
return /*#__PURE__*/React.createElement(MediaClientContext.Provider, {
|
|
@@ -42,7 +42,7 @@ export var breakoutInlineScriptContext = "\n var breakoutConsts = ".concat(JSON
|
|
|
42
42
|
|
|
43
43
|
// Ignored via go/ees005
|
|
44
44
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
45
|
-
function applyBreakoutAfterSSR(id, breakoutConsts,
|
|
45
|
+
function applyBreakoutAfterSSR(id, breakoutConsts, shouldSkipBreakoutScript) {
|
|
46
46
|
var MEDIA_NODE_TYPE = 'mediaSingle';
|
|
47
47
|
var WIDE_LAYOUT_MODES = ['full-width', 'wide', 'custom'];
|
|
48
48
|
function findUp(element, condition) {
|
|
@@ -68,21 +68,6 @@ function applyBreakoutAfterSSR(id, breakoutConsts, isFeatureFlagEnabled) {
|
|
|
68
68
|
if (item.target.nodeType !== Node.ELEMENT_NODE) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
|
-
if (
|
|
72
|
-
/**
|
|
73
|
-
* The mutation observer is only called once per added node.
|
|
74
|
-
* The above condition only deals with direct children of <div class="ak-renderer-document" />
|
|
75
|
-
* When it is initially called on the direct children, not all the sub children have loaded.
|
|
76
|
-
* So nested media elements which are not immediately loaded as sub children are not available in the above conditional.
|
|
77
|
-
* Thus adding this conditional to deal with all media elements directly.
|
|
78
|
-
*/
|
|
79
|
-
// Ignored via go/ees005
|
|
80
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
81
|
-
item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
|
|
82
|
-
// Ignored via go/ees005
|
|
83
|
-
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
84
|
-
applyMediaBreakout(item.target);
|
|
85
|
-
}
|
|
86
71
|
|
|
87
72
|
// Remove with feature gate 'platform-ssr-table-resize'
|
|
88
73
|
// Ignored via go/ees005
|
|
@@ -104,45 +89,62 @@ function applyBreakoutAfterSSR(id, breakoutConsts, isFeatureFlagEnabled) {
|
|
|
104
89
|
}
|
|
105
90
|
|
|
106
91
|
// When flag is on we are using CSS to calculate the table width thus don't need logic below to set the width and left.
|
|
107
|
-
if (
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
111
|
-
var rendererWidth = renderer.offsetWidth;
|
|
112
|
-
var effectiveWidth = rendererWidth - breakoutConsts.padding;
|
|
113
|
-
width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
|
|
114
|
-
} else if (resizedBreakout) {
|
|
115
|
-
width = breakoutConsts.calcBreakoutWithCustomWidth(mode, node.dataset.width || null,
|
|
116
|
-
// Ignored via go/ees005
|
|
117
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
118
|
-
renderer.offsetWidth);
|
|
119
|
-
} else {
|
|
120
|
-
// Ignored via go/ees005
|
|
121
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
122
|
-
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
123
|
-
}
|
|
124
|
-
if (node.style.width === width) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
node.style.width = width;
|
|
92
|
+
if (shouldSkipBreakoutScript && node.classList.contains('pm-table-container')) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
128
95
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
//
|
|
132
|
-
|
|
96
|
+
// use breakout script for all other types of nodes
|
|
97
|
+
if (node.classList.contains('pm-table-container') && mode === 'custom') {
|
|
98
|
+
// Ignored via go/ees005
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
100
|
+
var rendererWidth = renderer.offsetWidth;
|
|
101
|
+
var effectiveWidth = rendererWidth - breakoutConsts.padding;
|
|
102
|
+
width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
|
|
103
|
+
} else if (resizedBreakout) {
|
|
104
|
+
width = breakoutConsts.calcBreakoutWithCustomWidth(mode, node.dataset.width || null,
|
|
133
105
|
// Ignored via go/ees005
|
|
134
106
|
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
107
|
+
renderer.offsetWidth);
|
|
108
|
+
} else {
|
|
109
|
+
// Ignored via go/ees005
|
|
110
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
111
|
+
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
112
|
+
}
|
|
113
|
+
if (node.style.width === width) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
node.style.width = width;
|
|
117
|
+
|
|
118
|
+
// Tables require some special logic, as they are not using common css transform approach,
|
|
119
|
+
// because it breaks with sticky headers. This logic is copied from a table node:
|
|
120
|
+
// https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
|
|
121
|
+
if (node.classList.contains('pm-table-container') &&
|
|
122
|
+
// Ignored via go/ees005
|
|
123
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
124
|
+
!renderer.classList.contains('is-full-width')) {
|
|
125
|
+
var lineLength = breakoutConsts.calcLineLength();
|
|
126
|
+
var left = lineLength / 2 - parseInt(width) / 2;
|
|
127
|
+
if (left < 0 && parseInt(width) > lineLength) {
|
|
128
|
+
node.style.left = left + 'px';
|
|
129
|
+
} else {
|
|
130
|
+
node.style.left = '';
|
|
143
131
|
}
|
|
144
132
|
}
|
|
145
133
|
});
|
|
134
|
+
} else if (
|
|
135
|
+
/**
|
|
136
|
+
* The mutation observer is only called once per added node.
|
|
137
|
+
* The above condition only deals with direct children of <div class="ak-renderer-document" />
|
|
138
|
+
* When it is initially called on the direct children, not all the sub children have loaded.
|
|
139
|
+
* So nested media elements which are not immediately loaded as sub children are not available in the above conditional.
|
|
140
|
+
* Thus adding this conditional to deal with all media elements directly.
|
|
141
|
+
*/
|
|
142
|
+
// Ignored via go/ees005
|
|
143
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
144
|
+
item.target.dataset.nodeType === MEDIA_NODE_TYPE) {
|
|
145
|
+
// Ignored via go/ees005
|
|
146
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
147
|
+
applyMediaBreakout(item.target);
|
|
146
148
|
}
|
|
147
149
|
});
|
|
148
150
|
});
|
|
@@ -49,7 +49,7 @@ import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
|
49
49
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
50
50
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
51
51
|
var packageName = "@atlaskit/renderer";
|
|
52
|
-
var packageVersion = "114.
|
|
52
|
+
var packageVersion = "114.13.0";
|
|
53
53
|
var setAsQueryContainerStyles = css({
|
|
54
54
|
containerName: 'ak-renderer-wrapper',
|
|
55
55
|
containerType: 'inline-size',
|
|
@@ -244,9 +244,17 @@ export var RendererFunctionalComponent = function RendererFunctionalComponent(pr
|
|
|
244
244
|
}, [createRendererContext, providerFactory, _fireAnalyticsEvent]);
|
|
245
245
|
var serializer = useMemo(function () {
|
|
246
246
|
var _props$startPos;
|
|
247
|
-
|
|
247
|
+
var init = deriveSerializerProps(_objectSpread(_objectSpread({}, props), {}, {
|
|
248
248
|
startPos: (_props$startPos = props.startPos) !== null && _props$startPos !== void 0 ? _props$startPos : 0
|
|
249
|
-
}))
|
|
249
|
+
}));
|
|
250
|
+
if (fg('cc_complexit_fe_progressive_adf_rendering')) {
|
|
251
|
+
var _props$createSerializ;
|
|
252
|
+
var newSerializer = (_props$createSerializ = props.createSerializer) === null || _props$createSerializ === void 0 ? void 0 : _props$createSerializ.call(props, init);
|
|
253
|
+
if (newSerializer) {
|
|
254
|
+
return newSerializer;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
return new ReactSerializer(init);
|
|
250
258
|
}, [deriveSerializerProps, props]);
|
|
251
259
|
var localRef = useRef(null);
|
|
252
260
|
var editorRef = props.innerRef || localRef;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as ReactSerializer } from './react';
|
|
1
|
+
export { default as ReactSerializer, type ReactSerializerInit } from './react';
|
|
2
2
|
export { default as TextSerializer } from './text';
|
|
3
3
|
export { default as ReactRenderer, RendererWithAnalytics } from './ui/Renderer';
|
|
4
4
|
export { nodeToReact as defaultNodeComponents } from './react/nodes';
|
|
@@ -9,7 +9,7 @@ import type { UnsupportedContentLevelsTracking } from '@atlaskit/editor-common/u
|
|
|
9
9
|
import type { ADFStage } from '@atlaskit/editor-common/validator';
|
|
10
10
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
11
11
|
import type { EmojiResourceConfig } from '@atlaskit/emoji/resource';
|
|
12
|
-
import type { RendererContext } from '../';
|
|
12
|
+
import type { ReactSerializerInit, RendererContext, Serializer } from '../';
|
|
13
13
|
import type { TextHighlighter, ExtensionViewportSize } from '../react/types';
|
|
14
14
|
import type { RenderOutputStat } from '../render-document';
|
|
15
15
|
import type { MediaOptions } from '../types/mediaOptions';
|
|
@@ -121,5 +121,10 @@ export interface RendererProps {
|
|
|
121
121
|
UNSTABLE_textHighlighter?: TextHighlighter;
|
|
122
122
|
UNSTABLE_allowTableAlignment?: boolean;
|
|
123
123
|
UNSTABLE_allowTableResizing?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new `Serializer` to transform the ADF `document` into `JSX.Element`.
|
|
126
|
+
* Allows Confluence to implement {@link https://hello.atlassian.net/wiki/spaces/~lmarinov/pages/5177285037/COMPLEXIT+Progressive+rendering+of+ADF progressive rendering}.
|
|
127
|
+
*/
|
|
128
|
+
createSerializer?(init: ReactSerializerInit): Serializer<JSX.Element> | null;
|
|
124
129
|
}
|
|
125
130
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as ReactSerializer } from './react';
|
|
1
|
+
export { default as ReactSerializer, type ReactSerializerInit } from './react';
|
|
2
2
|
export { default as TextSerializer } from './text';
|
|
3
3
|
export { default as ReactRenderer, RendererWithAnalytics } from './ui/Renderer';
|
|
4
4
|
export { nodeToReact as defaultNodeComponents } from './react/nodes';
|
|
@@ -9,7 +9,7 @@ import type { UnsupportedContentLevelsTracking } from '@atlaskit/editor-common/u
|
|
|
9
9
|
import type { ADFStage } from '@atlaskit/editor-common/validator';
|
|
10
10
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
11
11
|
import type { EmojiResourceConfig } from '@atlaskit/emoji/resource';
|
|
12
|
-
import type { RendererContext } from '../';
|
|
12
|
+
import type { ReactSerializerInit, RendererContext, Serializer } from '../';
|
|
13
13
|
import type { TextHighlighter, ExtensionViewportSize } from '../react/types';
|
|
14
14
|
import type { RenderOutputStat } from '../render-document';
|
|
15
15
|
import type { MediaOptions } from '../types/mediaOptions';
|
|
@@ -121,5 +121,10 @@ export interface RendererProps {
|
|
|
121
121
|
UNSTABLE_textHighlighter?: TextHighlighter;
|
|
122
122
|
UNSTABLE_allowTableAlignment?: boolean;
|
|
123
123
|
UNSTABLE_allowTableResizing?: boolean;
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new `Serializer` to transform the ADF `document` into `JSX.Element`.
|
|
126
|
+
* Allows Confluence to implement {@link https://hello.atlassian.net/wiki/spaces/~lmarinov/pages/5177285037/COMPLEXIT+Progressive+rendering+of+ADF progressive rendering}.
|
|
127
|
+
*/
|
|
128
|
+
createSerializer?(init: ReactSerializerInit): Serializer<JSX.Element> | null;
|
|
124
129
|
}
|
|
125
130
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "114.
|
|
3
|
+
"version": "114.13.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,16 +31,16 @@
|
|
|
31
31
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
32
32
|
"@atlaskit/button": "^23.0.0",
|
|
33
33
|
"@atlaskit/code": "^17.1.0",
|
|
34
|
-
"@atlaskit/editor-common": "^103.
|
|
34
|
+
"@atlaskit/editor-common": "^103.22.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
39
39
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
40
40
|
"@atlaskit/emoji": "^69.1.0",
|
|
41
|
-
"@atlaskit/feature-gate-js-client": "^5.
|
|
41
|
+
"@atlaskit/feature-gate-js-client": "^5.3.0",
|
|
42
42
|
"@atlaskit/icon": "^25.6.0",
|
|
43
|
-
"@atlaskit/link-datasource": "^4.
|
|
43
|
+
"@atlaskit/link-datasource": "^4.9.0",
|
|
44
44
|
"@atlaskit/media-card": "^79.2.0",
|
|
45
45
|
"@atlaskit/media-client": "^32.0.0",
|
|
46
46
|
"@atlaskit/media-client-react": "^4.0.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
52
52
|
"@atlaskit/platform-feature-flags-react": "^0.1.0",
|
|
53
53
|
"@atlaskit/react-ufo": "^3.9.0",
|
|
54
|
-
"@atlaskit/smart-card": "^36.
|
|
54
|
+
"@atlaskit/smart-card": "^36.13.0",
|
|
55
55
|
"@atlaskit/status": "^3.0.0",
|
|
56
56
|
"@atlaskit/task-decision": "^19.2.0",
|
|
57
57
|
"@atlaskit/theme": "^18.0.0",
|
|
@@ -133,6 +133,9 @@
|
|
|
133
133
|
"platform_renderer_annotations_create_debug_logging": {
|
|
134
134
|
"type": "boolean"
|
|
135
135
|
},
|
|
136
|
+
"platform_editor_speedup_media_client": {
|
|
137
|
+
"type": "boolean"
|
|
138
|
+
},
|
|
136
139
|
"platform_editor_annotation_position_comment_nodes": {
|
|
137
140
|
"type": "boolean"
|
|
138
141
|
},
|
|
@@ -160,9 +163,6 @@
|
|
|
160
163
|
"platform_editor_hyperlink_underline": {
|
|
161
164
|
"type": "boolean"
|
|
162
165
|
},
|
|
163
|
-
"platform_editor_react18_renderer": {
|
|
164
|
-
"type": "boolean"
|
|
165
|
-
},
|
|
166
166
|
"confluence-frontend-comments-panel": {
|
|
167
167
|
"type": "boolean"
|
|
168
168
|
},
|
|
@@ -226,6 +226,9 @@
|
|
|
226
226
|
"cc_complexit_fe_memoValidation_redundant_calls": {
|
|
227
227
|
"type": "boolean"
|
|
228
228
|
},
|
|
229
|
+
"cc_complexit_fe_progressive_adf_rendering": {
|
|
230
|
+
"type": "boolean"
|
|
231
|
+
},
|
|
229
232
|
"platform_ssr_smartlink_embeds": {
|
|
230
233
|
"type": "boolean"
|
|
231
234
|
},
|
|
@@ -237,6 +240,9 @@
|
|
|
237
240
|
},
|
|
238
241
|
"sticky_header_in_embedded_confluence_fix": {
|
|
239
242
|
"type": "boolean"
|
|
243
|
+
},
|
|
244
|
+
"platform_editor_fix_image_size_diff_during_ssr": {
|
|
245
|
+
"type": "boolean"
|
|
240
246
|
}
|
|
241
247
|
},
|
|
242
248
|
"af:exports": {
|