@atlaskit/renderer 114.12.1 → 114.13.1
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 +23 -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/ui/Renderer/breakout-ssr.js +51 -49
- package/dist/cjs/ui/Renderer/index.js +9 -8
- package/dist/cjs/ui/Renderer/useMemoFromPropsDerivative.js +57 -0
- 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/ui/Renderer/breakout-ssr.js +51 -49
- package/dist/es2019/ui/Renderer/index.js +7 -9
- package/dist/es2019/ui/Renderer/useMemoFromPropsDerivative.js +44 -0
- 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/ui/Renderer/breakout-ssr.js +51 -49
- package/dist/esm/ui/Renderer/index.js +9 -8
- package/dist/esm/ui/Renderer/useMemoFromPropsDerivative.js +50 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/ui/Renderer/useMemoFromPropsDerivative.d.ts +1 -0
- 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/useMemoFromPropsDerivative.d.ts +1 -0
- package/dist/types-ts4.5/ui/renderer-props.d.ts +6 -1
- package/package.json +14 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 114.13.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#148536](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148536)
|
|
8
|
+
[`da7c16d27cfcc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/da7c16d27cfcc) -
|
|
9
|
+
Update fragment serializer logic
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 114.13.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#148846](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/148846)
|
|
17
|
+
[`b98e0ab69e871`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b98e0ab69e871) -
|
|
18
|
+
Add new Renderer prop createSerializer to allow Confluence to implement progressive rendering of
|
|
19
|
+
ADF
|
|
20
|
+
(https://hello.atlassian.net/wiki/spaces/~lmarinov/pages/5177285037/COMPLEXIT+Progressive+rendering+of+ADF)
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 114.12.1
|
|
4
27
|
|
|
5
28
|
### Patch 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,
|
|
@@ -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
|
});
|
|
@@ -48,6 +48,7 @@ var _ValidationContext = require("./ValidationContext");
|
|
|
48
48
|
var _RendererStyleContainer = require("./RendererStyleContainer");
|
|
49
49
|
var _getBaseFontSize = require("./get-base-font-size");
|
|
50
50
|
var _rendererHelper = require("./rendererHelper");
|
|
51
|
+
var _useMemoFromPropsDerivative = require("./useMemoFromPropsDerivative");
|
|
51
52
|
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); }
|
|
52
53
|
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; }
|
|
53
54
|
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; }
|
|
@@ -59,7 +60,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
59
60
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
60
61
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
61
62
|
var packageName = "@atlaskit/renderer";
|
|
62
|
-
var packageVersion = "114.
|
|
63
|
+
var packageVersion = "114.13.1";
|
|
63
64
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
64
65
|
containerName: 'ak-renderer-wrapper',
|
|
65
66
|
containerType: 'inline-size',
|
|
@@ -207,13 +208,14 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
207
208
|
exposure: true
|
|
208
209
|
}) ? fireAnalyticsEventNew : fireAnalyticsEventOld;
|
|
209
210
|
var deriveSerializerProps = (0, _react.useCallback)(function (props) {
|
|
211
|
+
var _props$startPos;
|
|
210
212
|
var stickyHeaders = props.stickyHeaders ? props.stickyHeaders === true ? {} : props.stickyHeaders : undefined;
|
|
211
213
|
var annotationProvider = props.annotationProvider;
|
|
212
214
|
var allowAnnotationsDraftMode = Boolean(annotationProvider && annotationProvider.inlineComment && annotationProvider.inlineComment.allowDraftMode);
|
|
213
215
|
var _createRendererContex = createRendererContext(props.featureFlags, props.isTopLevelRenderer),
|
|
214
216
|
featureFlags = _createRendererContex.featureFlags;
|
|
215
217
|
return {
|
|
216
|
-
startPos: props.startPos,
|
|
218
|
+
startPos: (_props$startPos = props.startPos) !== null && _props$startPos !== void 0 ? _props$startPos : 0,
|
|
217
219
|
providers: providerFactory,
|
|
218
220
|
eventHandlers: props.eventHandlers,
|
|
219
221
|
extensionHandlers: props.extensionHandlers,
|
|
@@ -252,12 +254,11 @@ var RendererFunctionalComponent = exports.RendererFunctionalComponent = function
|
|
|
252
254
|
allowTableResizing: props.UNSTABLE_allowTableResizing
|
|
253
255
|
};
|
|
254
256
|
}, [createRendererContext, providerFactory, _fireAnalyticsEvent]);
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
}, [deriveSerializerProps, props]);
|
|
257
|
+
|
|
258
|
+
// Abstract out the logic into its own function
|
|
259
|
+
var serializer = (0, _useMemoFromPropsDerivative.useMemoFromPropsDerivative)(function (serializerProps) {
|
|
260
|
+
return new _.ReactSerializer(serializerProps);
|
|
261
|
+
}, deriveSerializerProps, props);
|
|
261
262
|
var localRef = (0, _react.useRef)(null);
|
|
262
263
|
var editorRef = props.innerRef || localRef;
|
|
263
264
|
var id = (0, _react.useMemo)(function () {
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useMemoFromPropsDerivative = useMemoFromPropsDerivative;
|
|
8
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
9
|
+
var _react = require("react");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
function useMemoFromPropsDerivative(factory, propsDerivator, props) {
|
|
12
|
+
// cache the last set of props
|
|
13
|
+
var prev = (0, _react.useRef)(props);
|
|
14
|
+
var prevFactory = (0, _react.useRef)(null);
|
|
15
|
+
return (0, _react.useMemo)(function () {
|
|
16
|
+
var init = propsDerivator(props);
|
|
17
|
+
if ((0, _platformFeatureFlags.fg)('cc_complexit_fe_reduce_fragment_serialization')) {
|
|
18
|
+
// check if the serializer is already created
|
|
19
|
+
var shouldCreate = !prevFactory.current;
|
|
20
|
+
// check each prop to see if value has changed and also check if the number of props has changed
|
|
21
|
+
if (prev.current !== props) {
|
|
22
|
+
// @ts-ignore - error TS2769: No overload matches this call.
|
|
23
|
+
var propsEntries = Object.entries(props);
|
|
24
|
+
// Break these into its own const to skip TS checks.
|
|
25
|
+
// @ts-ignore - error TS2769: No overload matches this call.
|
|
26
|
+
var isLengthDifferent = propsEntries.length !== Object.keys(prev.current).length;
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
var isValueDifferent = propsEntries.some(function (_ref) {
|
|
29
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
30
|
+
key = _ref2[0],
|
|
31
|
+
prop = _ref2[1];
|
|
32
|
+
return prev.current[key] !== prop;
|
|
33
|
+
});
|
|
34
|
+
shouldCreate = isLengthDifferent || isValueDifferent;
|
|
35
|
+
}
|
|
36
|
+
prev.current = props;
|
|
37
|
+
// If first time or any prop value has changed, create a new serializer
|
|
38
|
+
if (shouldCreate) {
|
|
39
|
+
prevFactory.current = factory(init);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// If progressive rendering is enabled, create a new serializer
|
|
44
|
+
if ((0, _platformFeatureFlags.fg)('cc_complexit_fe_progressive_adf_rendering')) {
|
|
45
|
+
var _props$createSerializ;
|
|
46
|
+
// @ts-ignore - erorr TS2339 Property 'createSerializer' does not exist on type 'Props'.
|
|
47
|
+
var newSerializer = (_props$createSerializ = props.createSerializer) === null || _props$createSerializ === void 0 ? void 0 : _props$createSerializ.call(props, init);
|
|
48
|
+
if (newSerializer) {
|
|
49
|
+
return newSerializer;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return (0, _platformFeatureFlags.fg)('cc_complexit_fe_reduce_fragment_serialization') ? prevFactory.current : factory(init);
|
|
53
|
+
},
|
|
54
|
+
// To keep deps consistent, here disable the exhaustive-deps rule to drop factory from the deps array
|
|
55
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
56
|
+
[propsDerivator, props]);
|
|
57
|
+
}
|
|
@@ -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,
|