@atlaskit/renderer 128.11.1 → 129.0.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 +6 -0
- package/dist/cjs/react/nodes/table/content-mode.js +71 -0
- package/dist/cjs/react/nodes/table/table.js +9 -0
- package/dist/cjs/react/nodes/table.js +17 -4
- package/dist/cjs/react/nodes/tableNew.js +11 -2
- package/dist/cjs/ui/Renderer/RendererStyleContainer.js +13 -1
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/table/content-mode.js +67 -0
- package/dist/es2019/react/nodes/table/table.js +9 -0
- package/dist/es2019/react/nodes/table.js +13 -0
- package/dist/es2019/react/nodes/tableNew.js +10 -0
- package/dist/es2019/ui/Renderer/RendererStyleContainer.js +18 -1
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/table/content-mode.js +65 -0
- package/dist/esm/react/nodes/table/table.js +9 -0
- package/dist/esm/react/nodes/table.js +17 -4
- package/dist/esm/react/nodes/tableNew.js +11 -2
- package/dist/esm/ui/Renderer/RendererStyleContainer.js +13 -1
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/nodes/table/content-mode.d.ts +34 -0
- package/dist/types-ts4.5/react/nodes/table/content-mode.d.ts +34 -0
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isTableInContentMode = exports.hasColWidths = void 0;
|
|
7
|
+
var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
|
|
8
|
+
/**
|
|
9
|
+
* Checks whether any cell in the first row of the table has a colwidth attribute set.
|
|
10
|
+
*
|
|
11
|
+
* This mirrors `hasTableColumnBeenResized` from editor-plugin-table's `colgroup.ts`.
|
|
12
|
+
*/
|
|
13
|
+
var hasColWidths = exports.hasColWidths = function hasColWidths(tableNode) {
|
|
14
|
+
var firstRow = tableNode.content.firstChild;
|
|
15
|
+
if (!firstRow) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
for (var i = 0; i < firstRow.childCount; i++) {
|
|
19
|
+
if (firstRow.child(i).attrs.colwidth) {
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return false;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Mirrors `isContentModeSupported()` from editor-plugin-table's `tableMode.ts`.
|
|
27
|
+
*
|
|
28
|
+
* In the editor this checks `allowColumnResizing && allowTableResizing && isFullPageEditor`.
|
|
29
|
+
* In the renderer there is no separate `allowColumnResizing` flag — `allowTableResizing`
|
|
30
|
+
* covers both — and `isFullPageEditor` maps to `rendererAppearance === 'full-page'`.
|
|
31
|
+
*/
|
|
32
|
+
var isContentModeSupported = function isContentModeSupported(_ref) {
|
|
33
|
+
var allowTableResizing = _ref.allowTableResizing,
|
|
34
|
+
rendererAppearance = _ref.rendererAppearance;
|
|
35
|
+
return !!allowTableResizing && (rendererAppearance === 'full-page' || rendererAppearance === 'full-width' || rendererAppearance === 'max');
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Determines whether a table should render in content mode.
|
|
40
|
+
*
|
|
41
|
+
* Content mode tables have no fixed column widths — the browser sizes columns to fit their
|
|
42
|
+
* content (table-layout: auto). A table is in content mode when:
|
|
43
|
+
*
|
|
44
|
+
* 1. The feature is supported (table resizing enabled, full-page appearance)
|
|
45
|
+
* 2. The table is at the top level of the document (not nested in another table or block node)
|
|
46
|
+
* 3. The table node exists
|
|
47
|
+
* 4. `table.attrs.width` is null (no explicit width set by the user)
|
|
48
|
+
* 5. No cells in the first row have `colwidth` set (table has not been column-resized)
|
|
49
|
+
* 6. The `platform_editor_table_fit_to_content_auto_convert` experiment is enabled
|
|
50
|
+
*
|
|
51
|
+
* This mirrors `isTableInContentMode()` from editor-plugin-table's `tableMode.ts`.
|
|
52
|
+
*
|
|
53
|
+
* SSR-safe: `expValEquals` returns false on the server (FeatureGates not initialised),
|
|
54
|
+
* so content mode is never active during SSR — no hydration mismatch.
|
|
55
|
+
*/
|
|
56
|
+
var isTableInContentMode = exports.isTableInContentMode = function isTableInContentMode(_ref2) {
|
|
57
|
+
var tableNode = _ref2.tableNode,
|
|
58
|
+
allowTableResizing = _ref2.allowTableResizing,
|
|
59
|
+
rendererAppearance = _ref2.rendererAppearance,
|
|
60
|
+
isTableNested = _ref2.isTableNested;
|
|
61
|
+
if (!(0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true)) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
if (!tableNode) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return !isTableNested && isContentModeSupported({
|
|
68
|
+
allowTableResizing: allowTableResizing,
|
|
69
|
+
rendererAppearance: rendererAppearance
|
|
70
|
+
}) && tableNode.attrs.width === null && !hasColWidths(tableNode) && tableNode.attrs.layout === 'align-start';
|
|
71
|
+
};
|
|
@@ -11,6 +11,8 @@ var _colgroup = require("./colgroup");
|
|
|
11
11
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
13
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
|
+
var _contentMode = require("./content-mode");
|
|
14
16
|
var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
15
17
|
var _tableNode$attrs;
|
|
16
18
|
var innerRef = _ref.innerRef,
|
|
@@ -53,6 +55,12 @@ var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
53
55
|
}
|
|
54
56
|
var tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
|
|
55
57
|
var tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
|
|
58
|
+
var isContentMode = (0, _contentMode.isTableInContentMode)({
|
|
59
|
+
tableNode: tableNode,
|
|
60
|
+
allowTableResizing: allowTableResizing,
|
|
61
|
+
rendererAppearance: rendererAppearance,
|
|
62
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
63
|
+
}) && (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
56
64
|
return /*#__PURE__*/_react.default.createElement("table", (0, _extends2.default)({}, (0, _platformFeatureFlags.fg)('platform_renderer_isPresentational') && {
|
|
57
65
|
role: isPresentational ? 'presentation' : undefined
|
|
58
66
|
}, {
|
|
@@ -61,6 +69,7 @@ var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
61
69
|
"data-table-width": tableWidth,
|
|
62
70
|
"data-layout": tableLayout,
|
|
63
71
|
"data-table-display-mode": tableDisplayMode,
|
|
72
|
+
"data-initial-width-mode": isContentMode ? 'content' : undefined,
|
|
64
73
|
ref: innerRef,
|
|
65
74
|
style: {
|
|
66
75
|
marginTop: fixTableSSRResizing ? '0px' : ''
|
|
@@ -33,6 +33,9 @@ var _appearance = require("../utils/appearance");
|
|
|
33
33
|
var _TableStickyScrollbar = require("./TableStickyScrollbar");
|
|
34
34
|
var _tableNew = require("./tableNew");
|
|
35
35
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
36
|
+
var _contentMode = require("./table/content-mode");
|
|
37
|
+
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; }
|
|
38
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
36
39
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
37
40
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
38
41
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -518,19 +521,29 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
518
521
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
519
522
|
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? fixTableSSRResizing ? "calc(".concat(tableWidthCSS, ")") : tableWidth : 'inherit';
|
|
520
523
|
}
|
|
524
|
+
var isContentModeTable = (0, _contentMode.isTableInContentMode)({
|
|
525
|
+
tableNode: tableNode,
|
|
526
|
+
allowTableResizing: allowTableResizing,
|
|
527
|
+
rendererAppearance: rendererAppearance,
|
|
528
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
529
|
+
}) && (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
521
530
|
var style;
|
|
522
531
|
if (fixTableSSRResizing) {
|
|
523
|
-
style = {
|
|
532
|
+
style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
533
|
+
'--renderer-table-max-width': renderWidthCSS
|
|
534
|
+
}), {}, {
|
|
524
535
|
width: finalTableContainerWidth,
|
|
525
536
|
left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
|
|
526
537
|
marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
|
|
527
|
-
};
|
|
538
|
+
});
|
|
528
539
|
} else {
|
|
529
|
-
style = {
|
|
540
|
+
style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
541
|
+
'--renderer-table-max-width': "".concat(renderWidth, "px")
|
|
542
|
+
}), {}, {
|
|
530
543
|
width: finalTableContainerWidth,
|
|
531
544
|
left: left,
|
|
532
545
|
marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
|
|
533
|
-
};
|
|
546
|
+
});
|
|
534
547
|
}
|
|
535
548
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
536
549
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -26,6 +26,7 @@ var _table = require("./table/table");
|
|
|
26
26
|
var _appearance = require("../utils/appearance");
|
|
27
27
|
var _TableStickyScrollbar = require("./TableStickyScrollbar");
|
|
28
28
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
29
|
+
var _contentMode = require("./table/content-mode");
|
|
29
30
|
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; }
|
|
30
31
|
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) { (0, _defineProperty2.default)(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; }
|
|
31
32
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
@@ -477,11 +478,19 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
477
478
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
478
479
|
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
|
|
479
480
|
}
|
|
480
|
-
var
|
|
481
|
+
var isContentModeTable = (0, _contentMode.isTableInContentMode)({
|
|
482
|
+
tableNode: tableNode,
|
|
483
|
+
allowTableResizing: allowTableResizing,
|
|
484
|
+
rendererAppearance: rendererAppearance,
|
|
485
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
486
|
+
}) && (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
487
|
+
var style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
488
|
+
'--renderer-table-max-width': renderWidthCSS
|
|
489
|
+
}), {}, {
|
|
481
490
|
width: finalTableContainerWidth,
|
|
482
491
|
left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
|
|
483
492
|
marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
|
|
484
|
-
};
|
|
493
|
+
});
|
|
485
494
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("div", {
|
|
486
495
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
487
496
|
className: "".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
@@ -1460,6 +1460,10 @@ var tableSharedStyle = (0, _react.css)((0, _defineProperty2.default)((0, _define
|
|
|
1460
1460
|
'&[data-autosize="true"]': {
|
|
1461
1461
|
tableLayout: 'auto'
|
|
1462
1462
|
},
|
|
1463
|
+
'&[data-initial-width-mode="content"]': {
|
|
1464
|
+
tableLayout: 'auto',
|
|
1465
|
+
width: 'auto'
|
|
1466
|
+
},
|
|
1463
1467
|
'*': {
|
|
1464
1468
|
boxSizing: 'border-box'
|
|
1465
1469
|
},
|
|
@@ -1500,6 +1504,14 @@ var tableSharedStyle = (0, _react.css)((0, _defineProperty2.default)((0, _define
|
|
|
1500
1504
|
}))
|
|
1501
1505
|
}
|
|
1502
1506
|
}));
|
|
1507
|
+
var tableContentModeStyles = (0, _react.css)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, ".".concat(_consts.RendererCssClassName.DOCUMENT, " .").concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, ":has(table[data-initial-width-mode=\"content\"])"), {
|
|
1508
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
1509
|
+
width: 'max-content !important',
|
|
1510
|
+
maxWidth: 'var(--renderer-table-max-width)'
|
|
1511
|
+
}), ".".concat(_consts.RendererCssClassName.DOCUMENT, " table[data-initial-width-mode=\"content\"] > colgroup > col"), {
|
|
1512
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
1513
|
+
width: 'unset !important'
|
|
1514
|
+
}));
|
|
1503
1515
|
var tableRendererHeaderStylesForTableCellOnly = (0, _react.css)((0, _defineProperty2.default)({}, ".".concat(_styles.TableSharedCssClassName.TABLE_CONTAINER, " > table,\n\t\t.").concat(_styles.TableSharedCssClassName.TABLE_NODE_WRAPPER, " > table,\n\t\t.").concat(_styles.TableSharedCssClassName.TABLE_STICKY_WRAPPER, " > table"), {
|
|
1504
1516
|
'> tbody > tr > th, > tbody > tr > td': {
|
|
1505
1517
|
minWidth: "".concat(_styles.tableCellMinWidth, "px"),
|
|
@@ -2063,7 +2075,7 @@ var RendererStyleContainer = exports.RendererStyleContainer = function RendererS
|
|
|
2063
2075
|
// this should be placed after baseOtherStyles
|
|
2064
2076
|
(0, _expValEquals.expValEquals)('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && ((0, _expValEquals.expValEquals)('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), inlineExtensionRendererMarginFix, allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
|
|
2065
2077
|
// merge firstWrappedMediaStyles with mediaSingleSharedStyle when clean up platform_editor_fix_media_in_renderer
|
|
2066
|
-
(0, _platformFeatureFlags.fg)('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, tableRendererHeaderStylesForTableCellOnly, (0, _platformFeatureFlags.fg)('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, (0, _platformFeatureFlags.fg)('platform_editor_nested_dnd_styles_changes') ? firstNodeWithNotMarginTopWithNestedDnD : firstNodeWithNotMarginTop, rendererTableStyles, (0, _table.isStickyScrollbarEnabled)(appearance) && stickyScrollbarStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, (0, _expValEquals.expValEquals)('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? isCompactModeEnabled ? scaledDenseEmojiStyles : scaledEmojiStyles : isCompactModeEnabled ? denseStyles : undefined, (0, _experiments.editorExperiment)('platform_synced_block', true) && syncBlockStyles, centerWrapperStyles, (0, _experiments.editorExperiment)('platform_synced_block', true) && isInsideSyncBlock && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_9') ? syncBlockRendererStyles : null, (0, _expValEquals.expValEquals)('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2078
|
+
(0, _platformFeatureFlags.fg)('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeStyles, tableRendererHeaderStylesForTableCellOnly, (0, _platformFeatureFlags.fg)('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, (0, _platformFeatureFlags.fg)('platform_editor_nested_dnd_styles_changes') ? firstNodeWithNotMarginTopWithNestedDnD : firstNodeWithNotMarginTop, rendererTableStyles, (0, _table.isStickyScrollbarEnabled)(appearance) && stickyScrollbarStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && allowNestedHeaderLinks && ((0, _expValEquals.expValEquals)('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && ((0, _expValEquals.expValEquals)('editor_tinymce_full_width_mode', 'isEnabled', true) || (0, _expValEquals.expValEquals)('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, (0, _expValEquals.expValEquals)('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? isCompactModeEnabled ? scaledDenseEmojiStyles : scaledEmojiStyles : isCompactModeEnabled ? denseStyles : undefined, (0, _experiments.editorExperiment)('platform_synced_block', true) && syncBlockStyles, centerWrapperStyles, (0, _experiments.editorExperiment)('platform_synced_block', true) && isInsideSyncBlock && (0, _platformFeatureFlags.fg)('platform_synced_block_patch_9') ? syncBlockRendererStyles : null, (0, _expValEquals.expValEquals)('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2067
2079
|
"data-testid": testId
|
|
2068
2080
|
}, children);
|
|
2069
2081
|
};
|
|
@@ -71,7 +71,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
71
71
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
72
72
|
var RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
73
73
|
var packageName = "@atlaskit/renderer";
|
|
74
|
-
var packageVersion = "
|
|
74
|
+
var packageVersion = "0.0.0-development";
|
|
75
75
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
76
76
|
containerName: 'ak-renderer-wrapper',
|
|
77
77
|
containerType: 'inline-size'
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether any cell in the first row of the table has a colwidth attribute set.
|
|
4
|
+
*
|
|
5
|
+
* This mirrors `hasTableColumnBeenResized` from editor-plugin-table's `colgroup.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export const hasColWidths = tableNode => {
|
|
8
|
+
const firstRow = tableNode.content.firstChild;
|
|
9
|
+
if (!firstRow) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
for (let i = 0; i < firstRow.childCount; i++) {
|
|
13
|
+
if (firstRow.child(i).attrs.colwidth) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Mirrors `isContentModeSupported()` from editor-plugin-table's `tableMode.ts`.
|
|
21
|
+
*
|
|
22
|
+
* In the editor this checks `allowColumnResizing && allowTableResizing && isFullPageEditor`.
|
|
23
|
+
* In the renderer there is no separate `allowColumnResizing` flag — `allowTableResizing`
|
|
24
|
+
* covers both — and `isFullPageEditor` maps to `rendererAppearance === 'full-page'`.
|
|
25
|
+
*/
|
|
26
|
+
const isContentModeSupported = ({
|
|
27
|
+
allowTableResizing,
|
|
28
|
+
rendererAppearance
|
|
29
|
+
}) => {
|
|
30
|
+
return !!allowTableResizing && (rendererAppearance === 'full-page' || rendererAppearance === 'full-width' || rendererAppearance === 'max');
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Determines whether a table should render in content mode.
|
|
35
|
+
*
|
|
36
|
+
* Content mode tables have no fixed column widths — the browser sizes columns to fit their
|
|
37
|
+
* content (table-layout: auto). A table is in content mode when:
|
|
38
|
+
*
|
|
39
|
+
* 1. The feature is supported (table resizing enabled, full-page appearance)
|
|
40
|
+
* 2. The table is at the top level of the document (not nested in another table or block node)
|
|
41
|
+
* 3. The table node exists
|
|
42
|
+
* 4. `table.attrs.width` is null (no explicit width set by the user)
|
|
43
|
+
* 5. No cells in the first row have `colwidth` set (table has not been column-resized)
|
|
44
|
+
* 6. The `platform_editor_table_fit_to_content_auto_convert` experiment is enabled
|
|
45
|
+
*
|
|
46
|
+
* This mirrors `isTableInContentMode()` from editor-plugin-table's `tableMode.ts`.
|
|
47
|
+
*
|
|
48
|
+
* SSR-safe: `expValEquals` returns false on the server (FeatureGates not initialised),
|
|
49
|
+
* so content mode is never active during SSR — no hydration mismatch.
|
|
50
|
+
*/
|
|
51
|
+
export const isTableInContentMode = ({
|
|
52
|
+
tableNode,
|
|
53
|
+
allowTableResizing,
|
|
54
|
+
rendererAppearance,
|
|
55
|
+
isTableNested
|
|
56
|
+
}) => {
|
|
57
|
+
if (!expValEqualsNoExposure('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true)) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
if (!tableNode) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
return !isTableNested && isContentModeSupported({
|
|
64
|
+
allowTableResizing,
|
|
65
|
+
rendererAppearance
|
|
66
|
+
}) && tableNode.attrs.width === null && !hasColWidths(tableNode) && tableNode.attrs.layout === 'align-start';
|
|
67
|
+
};
|
|
@@ -4,6 +4,8 @@ import { Colgroup, colWidthSum } from './colgroup';
|
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
+
import { isTableInContentMode } from './content-mode';
|
|
7
9
|
export const Table = /*#__PURE__*/React.memo(({
|
|
8
10
|
innerRef,
|
|
9
11
|
isNumberColumnEnabled,
|
|
@@ -45,6 +47,12 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
45
47
|
}
|
|
46
48
|
const tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
|
|
47
49
|
const tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
|
|
50
|
+
const isContentMode = isTableInContentMode({
|
|
51
|
+
tableNode,
|
|
52
|
+
allowTableResizing,
|
|
53
|
+
rendererAppearance,
|
|
54
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
55
|
+
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
48
56
|
return /*#__PURE__*/React.createElement("table", _extends({}, fg('platform_renderer_isPresentational') && {
|
|
49
57
|
role: isPresentational ? 'presentation' : undefined
|
|
50
58
|
}, {
|
|
@@ -53,6 +61,7 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
53
61
|
"data-table-width": tableWidth,
|
|
54
62
|
"data-layout": tableLayout,
|
|
55
63
|
"data-table-display-mode": tableDisplayMode,
|
|
64
|
+
"data-initial-width-mode": isContentMode ? 'content' : undefined,
|
|
56
65
|
ref: innerRef,
|
|
57
66
|
style: {
|
|
58
67
|
marginTop: fixTableSSRResizing ? '0px' : ''
|
|
@@ -20,6 +20,7 @@ import { isCommentAppearance, isFullPageAppearance, isFullWidthAppearance, isFul
|
|
|
20
20
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
21
21
|
import { TableProcessorWithContainerStyles } from './tableNew';
|
|
22
22
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
23
|
+
import { isTableInContentMode } from './table/content-mode';
|
|
23
24
|
export const isTableResizingEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance);
|
|
24
25
|
export const isStickyScrollbarEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) && editorExperiment('platform_renderer_table_sticky_scrollbar', true, {
|
|
25
26
|
exposure: true
|
|
@@ -461,15 +462,27 @@ export class TableContainer extends React.Component {
|
|
|
461
462
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
462
463
|
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? fixTableSSRResizing ? `calc(${tableWidthCSS})` : tableWidth : 'inherit';
|
|
463
464
|
}
|
|
465
|
+
const isContentModeTable = isTableInContentMode({
|
|
466
|
+
tableNode,
|
|
467
|
+
allowTableResizing,
|
|
468
|
+
rendererAppearance,
|
|
469
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
470
|
+
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
464
471
|
let style;
|
|
465
472
|
if (fixTableSSRResizing) {
|
|
466
473
|
style = {
|
|
474
|
+
...(isContentModeTable && {
|
|
475
|
+
'--renderer-table-max-width': renderWidthCSS
|
|
476
|
+
}),
|
|
467
477
|
width: finalTableContainerWidth,
|
|
468
478
|
left: leftCSS ? `calc(${leftCSS})` : undefined,
|
|
469
479
|
marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? `calc(-1 * (${leftCSS}))` : undefined
|
|
470
480
|
};
|
|
471
481
|
} else {
|
|
472
482
|
style = {
|
|
483
|
+
...(isContentModeTable && {
|
|
484
|
+
'--renderer-table-max-width': `${renderWidth}px`
|
|
485
|
+
}),
|
|
473
486
|
width: finalTableContainerWidth,
|
|
474
487
|
left: left,
|
|
475
488
|
marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
|
|
@@ -15,6 +15,7 @@ import { Table } from './table/table';
|
|
|
15
15
|
import { isCommentAppearance, isFullWidthOrFullPageAppearance, isFullWidthAppearance, isMaxWidthAppearance, isFullPageAppearance } from '../utils/appearance';
|
|
16
16
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
17
17
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
|
+
import { isTableInContentMode } from './table/content-mode';
|
|
18
19
|
const stickyContainerBaseStyles = {
|
|
19
20
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
20
21
|
height: "var(--ds-space-250, 20px)",
|
|
@@ -421,7 +422,16 @@ export class TableContainer extends React.Component {
|
|
|
421
422
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
422
423
|
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? `calc(${tableWidthCSS})` : 'inherit';
|
|
423
424
|
}
|
|
425
|
+
const isContentModeTable = isTableInContentMode({
|
|
426
|
+
tableNode,
|
|
427
|
+
allowTableResizing,
|
|
428
|
+
rendererAppearance,
|
|
429
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
430
|
+
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
424
431
|
const style = {
|
|
432
|
+
...(isContentModeTable && {
|
|
433
|
+
'--renderer-table-max-width': renderWidthCSS
|
|
434
|
+
}),
|
|
425
435
|
width: finalTableContainerWidth,
|
|
426
436
|
left: leftCSS ? `calc(${leftCSS})` : undefined,
|
|
427
437
|
marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? `calc(-1 * (${leftCSS}))` : undefined
|
|
@@ -1766,6 +1766,10 @@ const tableSharedStyle = css({
|
|
|
1766
1766
|
'&[data-autosize="true"]': {
|
|
1767
1767
|
tableLayout: 'auto'
|
|
1768
1768
|
},
|
|
1769
|
+
'&[data-initial-width-mode="content"]': {
|
|
1770
|
+
tableLayout: 'auto',
|
|
1771
|
+
width: 'auto'
|
|
1772
|
+
},
|
|
1769
1773
|
'*': {
|
|
1770
1774
|
boxSizing: 'border-box'
|
|
1771
1775
|
},
|
|
@@ -1878,6 +1882,19 @@ const tableSharedStyle = css({
|
|
|
1878
1882
|
}
|
|
1879
1883
|
}
|
|
1880
1884
|
});
|
|
1885
|
+
const tableContentModeStyles = css({
|
|
1886
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors
|
|
1887
|
+
[`.${RendererCssClassName.DOCUMENT} .${TableSharedCssClassName.TABLE_CONTAINER}:has(table[data-initial-width-mode="content"])`]: {
|
|
1888
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
1889
|
+
width: 'max-content !important',
|
|
1890
|
+
maxWidth: 'var(--renderer-table-max-width)'
|
|
1891
|
+
},
|
|
1892
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors
|
|
1893
|
+
[`.${RendererCssClassName.DOCUMENT} table[data-initial-width-mode="content"] > colgroup > col`]: {
|
|
1894
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
1895
|
+
width: 'unset !important'
|
|
1896
|
+
}
|
|
1897
|
+
});
|
|
1881
1898
|
const tableRendererHeaderStylesForTableCellOnly = css({
|
|
1882
1899
|
[`.${TableSharedCssClassName.TABLE_CONTAINER} > table,
|
|
1883
1900
|
.${TableSharedCssClassName.TABLE_NODE_WRAPPER} > table,
|
|
@@ -2612,7 +2629,7 @@ export const RendererStyleContainer = props => {
|
|
|
2612
2629
|
// this should be placed after baseOtherStyles
|
|
2613
2630
|
expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
|
|
2614
2631
|
// merge firstWrappedMediaStyles with mediaSingleSharedStyle when clean up platform_editor_fix_media_in_renderer
|
|
2615
|
-
fg('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, fg('platform_editor_nested_dnd_styles_changes') ? firstNodeWithNotMarginTopWithNestedDnD : firstNodeWithNotMarginTop, rendererTableStyles, isStickyScrollbarEnabled(appearance) && stickyScrollbarStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? isCompactModeEnabled ? scaledDenseEmojiStyles : scaledEmojiStyles : isCompactModeEnabled ? denseStyles : undefined, editorExperiment('platform_synced_block', true) && syncBlockStyles, centerWrapperStyles, editorExperiment('platform_synced_block', true) && isInsideSyncBlock && fg('platform_synced_block_patch_9') ? syncBlockRendererStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2632
|
+
fg('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, fg('platform_editor_nested_dnd_styles_changes') ? firstNodeWithNotMarginTopWithNestedDnD : firstNodeWithNotMarginTop, rendererTableStyles, isStickyScrollbarEnabled(appearance) && stickyScrollbarStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? isCompactModeEnabled ? scaledDenseEmojiStyles : scaledEmojiStyles : isCompactModeEnabled ? denseStyles : undefined, editorExperiment('platform_synced_block', true) && syncBlockStyles, centerWrapperStyles, editorExperiment('platform_synced_block', true) && isInsideSyncBlock && fg('platform_synced_block_patch_9') ? syncBlockRendererStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2616
2633
|
"data-testid": testId
|
|
2617
2634
|
}, children);
|
|
2618
2635
|
};
|
|
@@ -57,7 +57,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
57
57
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
58
58
|
const RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
59
59
|
const packageName = "@atlaskit/renderer";
|
|
60
|
-
const packageVersion = "
|
|
60
|
+
const packageVersion = "0.0.0-development";
|
|
61
61
|
const setAsQueryContainerStyles = css({
|
|
62
62
|
containerName: 'ak-renderer-wrapper',
|
|
63
63
|
containerType: 'inline-size'
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
2
|
+
/**
|
|
3
|
+
* Checks whether any cell in the first row of the table has a colwidth attribute set.
|
|
4
|
+
*
|
|
5
|
+
* This mirrors `hasTableColumnBeenResized` from editor-plugin-table's `colgroup.ts`.
|
|
6
|
+
*/
|
|
7
|
+
export var hasColWidths = function hasColWidths(tableNode) {
|
|
8
|
+
var firstRow = tableNode.content.firstChild;
|
|
9
|
+
if (!firstRow) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
for (var i = 0; i < firstRow.childCount; i++) {
|
|
13
|
+
if (firstRow.child(i).attrs.colwidth) {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Mirrors `isContentModeSupported()` from editor-plugin-table's `tableMode.ts`.
|
|
21
|
+
*
|
|
22
|
+
* In the editor this checks `allowColumnResizing && allowTableResizing && isFullPageEditor`.
|
|
23
|
+
* In the renderer there is no separate `allowColumnResizing` flag — `allowTableResizing`
|
|
24
|
+
* covers both — and `isFullPageEditor` maps to `rendererAppearance === 'full-page'`.
|
|
25
|
+
*/
|
|
26
|
+
var isContentModeSupported = function isContentModeSupported(_ref) {
|
|
27
|
+
var allowTableResizing = _ref.allowTableResizing,
|
|
28
|
+
rendererAppearance = _ref.rendererAppearance;
|
|
29
|
+
return !!allowTableResizing && (rendererAppearance === 'full-page' || rendererAppearance === 'full-width' || rendererAppearance === 'max');
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Determines whether a table should render in content mode.
|
|
34
|
+
*
|
|
35
|
+
* Content mode tables have no fixed column widths — the browser sizes columns to fit their
|
|
36
|
+
* content (table-layout: auto). A table is in content mode when:
|
|
37
|
+
*
|
|
38
|
+
* 1. The feature is supported (table resizing enabled, full-page appearance)
|
|
39
|
+
* 2. The table is at the top level of the document (not nested in another table or block node)
|
|
40
|
+
* 3. The table node exists
|
|
41
|
+
* 4. `table.attrs.width` is null (no explicit width set by the user)
|
|
42
|
+
* 5. No cells in the first row have `colwidth` set (table has not been column-resized)
|
|
43
|
+
* 6. The `platform_editor_table_fit_to_content_auto_convert` experiment is enabled
|
|
44
|
+
*
|
|
45
|
+
* This mirrors `isTableInContentMode()` from editor-plugin-table's `tableMode.ts`.
|
|
46
|
+
*
|
|
47
|
+
* SSR-safe: `expValEquals` returns false on the server (FeatureGates not initialised),
|
|
48
|
+
* so content mode is never active during SSR — no hydration mismatch.
|
|
49
|
+
*/
|
|
50
|
+
export var isTableInContentMode = function isTableInContentMode(_ref2) {
|
|
51
|
+
var tableNode = _ref2.tableNode,
|
|
52
|
+
allowTableResizing = _ref2.allowTableResizing,
|
|
53
|
+
rendererAppearance = _ref2.rendererAppearance,
|
|
54
|
+
isTableNested = _ref2.isTableNested;
|
|
55
|
+
if (!expValEqualsNoExposure('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true)) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
if (!tableNode) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
61
|
+
return !isTableNested && isContentModeSupported({
|
|
62
|
+
allowTableResizing: allowTableResizing,
|
|
63
|
+
rendererAppearance: rendererAppearance
|
|
64
|
+
}) && tableNode.attrs.width === null && !hasColWidths(tableNode) && tableNode.attrs.layout === 'align-start';
|
|
65
|
+
};
|
|
@@ -4,6 +4,8 @@ import { Colgroup, colWidthSum } from './colgroup';
|
|
|
4
4
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
5
5
|
import { akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
+
import { isTableInContentMode } from './content-mode';
|
|
7
9
|
export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
8
10
|
var _tableNode$attrs;
|
|
9
11
|
var innerRef = _ref.innerRef,
|
|
@@ -46,6 +48,12 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
46
48
|
}
|
|
47
49
|
var tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
|
|
48
50
|
var tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
|
|
51
|
+
var isContentMode = isTableInContentMode({
|
|
52
|
+
tableNode: tableNode,
|
|
53
|
+
allowTableResizing: allowTableResizing,
|
|
54
|
+
rendererAppearance: rendererAppearance,
|
|
55
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
56
|
+
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
49
57
|
return /*#__PURE__*/React.createElement("table", _extends({}, fg('platform_renderer_isPresentational') && {
|
|
50
58
|
role: isPresentational ? 'presentation' : undefined
|
|
51
59
|
}, {
|
|
@@ -54,6 +62,7 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
54
62
|
"data-table-width": tableWidth,
|
|
55
63
|
"data-layout": tableLayout,
|
|
56
64
|
"data-table-display-mode": tableDisplayMode,
|
|
65
|
+
"data-initial-width-mode": isContentMode ? 'content' : undefined,
|
|
57
66
|
ref: innerRef,
|
|
58
67
|
style: {
|
|
59
68
|
marginTop: fixTableSSRResizing ? '0px' : ''
|
|
@@ -6,6 +6,8 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
9
|
+
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; }
|
|
10
|
+
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; }
|
|
9
11
|
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
10
12
|
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
13
|
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
@@ -31,6 +33,7 @@ import { isCommentAppearance, isFullPageAppearance, isFullWidthAppearance, isFul
|
|
|
31
33
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
32
34
|
import { TableProcessorWithContainerStyles } from './tableNew';
|
|
33
35
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
36
|
+
import { isTableInContentMode } from './table/content-mode';
|
|
34
37
|
export var isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
35
38
|
return isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance);
|
|
36
39
|
};
|
|
@@ -511,19 +514,29 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
511
514
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
512
515
|
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? fixTableSSRResizing ? "calc(".concat(tableWidthCSS, ")") : tableWidth : 'inherit';
|
|
513
516
|
}
|
|
517
|
+
var isContentModeTable = isTableInContentMode({
|
|
518
|
+
tableNode: tableNode,
|
|
519
|
+
allowTableResizing: allowTableResizing,
|
|
520
|
+
rendererAppearance: rendererAppearance,
|
|
521
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
522
|
+
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
514
523
|
var style;
|
|
515
524
|
if (fixTableSSRResizing) {
|
|
516
|
-
style = {
|
|
525
|
+
style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
526
|
+
'--renderer-table-max-width': renderWidthCSS
|
|
527
|
+
}), {}, {
|
|
517
528
|
width: finalTableContainerWidth,
|
|
518
529
|
left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
|
|
519
530
|
marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
|
|
520
|
-
};
|
|
531
|
+
});
|
|
521
532
|
} else {
|
|
522
|
-
style = {
|
|
533
|
+
style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
534
|
+
'--renderer-table-max-width': "".concat(renderWidth, "px")
|
|
535
|
+
}), {}, {
|
|
523
536
|
width: finalTableContainerWidth,
|
|
524
537
|
left: left,
|
|
525
538
|
marginLeft: shouldCalculateLeftForAlignment && left !== undefined ? -left : undefined
|
|
526
|
-
};
|
|
539
|
+
});
|
|
527
540
|
}
|
|
528
541
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
529
542
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
@@ -27,6 +27,7 @@ import { Table } from './table/table';
|
|
|
27
27
|
import { isCommentAppearance, isFullWidthOrFullPageAppearance, isFullWidthAppearance, isMaxWidthAppearance, isFullPageAppearance } from '../utils/appearance';
|
|
28
28
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
29
29
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
30
|
+
import { isTableInContentMode } from './table/content-mode';
|
|
30
31
|
var stickyContainerBaseStyles = {
|
|
31
32
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
32
33
|
height: "var(--ds-space-250, 20px)",
|
|
@@ -471,11 +472,19 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
471
472
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
472
473
|
finalTableContainerWidth = ((tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'align-start' || (tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout) === 'center') && tableNode !== null && tableNode !== void 0 && tableNode.attrs.width ? "calc(".concat(tableWidthCSS, ")") : 'inherit';
|
|
473
474
|
}
|
|
474
|
-
var
|
|
475
|
+
var isContentModeTable = isTableInContentMode({
|
|
476
|
+
tableNode: tableNode,
|
|
477
|
+
allowTableResizing: allowTableResizing,
|
|
478
|
+
rendererAppearance: rendererAppearance,
|
|
479
|
+
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
480
|
+
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
481
|
+
var style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
482
|
+
'--renderer-table-max-width': renderWidthCSS
|
|
483
|
+
}), {}, {
|
|
475
484
|
width: finalTableContainerWidth,
|
|
476
485
|
left: leftCSS ? "calc(".concat(leftCSS, ")") : undefined,
|
|
477
486
|
marginLeft: shouldCalculateLeftForAlignment && leftCSS !== undefined ? "calc(-1 * (".concat(leftCSS, "))") : undefined
|
|
478
|
-
};
|
|
487
|
+
});
|
|
479
488
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
480
489
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
481
490
|
className: "".concat(TableSharedCssClassName.TABLE_CONTAINER, " ").concat(this.props.shadowClassNames || ''),
|
|
@@ -1453,6 +1453,10 @@ var tableSharedStyle = css(_defineProperty(_defineProperty(_defineProperty(_defi
|
|
|
1453
1453
|
'&[data-autosize="true"]': {
|
|
1454
1454
|
tableLayout: 'auto'
|
|
1455
1455
|
},
|
|
1456
|
+
'&[data-initial-width-mode="content"]': {
|
|
1457
|
+
tableLayout: 'auto',
|
|
1458
|
+
width: 'auto'
|
|
1459
|
+
},
|
|
1456
1460
|
'*': {
|
|
1457
1461
|
boxSizing: 'border-box'
|
|
1458
1462
|
},
|
|
@@ -1493,6 +1497,14 @@ var tableSharedStyle = css(_defineProperty(_defineProperty(_defineProperty(_defi
|
|
|
1493
1497
|
}))
|
|
1494
1498
|
}
|
|
1495
1499
|
}));
|
|
1500
|
+
var tableContentModeStyles = css(_defineProperty(_defineProperty({}, ".".concat(RendererCssClassName.DOCUMENT, " .").concat(TableSharedCssClassName.TABLE_CONTAINER, ":has(table[data-initial-width-mode=\"content\"])"), {
|
|
1501
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
1502
|
+
width: 'max-content !important',
|
|
1503
|
+
maxWidth: 'var(--renderer-table-max-width)'
|
|
1504
|
+
}), ".".concat(RendererCssClassName.DOCUMENT, " table[data-initial-width-mode=\"content\"] > colgroup > col"), {
|
|
1505
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles
|
|
1506
|
+
width: 'unset !important'
|
|
1507
|
+
}));
|
|
1496
1508
|
var tableRendererHeaderStylesForTableCellOnly = css(_defineProperty({}, ".".concat(TableSharedCssClassName.TABLE_CONTAINER, " > table,\n\t\t.").concat(TableSharedCssClassName.TABLE_NODE_WRAPPER, " > table,\n\t\t.").concat(TableSharedCssClassName.TABLE_STICKY_WRAPPER, " > table"), {
|
|
1497
1509
|
'> tbody > tr > th, > tbody > tr > td': {
|
|
1498
1510
|
minWidth: "".concat(tableCellMinWidth, "px"),
|
|
@@ -2056,7 +2068,7 @@ export var RendererStyleContainer = function RendererStyleContainer(props) {
|
|
|
2056
2068
|
// this should be placed after baseOtherStyles
|
|
2057
2069
|
expValEquals('platform_editor_render_bodied_extension_as_inline', 'isEnabled', true) && (expValEquals('platform_editor_remove_important_in_render_ext', 'isEnabled', true) ? extensionAsInlineStyle : oldExtensionAsInlineStyle), inlineExtensionRendererMarginFix, allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? alignedHeadingAnchorStyle : alignedHeadingAnchorStyleDuplicateAnchor), mediaSingleSharedStyle,
|
|
2058
2070
|
// merge firstWrappedMediaStyles with mediaSingleSharedStyle when clean up platform_editor_fix_media_in_renderer
|
|
2059
|
-
fg('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, fg('platform_editor_nested_dnd_styles_changes') ? firstNodeWithNotMarginTopWithNestedDnD : firstNodeWithNotMarginTop, rendererTableStyles, isStickyScrollbarEnabled(appearance) && stickyScrollbarStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? isCompactModeEnabled ? scaledDenseEmojiStyles : scaledEmojiStyles : isCompactModeEnabled ? denseStyles : undefined, editorExperiment('platform_synced_block', true) && syncBlockStyles, centerWrapperStyles, editorExperiment('platform_synced_block', true) && isInsideSyncBlock && fg('platform_synced_block_patch_9') ? syncBlockRendererStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2071
|
+
fg('platform_editor_fix_media_in_renderer') && firstWrappedMediaStyles, tableSharedStyle, expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true) && tableContentModeStyles, tableRendererHeaderStylesForTableCellOnly, fg('platform_editor_bordered_panel_nested_in_table') && tableRendererNestedPanelStyles, isBackgroundClipBrowserFixNeeded() && tableStylesBackGroundClipForGeckoForTableCellOnly, fg('platform_editor_nested_dnd_styles_changes') ? firstNodeWithNotMarginTopWithNestedDnD : firstNodeWithNotMarginTop, rendererTableStyles, isStickyScrollbarEnabled(appearance) && stickyScrollbarStyles, rendererTableHeaderEqualHeightStylesForTableCellOnly, allowColumnSorting && rendererTableSortableColumnStyles, allowColumnSorting && allowNestedHeaderLinks && (expValEquals('platform_editor_copy_link_a11y_inconsistency_fix', 'isEnabled', true) ? rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinks : rendererTableHeaderEqualHeightStylesAllowNestedHeaderLinksDuplicateAnchor), rendererTableColumnStyles, stickyHeaderStyles, codeBlockAndLayoutStyles, columnLayoutSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveSharedStyle, isAdvancedLayoutsOn && columnLayoutResponsiveRendererStyles, isAdvancedLayoutsOn && layoutSectionForAdvancedLayoutsStyles, !useBlockRenderForCodeBlock && gridRenderForCodeBlockStyles, browser.safari && codeBlockInListSafariFixStyles, appearance === 'full-page' && !isPreviewPanelResponsivenessOn && responsiveBreakoutWidth, appearance === 'full-page' && isPreviewPanelResponsivenessOn && responsiveBreakoutWidthWithReducedPadding, (appearance === 'full-width' || appearance === 'max' && (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) || expValEquals('confluence_max_width_content_appearance', 'isEnabled', true))) && responsiveBreakoutWidthFullWidth, expValEquals('platform_editor_lovability_emoji_scaling', 'isEnabled', true) ? isCompactModeEnabled ? scaledDenseEmojiStyles : scaledEmojiStyles : isCompactModeEnabled ? denseStyles : undefined, editorExperiment('platform_synced_block', true) && syncBlockStyles, centerWrapperStyles, editorExperiment('platform_synced_block', true) && isInsideSyncBlock && fg('platform_synced_block_patch_9') ? syncBlockRendererStyles : null, expValEquals('platform_editor_hide_extension_renderer_support', 'isEnabled', true) && hideExtensionStyles],
|
|
2060
2072
|
"data-testid": testId
|
|
2061
2073
|
}, children);
|
|
2062
2074
|
};
|
|
@@ -62,7 +62,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
62
62
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
63
63
|
var RENDER_EVENT_SAMPLE_RATE = 0.2;
|
|
64
64
|
var packageName = "@atlaskit/renderer";
|
|
65
|
-
var packageVersion = "
|
|
65
|
+
var packageVersion = "0.0.0-development";
|
|
66
66
|
var setAsQueryContainerStyles = css({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { RendererAppearance } from '../../../ui/Renderer/types';
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether any cell in the first row of the table has a colwidth attribute set.
|
|
5
|
+
*
|
|
6
|
+
* This mirrors `hasTableColumnBeenResized` from editor-plugin-table's `colgroup.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const hasColWidths: (tableNode: PMNode) => boolean;
|
|
9
|
+
type ContentModeOptions = {
|
|
10
|
+
allowTableResizing?: boolean;
|
|
11
|
+
isTableNested?: boolean;
|
|
12
|
+
rendererAppearance?: RendererAppearance;
|
|
13
|
+
tableNode: PMNode | undefined;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Determines whether a table should render in content mode.
|
|
17
|
+
*
|
|
18
|
+
* Content mode tables have no fixed column widths — the browser sizes columns to fit their
|
|
19
|
+
* content (table-layout: auto). A table is in content mode when:
|
|
20
|
+
*
|
|
21
|
+
* 1. The feature is supported (table resizing enabled, full-page appearance)
|
|
22
|
+
* 2. The table is at the top level of the document (not nested in another table or block node)
|
|
23
|
+
* 3. The table node exists
|
|
24
|
+
* 4. `table.attrs.width` is null (no explicit width set by the user)
|
|
25
|
+
* 5. No cells in the first row have `colwidth` set (table has not been column-resized)
|
|
26
|
+
* 6. The `platform_editor_table_fit_to_content_auto_convert` experiment is enabled
|
|
27
|
+
*
|
|
28
|
+
* This mirrors `isTableInContentMode()` from editor-plugin-table's `tableMode.ts`.
|
|
29
|
+
*
|
|
30
|
+
* SSR-safe: `expValEquals` returns false on the server (FeatureGates not initialised),
|
|
31
|
+
* so content mode is never active during SSR — no hydration mismatch.
|
|
32
|
+
*/
|
|
33
|
+
export declare const isTableInContentMode: ({ tableNode, allowTableResizing, rendererAppearance, isTableNested, }: ContentModeOptions) => boolean;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { RendererAppearance } from '../../../ui/Renderer/types';
|
|
3
|
+
/**
|
|
4
|
+
* Checks whether any cell in the first row of the table has a colwidth attribute set.
|
|
5
|
+
*
|
|
6
|
+
* This mirrors `hasTableColumnBeenResized` from editor-plugin-table's `colgroup.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export declare const hasColWidths: (tableNode: PMNode) => boolean;
|
|
9
|
+
type ContentModeOptions = {
|
|
10
|
+
allowTableResizing?: boolean;
|
|
11
|
+
isTableNested?: boolean;
|
|
12
|
+
rendererAppearance?: RendererAppearance;
|
|
13
|
+
tableNode: PMNode | undefined;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Determines whether a table should render in content mode.
|
|
17
|
+
*
|
|
18
|
+
* Content mode tables have no fixed column widths — the browser sizes columns to fit their
|
|
19
|
+
* content (table-layout: auto). A table is in content mode when:
|
|
20
|
+
*
|
|
21
|
+
* 1. The feature is supported (table resizing enabled, full-page appearance)
|
|
22
|
+
* 2. The table is at the top level of the document (not nested in another table or block node)
|
|
23
|
+
* 3. The table node exists
|
|
24
|
+
* 4. `table.attrs.width` is null (no explicit width set by the user)
|
|
25
|
+
* 5. No cells in the first row have `colwidth` set (table has not been column-resized)
|
|
26
|
+
* 6. The `platform_editor_table_fit_to_content_auto_convert` experiment is enabled
|
|
27
|
+
*
|
|
28
|
+
* This mirrors `isTableInContentMode()` from editor-plugin-table's `tableMode.ts`.
|
|
29
|
+
*
|
|
30
|
+
* SSR-safe: `expValEquals` returns false on the server (FeatureGates not initialised),
|
|
31
|
+
* so content mode is never active during SSR — no hydration mismatch.
|
|
32
|
+
*/
|
|
33
|
+
export declare const isTableInContentMode: ({ tableNode, allowTableResizing, rendererAppearance, isTableNested, }: ContentModeOptions) => boolean;
|
|
34
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "129.0.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@atlaskit/adf-schema": "^52.
|
|
26
|
+
"@atlaskit/adf-schema": "^52.5.0",
|
|
27
27
|
"@atlaskit/adf-utils": "^19.27.0",
|
|
28
28
|
"@atlaskit/afm-i18n-platform-editor-renderer": "2.10.0",
|
|
29
29
|
"@atlaskit/analytics-listeners": "^10.0.0",
|
|
@@ -39,27 +39,27 @@
|
|
|
39
39
|
"@atlaskit/editor-smart-link-draggable": "^0.5.0",
|
|
40
40
|
"@atlaskit/emoji": "^70.0.0",
|
|
41
41
|
"@atlaskit/feature-gate-js-client": "^5.5.0",
|
|
42
|
-
"@atlaskit/icon": "^34.
|
|
42
|
+
"@atlaskit/icon": "^34.2.0",
|
|
43
43
|
"@atlaskit/link": "^3.4.0",
|
|
44
44
|
"@atlaskit/link-datasource": "^5.0.0",
|
|
45
45
|
"@atlaskit/link-extractors": "^2.4.0",
|
|
46
46
|
"@atlaskit/linking-common": "^9.11.0",
|
|
47
|
-
"@atlaskit/media-card": "^
|
|
47
|
+
"@atlaskit/media-card": "^80.0.0",
|
|
48
48
|
"@atlaskit/media-client": "^36.0.0",
|
|
49
49
|
"@atlaskit/media-client-react": "^5.0.0",
|
|
50
50
|
"@atlaskit/media-common": "^13.0.0",
|
|
51
51
|
"@atlaskit/media-filmstrip": "^51.2.0",
|
|
52
|
-
"@atlaskit/media-ui": "^
|
|
53
|
-
"@atlaskit/media-viewer": "^
|
|
52
|
+
"@atlaskit/media-ui": "^29.0.0",
|
|
53
|
+
"@atlaskit/media-viewer": "^53.0.0",
|
|
54
54
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
55
55
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
56
56
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.0",
|
|
57
|
-
"@atlaskit/react-ufo": "^5.
|
|
57
|
+
"@atlaskit/react-ufo": "^5.14.0",
|
|
58
58
|
"@atlaskit/smart-card": "^44.0.0",
|
|
59
59
|
"@atlaskit/status": "^4.0.0",
|
|
60
60
|
"@atlaskit/task-decision": "^20.0.0",
|
|
61
|
-
"@atlaskit/theme": "^23.
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^62.
|
|
61
|
+
"@atlaskit/theme": "^23.1.0",
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^62.4.0",
|
|
63
63
|
"@atlaskit/tokens": "^13.0.0",
|
|
64
64
|
"@atlaskit/tooltip": "^21.1.0",
|
|
65
65
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"uuid": "^3.1.0"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
76
|
-
"@atlaskit/editor-common": "^
|
|
76
|
+
"@atlaskit/editor-common": "^113.0.0",
|
|
77
77
|
"@atlaskit/link-provider": "^4.3.0",
|
|
78
78
|
"@atlaskit/media-core": "^37.0.0",
|
|
79
79
|
"react": "^18.2.0",
|
|
@@ -88,11 +88,11 @@
|
|
|
88
88
|
"@atlaskit/link-test-helpers": "^10.0.0",
|
|
89
89
|
"@atlaskit/media-core": "^37.0.0",
|
|
90
90
|
"@atlaskit/media-integration-test-helpers": "workspace:^",
|
|
91
|
-
"@atlaskit/media-test-helpers": "^
|
|
91
|
+
"@atlaskit/media-test-helpers": "^41.0.0",
|
|
92
92
|
"@atlaskit/mention": "^25.0.0",
|
|
93
93
|
"@atlaskit/modal-dialog": "^14.15.0",
|
|
94
94
|
"@atlaskit/navigation-system": "^7.3.0",
|
|
95
|
-
"@atlaskit/profilecard": "^
|
|
95
|
+
"@atlaskit/profilecard": "^25.0.0",
|
|
96
96
|
"@atlaskit/side-nav-items": "^1.13.0",
|
|
97
97
|
"@atlaskit/util-data-test": "^18.5.0",
|
|
98
98
|
"@atlassian/a11y-jest-testing": "^0.11.0",
|