@atlaskit/renderer 108.11.13 → 108.11.15
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 +15 -2
- package/dist/cjs/react/nodes/table.js +45 -17
- package/dist/cjs/ui/Renderer/breakout-ssr.js +12 -4
- package/dist/cjs/ui/Renderer/index.js +3 -2
- package/dist/es2019/react/nodes/table.js +31 -5
- package/dist/es2019/ui/Renderer/breakout-ssr.js +12 -4
- package/dist/es2019/ui/Renderer/index.js +3 -2
- package/dist/esm/react/nodes/table.js +46 -19
- package/dist/esm/ui/Renderer/breakout-ssr.js +12 -4
- package/dist/esm/ui/Renderer/index.js +3 -2
- package/dist/types/react/nodes/index.d.ts +1 -1
- package/dist/types-ts4.5/react/nodes/index.d.ts +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 108.11.15
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`2325dd0eb57`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2325dd0eb57) - fix width issue on initial load
|
|
8
|
+
|
|
9
|
+
## 108.11.14
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`aeb5c9a01e8`](https://bitbucket.org/atlassian/atlassian-frontend/commits/aeb5c9a01e8) - Delete adf-schema from AFE and rely on npm package for adf-schema
|
|
14
|
+
- [`4b4dcfe0bba`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4b4dcfe0bba) - Delete adf-schema, use published version
|
|
15
|
+
|
|
3
16
|
## 108.11.13
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -4927,14 +4940,14 @@ Remove applicationCard node and action mark
|
|
|
4927
4940
|
|
|
4928
4941
|
## 29.2.2
|
|
4929
4942
|
|
|
4930
|
-
- [patch][f3d067d
|
|
4943
|
+
- [patch][f3d067d](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/f3d067d"
|
|
4931
4944
|
d):
|
|
4932
4945
|
|
|
4933
4946
|
- Fix font size for numbered column in tables with dynamic text sizing
|
|
4934
4947
|
|
|
4935
4948
|
## 29.2.1
|
|
4936
4949
|
|
|
4937
|
-
- [patch][8636991
|
|
4950
|
+
- [patch][8636991](https://bitbucket.org/atlassian/atlaskit-mk-2/commits/8636991"
|
|
4938
4951
|
d):
|
|
4939
4952
|
|
|
4940
4953
|
- ED-5518: fix numbered column with merged rows
|
|
@@ -300,8 +300,20 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
300
300
|
var lineLength = _editorSharedStyles.akEditorDefaultLayoutWidth;
|
|
301
301
|
var tableWidth;
|
|
302
302
|
var left;
|
|
303
|
+
var updatedLayout;
|
|
304
|
+
|
|
305
|
+
// The tableWidth and left offset logic below must stay aligned with the `breakout-ssr.tsx` logic
|
|
306
|
+
// Please consider changes below carefully to not negatively impact SSR
|
|
307
|
+
// `renderWidth` cannot be depended on during SSR
|
|
308
|
+
var isRenderWidthValid = !!renderWidth && renderWidth > 0;
|
|
303
309
|
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(tableNode, rendererAppearance) {
|
|
304
|
-
|
|
310
|
+
if (rendererAppearance === 'full-width' && !tableNode.attrs.width) {
|
|
311
|
+
return isRenderWidthValid ? Math.min(_editorSharedStyles.akEditorFullWidthLayoutWidth, renderWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
312
|
+
} else {
|
|
313
|
+
// custom width, or width mapped to breakpoint
|
|
314
|
+
var tableContainerWidth = (0, _nodeWidth.getTableContainerWidth)(tableNode);
|
|
315
|
+
return isRenderWidthValid ? Math.min(tableContainerWidth, renderWidth) : tableContainerWidth;
|
|
316
|
+
}
|
|
305
317
|
};
|
|
306
318
|
if (isTableResizingEnabled(rendererAppearance) && tableNode) {
|
|
307
319
|
tableWidth = calcDefaultLayoutWidthByAppearance(tableNode, rendererAppearance);
|
|
@@ -312,6 +324,18 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
312
324
|
left = lineLength / 2 - tableWidth / 2;
|
|
313
325
|
}
|
|
314
326
|
var children = _react.default.Children.toArray(this.props.children);
|
|
327
|
+
|
|
328
|
+
// Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
|
|
329
|
+
// This check caters for those tables and helps with SSR logic
|
|
330
|
+
var isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
|
|
331
|
+
var hasCustomWidth = isTableResizingEnabled(rendererAppearance) && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width);
|
|
332
|
+
if (isFullWidth) {
|
|
333
|
+
updatedLayout = 'full-width';
|
|
334
|
+
} else if (hasCustomWidth) {
|
|
335
|
+
updatedLayout = 'custom';
|
|
336
|
+
} else {
|
|
337
|
+
updatedLayout = layout;
|
|
338
|
+
}
|
|
315
339
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !(0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') && stickyHeaders && tableCanBeSticky(tableNode, children) && /*#__PURE__*/_react.default.createElement(_sticky.StickyTable, {
|
|
316
340
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
317
341
|
tableWidth: tableWidth,
|
|
@@ -329,7 +353,7 @@ var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
329
353
|
rendererAppearance: rendererAppearance
|
|
330
354
|
}, [children && children[0]]), /*#__PURE__*/_react.default.createElement("div", {
|
|
331
355
|
className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
332
|
-
"data-layout":
|
|
356
|
+
"data-layout": updatedLayout,
|
|
333
357
|
ref: this.props.handleRef,
|
|
334
358
|
style: {
|
|
335
359
|
width: tableWidth,
|
|
@@ -435,23 +459,27 @@ var TableWithShadows = (0, _ui.overflowShadow)(TableProcessor, {
|
|
|
435
459
|
useShadowObserver: true
|
|
436
460
|
});
|
|
437
461
|
var TableWithWidth = function TableWithWidth(props) {
|
|
438
|
-
return
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
462
|
+
return (
|
|
463
|
+
/*#__PURE__*/
|
|
464
|
+
// Remember, `width` will be 0 during SSR
|
|
465
|
+
_react.default.createElement(_ui.WidthConsumer, null, function (_ref2) {
|
|
466
|
+
var _props$columnWidths;
|
|
467
|
+
var width = _ref2.width;
|
|
468
|
+
var renderWidth = props.rendererAppearance === 'full-page' ? width - _style.FullPagePadding * 2 : width;
|
|
469
|
+
var colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
|
|
470
|
+
return total + val;
|
|
471
|
+
}, 0)) || 0;
|
|
472
|
+
if (colWidthsSum || (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width-scale-down-undefined-column_nkyvx') && isTableResizingEnabled(props.rendererAppearance)) {
|
|
473
|
+
return /*#__PURE__*/_react.default.createElement(TableWithShadows, (0, _extends2.default)({
|
|
474
|
+
renderWidth: renderWidth
|
|
475
|
+
}, props));
|
|
476
|
+
}
|
|
477
|
+
// there should not be a case when colWidthsSum is 0 and table is in overflow state - so no need to render shadows in this case
|
|
478
|
+
return /*#__PURE__*/_react.default.createElement(TableProcessor, (0, _extends2.default)({
|
|
447
479
|
renderWidth: renderWidth
|
|
448
480
|
}, props));
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
return /*#__PURE__*/_react.default.createElement(TableProcessor, (0, _extends2.default)({
|
|
452
|
-
renderWidth: renderWidth
|
|
453
|
-
}, props));
|
|
454
|
-
});
|
|
481
|
+
})
|
|
482
|
+
);
|
|
455
483
|
};
|
|
456
484
|
var _default = (0, _SmartCardStorage.withSmartCardStorage)(TableWithWidth);
|
|
457
485
|
exports.default = _default;
|
|
@@ -42,7 +42,7 @@ var breakoutInlineScriptContext = "\n var breakoutConsts = ".concat(JSON.string
|
|
|
42
42
|
exports.breakoutInlineScriptContext = breakoutInlineScriptContext;
|
|
43
43
|
function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
44
44
|
var MEDIA_NODE_TYPE = 'mediaSingle';
|
|
45
|
-
var WIDE_LAYOUT_MODES = ['full-width', 'wide'];
|
|
45
|
+
var WIDE_LAYOUT_MODES = ['full-width', 'wide', 'custom'];
|
|
46
46
|
function findUp(element, condition) {
|
|
47
47
|
if (!element) {
|
|
48
48
|
return;
|
|
@@ -68,12 +68,18 @@ function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
|
68
68
|
}
|
|
69
69
|
if (item.target.classList.contains('ak-renderer-document')) {
|
|
70
70
|
item.addedNodes.forEach(function (maybeNode) {
|
|
71
|
+
var width;
|
|
71
72
|
var node = maybeNode;
|
|
72
73
|
var mode = node.dataset.mode || node.dataset.layout || '';
|
|
73
74
|
if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
|
|
74
75
|
return;
|
|
75
76
|
}
|
|
76
|
-
|
|
77
|
+
if (node.classList.contains('pm-table-container') && mode === 'custom') {
|
|
78
|
+
var effectiveWidth = renderer.offsetWidth - breakoutConsts.padding;
|
|
79
|
+
width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
|
|
80
|
+
} else {
|
|
81
|
+
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
82
|
+
}
|
|
77
83
|
if (node.style.width === width) {
|
|
78
84
|
return;
|
|
79
85
|
}
|
|
@@ -82,11 +88,13 @@ function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
|
82
88
|
// Tables require some special logic, as they are not using common css transform approach,
|
|
83
89
|
// because it breaks with sticky headers. This logic is copied from a table node:
|
|
84
90
|
// https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
|
|
85
|
-
if (node.classList.contains('pm-table-container')) {
|
|
91
|
+
if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
|
|
86
92
|
var lineLength = breakoutConsts.calcLineLength();
|
|
87
93
|
var left = lineLength / 2 - parseInt(width) / 2;
|
|
88
|
-
if (left < 0) {
|
|
94
|
+
if (left < 0 && parseInt(width) > lineLength) {
|
|
89
95
|
node.style.left = left + 'px';
|
|
96
|
+
} else {
|
|
97
|
+
node.style.left = '';
|
|
90
98
|
}
|
|
91
99
|
}
|
|
92
100
|
});
|
|
@@ -55,7 +55,7 @@ exports.NORMAL_SEVERITY_THRESHOLD = NORMAL_SEVERITY_THRESHOLD;
|
|
|
55
55
|
var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
56
56
|
exports.DEGRADED_SEVERITY_THRESHOLD = DEGRADED_SEVERITY_THRESHOLD;
|
|
57
57
|
var packageName = "@atlaskit/renderer";
|
|
58
|
-
var packageVersion = "108.11.
|
|
58
|
+
var packageVersion = "108.11.15";
|
|
59
59
|
var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
60
60
|
(0, _inherits2.default)(Renderer, _PureComponent);
|
|
61
61
|
var _super = _createSuper(Renderer);
|
|
@@ -468,7 +468,8 @@ var RendererWrapper = /*#__PURE__*/_react.default.memo(function (props) {
|
|
|
468
468
|
onMouseDown = props.onMouseDown,
|
|
469
469
|
useBlockRenderForCodeBlock = props.useBlockRenderForCodeBlock;
|
|
470
470
|
return (0, _react2.jsx)(_ui.WidthProvider, {
|
|
471
|
-
className: "ak-renderer-wrapper"
|
|
471
|
+
className: "ak-renderer-wrapper is-".concat(appearance),
|
|
472
|
+
"data-appearance": appearance
|
|
472
473
|
}, (0, _react2.jsx)(_ui.BaseTheme, {
|
|
473
474
|
baseFontSize: appearance && appearance !== 'comment' ? _editorSharedStyles.akEditorFullPageDefaultFontSize : undefined
|
|
474
475
|
}, (0, _react2.jsx)("div", {
|
|
@@ -5,10 +5,9 @@ import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlask
|
|
|
5
5
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
6
6
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
8
|
-
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
10
10
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
11
|
-
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
12
11
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
13
12
|
import { TableHeader } from './tableCell';
|
|
14
13
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
@@ -247,8 +246,20 @@ export class TableContainer extends React.Component {
|
|
|
247
246
|
const lineLength = akEditorDefaultLayoutWidth;
|
|
248
247
|
let tableWidth;
|
|
249
248
|
let left;
|
|
249
|
+
let updatedLayout;
|
|
250
|
+
|
|
251
|
+
// The tableWidth and left offset logic below must stay aligned with the `breakout-ssr.tsx` logic
|
|
252
|
+
// Please consider changes below carefully to not negatively impact SSR
|
|
253
|
+
// `renderWidth` cannot be depended on during SSR
|
|
254
|
+
const isRenderWidthValid = !!renderWidth && renderWidth > 0;
|
|
250
255
|
const calcDefaultLayoutWidthByAppearance = (tableNode, rendererAppearance) => {
|
|
251
|
-
|
|
256
|
+
if (rendererAppearance === 'full-width' && !tableNode.attrs.width) {
|
|
257
|
+
return isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
|
|
258
|
+
} else {
|
|
259
|
+
// custom width, or width mapped to breakpoint
|
|
260
|
+
const tableContainerWidth = getTableContainerWidth(tableNode);
|
|
261
|
+
return isRenderWidthValid ? Math.min(tableContainerWidth, renderWidth) : tableContainerWidth;
|
|
262
|
+
}
|
|
252
263
|
};
|
|
253
264
|
if (isTableResizingEnabled(rendererAppearance) && tableNode) {
|
|
254
265
|
tableWidth = calcDefaultLayoutWidthByAppearance(tableNode, rendererAppearance);
|
|
@@ -259,6 +270,18 @@ export class TableContainer extends React.Component {
|
|
|
259
270
|
left = lineLength / 2 - tableWidth / 2;
|
|
260
271
|
}
|
|
261
272
|
const children = React.Children.toArray(this.props.children);
|
|
273
|
+
|
|
274
|
+
// Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
|
|
275
|
+
// This check caters for those tables and helps with SSR logic
|
|
276
|
+
const isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
|
|
277
|
+
const hasCustomWidth = isTableResizingEnabled(rendererAppearance) && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width);
|
|
278
|
+
if (isFullWidth) {
|
|
279
|
+
updatedLayout = 'full-width';
|
|
280
|
+
} else if (hasCustomWidth) {
|
|
281
|
+
updatedLayout = 'custom';
|
|
282
|
+
} else {
|
|
283
|
+
updatedLayout = layout;
|
|
284
|
+
}
|
|
262
285
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !getBooleanFF('platform.editor.custom-table-width') && stickyHeaders && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
|
|
263
286
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
264
287
|
tableWidth: tableWidth,
|
|
@@ -276,7 +299,7 @@ export class TableContainer extends React.Component {
|
|
|
276
299
|
rendererAppearance: rendererAppearance
|
|
277
300
|
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
278
301
|
className: `${TableSharedCssClassName.TABLE_CONTAINER} ${this.props.shadowClassNames || ''}`,
|
|
279
|
-
"data-layout":
|
|
302
|
+
"data-layout": updatedLayout,
|
|
280
303
|
ref: this.props.handleRef,
|
|
281
304
|
style: {
|
|
282
305
|
width: tableWidth,
|
|
@@ -372,7 +395,10 @@ const TableWithShadows = overflowShadow(TableProcessor, {
|
|
|
372
395
|
overflowSelector: `.${TableSharedCssClassName.TABLE_NODE_WRAPPER}`,
|
|
373
396
|
useShadowObserver: true
|
|
374
397
|
});
|
|
375
|
-
const TableWithWidth = props =>
|
|
398
|
+
const TableWithWidth = props =>
|
|
399
|
+
/*#__PURE__*/
|
|
400
|
+
// Remember, `width` will be 0 during SSR
|
|
401
|
+
React.createElement(WidthConsumer, null, ({
|
|
376
402
|
width
|
|
377
403
|
}) => {
|
|
378
404
|
var _props$columnWidths;
|
|
@@ -45,7 +45,7 @@ export const breakoutInlineScriptContext = `
|
|
|
45
45
|
`;
|
|
46
46
|
function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
47
47
|
const MEDIA_NODE_TYPE = 'mediaSingle';
|
|
48
|
-
const WIDE_LAYOUT_MODES = ['full-width', 'wide'];
|
|
48
|
+
const WIDE_LAYOUT_MODES = ['full-width', 'wide', 'custom'];
|
|
49
49
|
function findUp(element, condition) {
|
|
50
50
|
if (!element) {
|
|
51
51
|
return;
|
|
@@ -71,12 +71,18 @@ function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
|
71
71
|
}
|
|
72
72
|
if (item.target.classList.contains('ak-renderer-document')) {
|
|
73
73
|
item.addedNodes.forEach(maybeNode => {
|
|
74
|
+
let width;
|
|
74
75
|
const node = maybeNode;
|
|
75
76
|
const mode = node.dataset.mode || node.dataset.layout || '';
|
|
76
77
|
if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
|
|
77
78
|
return;
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
if (node.classList.contains('pm-table-container') && mode === 'custom') {
|
|
81
|
+
const effectiveWidth = renderer.offsetWidth - breakoutConsts.padding;
|
|
82
|
+
width = `${Math.min(parseInt(node.style.width), effectiveWidth)}px`;
|
|
83
|
+
} else {
|
|
84
|
+
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
85
|
+
}
|
|
80
86
|
if (node.style.width === width) {
|
|
81
87
|
return;
|
|
82
88
|
}
|
|
@@ -85,11 +91,13 @@ function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
|
85
91
|
// Tables require some special logic, as they are not using common css transform approach,
|
|
86
92
|
// because it breaks with sticky headers. This logic is copied from a table node:
|
|
87
93
|
// https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
|
|
88
|
-
if (node.classList.contains('pm-table-container')) {
|
|
94
|
+
if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
|
|
89
95
|
const lineLength = breakoutConsts.calcLineLength();
|
|
90
96
|
const left = lineLength / 2 - parseInt(width) / 2;
|
|
91
|
-
if (left < 0) {
|
|
97
|
+
if (left < 0 && parseInt(width) > lineLength) {
|
|
92
98
|
node.style.left = left + 'px';
|
|
99
|
+
} else {
|
|
100
|
+
node.style.left = '';
|
|
93
101
|
}
|
|
94
102
|
}
|
|
95
103
|
});
|
|
@@ -35,7 +35,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
35
35
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
36
36
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
37
37
|
const packageName = "@atlaskit/renderer";
|
|
38
|
-
const packageVersion = "108.11.
|
|
38
|
+
const packageVersion = "108.11.15";
|
|
39
39
|
export class Renderer extends PureComponent {
|
|
40
40
|
constructor(props) {
|
|
41
41
|
super(props);
|
|
@@ -440,7 +440,8 @@ const RendererWrapper = /*#__PURE__*/React.memo(props => {
|
|
|
440
440
|
useBlockRenderForCodeBlock
|
|
441
441
|
} = props;
|
|
442
442
|
return jsx(WidthProvider, {
|
|
443
|
-
className:
|
|
443
|
+
className: `ak-renderer-wrapper is-${appearance}`,
|
|
444
|
+
"data-appearance": appearance
|
|
444
445
|
}, jsx(BaseTheme, {
|
|
445
446
|
baseFontSize: appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
|
|
446
447
|
}, jsx("div", {
|
|
@@ -16,10 +16,9 @@ import { calcTableWidth, TableSharedCssClassName, tableMarginTop } from '@atlask
|
|
|
16
16
|
import { WidthConsumer, overflowShadow } from '@atlaskit/editor-common/ui';
|
|
17
17
|
import { createCompareNodes, convertProsemirrorTableNodeToArrayOfRows, hasMergedCell, compose } from '@atlaskit/editor-common/utils';
|
|
18
18
|
import { SortOrder } from '@atlaskit/editor-common/types';
|
|
19
|
-
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
19
|
+
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
20
20
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
21
21
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
22
|
-
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
23
22
|
import { FullPagePadding } from '../../ui/Renderer/style';
|
|
24
23
|
import { TableHeader } from './tableCell';
|
|
25
24
|
import { withSmartCardStorage } from '../../ui/SmartCardStorage';
|
|
@@ -293,8 +292,20 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
293
292
|
var lineLength = akEditorDefaultLayoutWidth;
|
|
294
293
|
var tableWidth;
|
|
295
294
|
var left;
|
|
295
|
+
var updatedLayout;
|
|
296
|
+
|
|
297
|
+
// The tableWidth and left offset logic below must stay aligned with the `breakout-ssr.tsx` logic
|
|
298
|
+
// Please consider changes below carefully to not negatively impact SSR
|
|
299
|
+
// `renderWidth` cannot be depended on during SSR
|
|
300
|
+
var isRenderWidthValid = !!renderWidth && renderWidth > 0;
|
|
296
301
|
var calcDefaultLayoutWidthByAppearance = function calcDefaultLayoutWidthByAppearance(tableNode, rendererAppearance) {
|
|
297
|
-
|
|
302
|
+
if (rendererAppearance === 'full-width' && !tableNode.attrs.width) {
|
|
303
|
+
return isRenderWidthValid ? Math.min(akEditorFullWidthLayoutWidth, renderWidth) : akEditorFullWidthLayoutWidth;
|
|
304
|
+
} else {
|
|
305
|
+
// custom width, or width mapped to breakpoint
|
|
306
|
+
var tableContainerWidth = getTableContainerWidth(tableNode);
|
|
307
|
+
return isRenderWidthValid ? Math.min(tableContainerWidth, renderWidth) : tableContainerWidth;
|
|
308
|
+
}
|
|
298
309
|
};
|
|
299
310
|
if (isTableResizingEnabled(rendererAppearance) && tableNode) {
|
|
300
311
|
tableWidth = calcDefaultLayoutWidthByAppearance(tableNode, rendererAppearance);
|
|
@@ -305,6 +316,18 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
305
316
|
left = lineLength / 2 - tableWidth / 2;
|
|
306
317
|
}
|
|
307
318
|
var children = React.Children.toArray(this.props.children);
|
|
319
|
+
|
|
320
|
+
// Historically, tables in the full-width renderer had their layout set to 'default' which is deceiving.
|
|
321
|
+
// This check caters for those tables and helps with SSR logic
|
|
322
|
+
var isFullWidth = !(tableNode !== null && tableNode !== void 0 && tableNode.attrs.width) && rendererAppearance === 'full-width' && layout !== 'full-width';
|
|
323
|
+
var hasCustomWidth = isTableResizingEnabled(rendererAppearance) && (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.width);
|
|
324
|
+
if (isFullWidth) {
|
|
325
|
+
updatedLayout = 'full-width';
|
|
326
|
+
} else if (hasCustomWidth) {
|
|
327
|
+
updatedLayout = 'custom';
|
|
328
|
+
} else {
|
|
329
|
+
updatedLayout = layout;
|
|
330
|
+
}
|
|
308
331
|
return /*#__PURE__*/React.createElement(React.Fragment, null, !getBooleanFF('platform.editor.custom-table-width') && stickyHeaders && tableCanBeSticky(tableNode, children) && /*#__PURE__*/React.createElement(StickyTable, {
|
|
309
332
|
isNumberColumnEnabled: isNumberColumnEnabled,
|
|
310
333
|
tableWidth: tableWidth,
|
|
@@ -322,7 +345,7 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
322
345
|
rendererAppearance: rendererAppearance
|
|
323
346
|
}, [children && children[0]]), /*#__PURE__*/React.createElement("div", {
|
|
324
347
|
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
325
|
-
"data-layout":
|
|
348
|
+
"data-layout": updatedLayout,
|
|
326
349
|
ref: this.props.handleRef,
|
|
327
350
|
style: {
|
|
328
351
|
width: tableWidth,
|
|
@@ -426,22 +449,26 @@ var TableWithShadows = overflowShadow(TableProcessor, {
|
|
|
426
449
|
useShadowObserver: true
|
|
427
450
|
});
|
|
428
451
|
var TableWithWidth = function TableWithWidth(props) {
|
|
429
|
-
return
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
452
|
+
return (
|
|
453
|
+
/*#__PURE__*/
|
|
454
|
+
// Remember, `width` will be 0 during SSR
|
|
455
|
+
React.createElement(WidthConsumer, null, function (_ref2) {
|
|
456
|
+
var _props$columnWidths;
|
|
457
|
+
var width = _ref2.width;
|
|
458
|
+
var renderWidth = props.rendererAppearance === 'full-page' ? width - FullPagePadding * 2 : width;
|
|
459
|
+
var colWidthsSum = ((_props$columnWidths = props.columnWidths) === null || _props$columnWidths === void 0 ? void 0 : _props$columnWidths.reduce(function (total, val) {
|
|
460
|
+
return total + val;
|
|
461
|
+
}, 0)) || 0;
|
|
462
|
+
if (colWidthsSum || getBooleanFF('platform.editor.custom-table-width-scale-down-undefined-column_nkyvx') && isTableResizingEnabled(props.rendererAppearance)) {
|
|
463
|
+
return /*#__PURE__*/React.createElement(TableWithShadows, _extends({
|
|
464
|
+
renderWidth: renderWidth
|
|
465
|
+
}, props));
|
|
466
|
+
}
|
|
467
|
+
// there should not be a case when colWidthsSum is 0 and table is in overflow state - so no need to render shadows in this case
|
|
468
|
+
return /*#__PURE__*/React.createElement(TableProcessor, _extends({
|
|
438
469
|
renderWidth: renderWidth
|
|
439
470
|
}, props));
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
return /*#__PURE__*/React.createElement(TableProcessor, _extends({
|
|
443
|
-
renderWidth: renderWidth
|
|
444
|
-
}, props));
|
|
445
|
-
});
|
|
471
|
+
})
|
|
472
|
+
);
|
|
446
473
|
};
|
|
447
474
|
export default withSmartCardStorage(TableWithWidth);
|
|
@@ -33,7 +33,7 @@ export function createBreakoutInlineScript(id) {
|
|
|
33
33
|
export var breakoutInlineScriptContext = "\n var breakoutConsts = ".concat(JSON.stringify(breakoutConsts), ";\n breakoutConsts.mapBreakpointToLayoutMaxWidth = ").concat(breakoutConsts.mapBreakpointToLayoutMaxWidth.toString(), ";\n breakoutConsts.getBreakpoint = ").concat(breakoutConsts.getBreakpoint.toString(), ";\n breakoutConsts.calcBreakoutWidth = ").concat(breakoutConsts.calcBreakoutWidth.toString(), ";\n breakoutConsts.calcLineLength = ").concat(breakoutConsts.calcLineLength.toString(), ";\n breakoutConsts.calcWideWidth = ").concat(breakoutConsts.calcWideWidth.toString(), ";\n");
|
|
34
34
|
function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
35
35
|
var MEDIA_NODE_TYPE = 'mediaSingle';
|
|
36
|
-
var WIDE_LAYOUT_MODES = ['full-width', 'wide'];
|
|
36
|
+
var WIDE_LAYOUT_MODES = ['full-width', 'wide', 'custom'];
|
|
37
37
|
function findUp(element, condition) {
|
|
38
38
|
if (!element) {
|
|
39
39
|
return;
|
|
@@ -59,12 +59,18 @@ function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
|
59
59
|
}
|
|
60
60
|
if (item.target.classList.contains('ak-renderer-document')) {
|
|
61
61
|
item.addedNodes.forEach(function (maybeNode) {
|
|
62
|
+
var width;
|
|
62
63
|
var node = maybeNode;
|
|
63
64
|
var mode = node.dataset.mode || node.dataset.layout || '';
|
|
64
65
|
if (!mode || !WIDE_LAYOUT_MODES.includes(mode)) {
|
|
65
66
|
return;
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
+
if (node.classList.contains('pm-table-container') && mode === 'custom') {
|
|
69
|
+
var effectiveWidth = renderer.offsetWidth - breakoutConsts.padding;
|
|
70
|
+
width = "".concat(Math.min(parseInt(node.style.width), effectiveWidth), "px");
|
|
71
|
+
} else {
|
|
72
|
+
width = breakoutConsts.calcBreakoutWidth(mode, renderer.offsetWidth);
|
|
73
|
+
}
|
|
68
74
|
if (node.style.width === width) {
|
|
69
75
|
return;
|
|
70
76
|
}
|
|
@@ -73,11 +79,13 @@ function applyBreakoutAfterSSR(id, breakoutConsts) {
|
|
|
73
79
|
// Tables require some special logic, as they are not using common css transform approach,
|
|
74
80
|
// because it breaks with sticky headers. This logic is copied from a table node:
|
|
75
81
|
// https://bitbucket.org/atlassian/atlassian-frontend/src/77938aee0c140d02ff99b98a03849be1236865b4/packages/editor/renderer/src/react/nodes/table.tsx#table.tsx-235:245
|
|
76
|
-
if (node.classList.contains('pm-table-container')) {
|
|
82
|
+
if (node.classList.contains('pm-table-container') && !renderer.classList.contains('is-full-width')) {
|
|
77
83
|
var lineLength = breakoutConsts.calcLineLength();
|
|
78
84
|
var left = lineLength / 2 - parseInt(width) / 2;
|
|
79
|
-
if (left < 0) {
|
|
85
|
+
if (left < 0 && parseInt(width) > lineLength) {
|
|
80
86
|
node.style.left = left + 'px';
|
|
87
|
+
} else {
|
|
88
|
+
node.style.left = '';
|
|
81
89
|
}
|
|
82
90
|
}
|
|
83
91
|
});
|
|
@@ -45,7 +45,7 @@ import { RenderTracking } from '../../react/utils/performance/RenderTracking';
|
|
|
45
45
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
46
46
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
47
47
|
var packageName = "@atlaskit/renderer";
|
|
48
|
-
var packageVersion = "108.11.
|
|
48
|
+
var packageVersion = "108.11.15";
|
|
49
49
|
export var Renderer = /*#__PURE__*/function (_PureComponent) {
|
|
50
50
|
_inherits(Renderer, _PureComponent);
|
|
51
51
|
var _super = _createSuper(Renderer);
|
|
@@ -457,7 +457,8 @@ var RendererWrapper = /*#__PURE__*/React.memo(function (props) {
|
|
|
457
457
|
onMouseDown = props.onMouseDown,
|
|
458
458
|
useBlockRenderForCodeBlock = props.useBlockRenderForCodeBlock;
|
|
459
459
|
return jsx(WidthProvider, {
|
|
460
|
-
className: "ak-renderer-wrapper"
|
|
460
|
+
className: "ak-renderer-wrapper is-".concat(appearance),
|
|
461
|
+
"data-appearance": appearance
|
|
461
462
|
}, jsx(BaseTheme, {
|
|
462
463
|
baseFontSize: appearance && appearance !== 'comment' ? akEditorFullPageDefaultFontSize : undefined
|
|
463
464
|
}, jsx("div", {
|
|
@@ -49,7 +49,7 @@ declare const BlockCard: React.ComponentType<{
|
|
|
49
49
|
url?: string | undefined;
|
|
50
50
|
data?: object | undefined;
|
|
51
51
|
eventHandlers?: import("@atlaskit/editor-common/ui").EventHandlers | undefined;
|
|
52
|
-
datasource?: import("@atlaskit/adf-schema
|
|
52
|
+
datasource?: import("@atlaskit/adf-schema").DatasourceAttributeProperties | undefined;
|
|
53
53
|
portal?: HTMLElement | undefined;
|
|
54
54
|
rendererAppearance?: import("../../ui/Renderer/types").RendererAppearance;
|
|
55
55
|
smartLinks?: import("../../types/smartLinksOptions").SmartLinksOptions | undefined;
|
|
@@ -49,7 +49,7 @@ declare const BlockCard: React.ComponentType<{
|
|
|
49
49
|
url?: string | undefined;
|
|
50
50
|
data?: object | undefined;
|
|
51
51
|
eventHandlers?: import("@atlaskit/editor-common/ui").EventHandlers | undefined;
|
|
52
|
-
datasource?: import("@atlaskit/adf-schema
|
|
52
|
+
datasource?: import("@atlaskit/adf-schema").DatasourceAttributeProperties | undefined;
|
|
53
53
|
portal?: HTMLElement | undefined;
|
|
54
54
|
rendererAppearance?: import("../../ui/Renderer/types").RendererAppearance;
|
|
55
55
|
smartLinks?: import("../../types/smartLinksOptions").SmartLinksOptions | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "108.11.
|
|
3
|
+
"version": "108.11.15",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,21 +24,21 @@
|
|
|
24
24
|
}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@atlaskit/adf-schema": "
|
|
27
|
+
"@atlaskit/adf-schema": "^29.1.0",
|
|
28
28
|
"@atlaskit/adf-utils": "^19.0.0",
|
|
29
29
|
"@atlaskit/analytics-listeners": "^8.7.0",
|
|
30
30
|
"@atlaskit/analytics-namespaced-context": "^6.7.0",
|
|
31
31
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
32
32
|
"@atlaskit/button": "^16.10.0",
|
|
33
33
|
"@atlaskit/code": "^14.6.0",
|
|
34
|
-
"@atlaskit/editor-common": "^74.
|
|
34
|
+
"@atlaskit/editor-common": "^74.59.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
36
36
|
"@atlaskit/editor-palette": "1.5.1",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^2.6.0",
|
|
39
39
|
"@atlaskit/emoji": "^67.5.0",
|
|
40
40
|
"@atlaskit/icon": "^21.12.0",
|
|
41
|
-
"@atlaskit/link-datasource": "^1.
|
|
41
|
+
"@atlaskit/link-datasource": "^1.1.0",
|
|
42
42
|
"@atlaskit/media-card": "^76.2.0",
|
|
43
43
|
"@atlaskit/media-client": "^24.0.0",
|
|
44
44
|
"@atlaskit/media-common": "^9.0.0",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"@atlaskit/media-ui": "^24.0.0",
|
|
47
47
|
"@atlaskit/media-viewer": "^48.0.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.2.0",
|
|
49
|
-
"@atlaskit/smart-card": "^26.
|
|
49
|
+
"@atlaskit/smart-card": "^26.25.0",
|
|
50
50
|
"@atlaskit/status": "^1.3.0",
|
|
51
51
|
"@atlaskit/task-decision": "^17.8.0",
|
|
52
52
|
"@atlaskit/theme": "^12.6.0",
|
|
53
|
-
"@atlaskit/tokens": "^1.
|
|
53
|
+
"@atlaskit/tokens": "^1.22.0",
|
|
54
54
|
"@atlaskit/tooltip": "^17.8.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|
|
56
56
|
"@emotion/react": "^11.7.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
72
72
|
"@atlaskit/css-reset": "^6.5.0",
|
|
73
73
|
"@atlaskit/link-provider": "^1.6.0",
|
|
74
|
-
"@atlaskit/link-test-helpers": "^6.
|
|
74
|
+
"@atlaskit/link-test-helpers": "^6.1.0",
|
|
75
75
|
"@atlaskit/media-core": "^34.1.0",
|
|
76
76
|
"@atlaskit/media-integration-test-helpers": "^3.0.0",
|
|
77
77
|
"@atlaskit/media-test-helpers": "^33.0.0",
|