@atlaskit/renderer 130.1.0 → 130.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/cjs/react/nodes/table/content-mode.js +2 -62
- package/dist/cjs/react/nodes/table/table.js +6 -3
- package/dist/cjs/react/nodes/table.js +6 -3
- package/dist/cjs/react/nodes/tableNew.js +6 -3
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/react/nodes/table/content-mode.js +1 -62
- package/dist/es2019/react/nodes/table/table.js +6 -3
- package/dist/es2019/react/nodes/table.js +6 -3
- package/dist/es2019/react/nodes/tableNew.js +6 -3
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/react/nodes/table/content-mode.js +1 -61
- package/dist/esm/react/nodes/table/table.js +6 -3
- package/dist/esm/react/nodes/table.js +6 -3
- package/dist/esm/react/nodes/tableNew.js +6 -3
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/react/nodes/table/content-mode.d.ts +1 -25
- package/dist/types-ts4.5/react/nodes/table/content-mode.d.ts +1 -25
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 130.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 130.2.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`3394e81c10e6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3394e81c10e6e) -
|
|
14
|
+
Fix table flicker on focus: defer data-initial-width-mode removal to after colgroup update.
|
|
15
|
+
Consolidate isTableInContentMode and hasTableBeenResized into editor-common/table.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 130.1.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
|
@@ -3,69 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
7
|
-
var
|
|
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) {
|
|
6
|
+
exports.isContentModeSupported = void 0;
|
|
7
|
+
var isContentModeSupported = exports.isContentModeSupported = function isContentModeSupported(_ref) {
|
|
33
8
|
var allowTableResizing = _ref.allowTableResizing,
|
|
34
9
|
rendererAppearance = _ref.rendererAppearance;
|
|
35
10
|
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
|
};
|
|
@@ -12,6 +12,7 @@ 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
14
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
|
+
var _table = require("@atlaskit/editor-common/table");
|
|
15
16
|
var _contentMode = require("./content-mode");
|
|
16
17
|
var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
17
18
|
var _tableNode$attrs;
|
|
@@ -55,10 +56,12 @@ var Table = exports.Table = /*#__PURE__*/_react.default.memo(function (_ref) {
|
|
|
55
56
|
}
|
|
56
57
|
var tableLayout = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.layout;
|
|
57
58
|
var tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
|
|
58
|
-
var isContentMode = (0,
|
|
59
|
+
var isContentMode = (0, _table.isTableInContentMode)({
|
|
59
60
|
tableNode: tableNode,
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
isSupported: (0, _contentMode.isContentModeSupported)({
|
|
62
|
+
allowTableResizing: allowTableResizing,
|
|
63
|
+
rendererAppearance: rendererAppearance
|
|
64
|
+
}),
|
|
62
65
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
63
66
|
}) && (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
64
67
|
return /*#__PURE__*/_react.default.createElement("table", (0, _extends2.default)({}, (0, _platformFeatureFlags.fg)('platform_renderer_isPresentational') && {
|
|
@@ -33,6 +33,7 @@ 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 _table2 = require("@atlaskit/editor-common/table");
|
|
36
37
|
var _contentMode = require("./table/content-mode");
|
|
37
38
|
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
39
|
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; }
|
|
@@ -521,10 +522,12 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
521
522
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
522
523
|
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';
|
|
523
524
|
}
|
|
524
|
-
var isContentModeTable = (0,
|
|
525
|
+
var isContentModeTable = (0, _table2.isTableInContentMode)({
|
|
525
526
|
tableNode: tableNode,
|
|
526
|
-
|
|
527
|
-
|
|
527
|
+
isSupported: (0, _contentMode.isContentModeSupported)({
|
|
528
|
+
allowTableResizing: allowTableResizing,
|
|
529
|
+
rendererAppearance: rendererAppearance
|
|
530
|
+
}),
|
|
528
531
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
529
532
|
}) && (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
530
533
|
var style;
|
|
@@ -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 _table2 = require("@atlaskit/editor-common/table");
|
|
29
30
|
var _contentMode = require("./table/content-mode");
|
|
30
31
|
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; }
|
|
31
32
|
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; }
|
|
@@ -478,10 +479,12 @@ var TableContainer = exports.TableContainer = /*#__PURE__*/function (_React$Comp
|
|
|
478
479
|
// instead of 760 that was set on tableNode when the table had been published.
|
|
479
480
|
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';
|
|
480
481
|
}
|
|
481
|
-
var isContentModeTable = (0,
|
|
482
|
+
var isContentModeTable = (0, _table2.isTableInContentMode)({
|
|
482
483
|
tableNode: tableNode,
|
|
483
|
-
|
|
484
|
-
|
|
484
|
+
isSupported: (0, _contentMode.isContentModeSupported)({
|
|
485
|
+
allowTableResizing: allowTableResizing,
|
|
486
|
+
rendererAppearance: rendererAppearance
|
|
487
|
+
}),
|
|
485
488
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
486
489
|
}) && (0, _expValEquals.expValEquals)('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
487
490
|
var style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
@@ -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 = "130.0
|
|
74
|
+
var packageVersion = "130.2.0";
|
|
75
75
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
76
76
|
containerName: 'ak-renderer-wrapper',
|
|
77
77
|
containerType: 'inline-size'
|
|
@@ -1,67 +1,6 @@
|
|
|
1
|
-
|
|
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 = ({
|
|
1
|
+
export const isContentModeSupported = ({
|
|
27
2
|
allowTableResizing,
|
|
28
3
|
rendererAppearance
|
|
29
4
|
}) => {
|
|
30
5
|
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
6
|
};
|
|
@@ -5,7 +5,8 @@ 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
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
-
import { isTableInContentMode } from '
|
|
8
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
9
|
+
import { isContentModeSupported } from './content-mode';
|
|
9
10
|
export const Table = /*#__PURE__*/React.memo(({
|
|
10
11
|
innerRef,
|
|
11
12
|
isNumberColumnEnabled,
|
|
@@ -49,8 +50,10 @@ export const Table = /*#__PURE__*/React.memo(({
|
|
|
49
50
|
const tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
|
|
50
51
|
const isContentMode = isTableInContentMode({
|
|
51
52
|
tableNode,
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
isSupported: isContentModeSupported({
|
|
54
|
+
allowTableResizing,
|
|
55
|
+
rendererAppearance
|
|
56
|
+
}),
|
|
54
57
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
55
58
|
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
56
59
|
return /*#__PURE__*/React.createElement("table", _extends({}, fg('platform_renderer_isPresentational') && {
|
|
@@ -20,7 +20,8 @@ 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 '
|
|
23
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
24
|
+
import { isContentModeSupported } from './table/content-mode';
|
|
24
25
|
export const isTableResizingEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance);
|
|
25
26
|
export const isStickyScrollbarEnabled = appearance => isFullWidthOrFullPageAppearance(appearance) && editorExperiment('platform_renderer_table_sticky_scrollbar', true, {
|
|
26
27
|
exposure: true
|
|
@@ -464,8 +465,10 @@ export class TableContainer extends React.Component {
|
|
|
464
465
|
}
|
|
465
466
|
const isContentModeTable = isTableInContentMode({
|
|
466
467
|
tableNode,
|
|
467
|
-
|
|
468
|
-
|
|
468
|
+
isSupported: isContentModeSupported({
|
|
469
|
+
allowTableResizing,
|
|
470
|
+
rendererAppearance
|
|
471
|
+
}),
|
|
469
472
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
470
473
|
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
471
474
|
let style;
|
|
@@ -15,7 +15,8 @@ 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 '
|
|
18
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
19
|
+
import { isContentModeSupported } from './table/content-mode';
|
|
19
20
|
const stickyContainerBaseStyles = {
|
|
20
21
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
21
22
|
height: "var(--ds-space-250, 20px)",
|
|
@@ -424,8 +425,10 @@ export class TableContainer extends React.Component {
|
|
|
424
425
|
}
|
|
425
426
|
const isContentModeTable = isTableInContentMode({
|
|
426
427
|
tableNode,
|
|
427
|
-
|
|
428
|
-
|
|
428
|
+
isSupported: isContentModeSupported({
|
|
429
|
+
allowTableResizing,
|
|
430
|
+
rendererAppearance
|
|
431
|
+
}),
|
|
429
432
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
430
433
|
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
431
434
|
const style = {
|
|
@@ -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 = "130.0
|
|
60
|
+
const packageVersion = "130.2.0";
|
|
61
61
|
const setAsQueryContainerStyles = css({
|
|
62
62
|
containerName: 'ak-renderer-wrapper',
|
|
63
63
|
containerType: 'inline-size'
|
|
@@ -1,65 +1,5 @@
|
|
|
1
|
-
|
|
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) {
|
|
1
|
+
export var isContentModeSupported = function isContentModeSupported(_ref) {
|
|
27
2
|
var allowTableResizing = _ref.allowTableResizing,
|
|
28
3
|
rendererAppearance = _ref.rendererAppearance;
|
|
29
4
|
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
5
|
};
|
|
@@ -5,7 +5,8 @@ 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
7
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
|
-
import { isTableInContentMode } from '
|
|
8
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
9
|
+
import { isContentModeSupported } from './content-mode';
|
|
9
10
|
export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
10
11
|
var _tableNode$attrs;
|
|
11
12
|
var innerRef = _ref.innerRef,
|
|
@@ -50,8 +51,10 @@ export var Table = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
50
51
|
var tableDisplayMode = tableNode === null || tableNode === void 0 ? void 0 : tableNode.attrs.displayMode;
|
|
51
52
|
var isContentMode = isTableInContentMode({
|
|
52
53
|
tableNode: tableNode,
|
|
53
|
-
|
|
54
|
-
|
|
54
|
+
isSupported: isContentModeSupported({
|
|
55
|
+
allowTableResizing: allowTableResizing,
|
|
56
|
+
rendererAppearance: rendererAppearance
|
|
57
|
+
}),
|
|
55
58
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
56
59
|
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
57
60
|
return /*#__PURE__*/React.createElement("table", _extends({}, fg('platform_renderer_isPresentational') && {
|
|
@@ -33,7 +33,8 @@ import { isCommentAppearance, isFullPageAppearance, isFullWidthAppearance, isFul
|
|
|
33
33
|
import { TableStickyScrollbar } from './TableStickyScrollbar';
|
|
34
34
|
import { TableProcessorWithContainerStyles } from './tableNew';
|
|
35
35
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
36
|
-
import { isTableInContentMode } from '
|
|
36
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
37
|
+
import { isContentModeSupported } from './table/content-mode';
|
|
37
38
|
export var isTableResizingEnabled = function isTableResizingEnabled(appearance) {
|
|
38
39
|
return isFullWidthOrFullPageAppearance(appearance) || isCommentAppearance(appearance);
|
|
39
40
|
};
|
|
@@ -516,8 +517,10 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
516
517
|
}
|
|
517
518
|
var isContentModeTable = isTableInContentMode({
|
|
518
519
|
tableNode: tableNode,
|
|
519
|
-
|
|
520
|
-
|
|
520
|
+
isSupported: isContentModeSupported({
|
|
521
|
+
allowTableResizing: allowTableResizing,
|
|
522
|
+
rendererAppearance: rendererAppearance
|
|
523
|
+
}),
|
|
521
524
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
522
525
|
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
523
526
|
var style;
|
|
@@ -27,7 +27,8 @@ 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 '
|
|
30
|
+
import { isTableInContentMode } from '@atlaskit/editor-common/table';
|
|
31
|
+
import { isContentModeSupported } from './table/content-mode';
|
|
31
32
|
var stickyContainerBaseStyles = {
|
|
32
33
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/enforce-style-prop -- Ignored via go/DSP-18766
|
|
33
34
|
height: "var(--ds-space-250, 20px)",
|
|
@@ -474,8 +475,10 @@ export var TableContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
474
475
|
}
|
|
475
476
|
var isContentModeTable = isTableInContentMode({
|
|
476
477
|
tableNode: tableNode,
|
|
477
|
-
|
|
478
|
-
|
|
478
|
+
isSupported: isContentModeSupported({
|
|
479
|
+
allowTableResizing: allowTableResizing,
|
|
480
|
+
rendererAppearance: rendererAppearance
|
|
481
|
+
}),
|
|
479
482
|
isTableNested: isInsideOfBlockNode || isInsideOfTable
|
|
480
483
|
}) && expValEquals('platform_editor_table_fit_to_content_auto_convert', 'isEnabled', true);
|
|
481
484
|
var style = _objectSpread(_objectSpread({}, isContentModeTable && {
|
|
@@ -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 = "130.0
|
|
65
|
+
var packageVersion = "130.2.0";
|
|
66
66
|
var setAsQueryContainerStyles = css({
|
|
67
67
|
containerName: 'ak-renderer-wrapper',
|
|
68
68
|
containerType: 'inline-size'
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
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
3
|
type ContentModeOptions = {
|
|
10
4
|
allowTableResizing?: boolean;
|
|
11
5
|
isTableNested?: boolean;
|
|
12
6
|
rendererAppearance?: RendererAppearance;
|
|
13
7
|
tableNode: PMNode | undefined;
|
|
14
8
|
};
|
|
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;
|
|
9
|
+
export declare const isContentModeSupported: ({ allowTableResizing, rendererAppearance, }: Pick<ContentModeOptions, "allowTableResizing" | "rendererAppearance">) => boolean;
|
|
34
10
|
export {};
|
|
@@ -1,34 +1,10 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
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
3
|
type ContentModeOptions = {
|
|
10
4
|
allowTableResizing?: boolean;
|
|
11
5
|
isTableNested?: boolean;
|
|
12
6
|
rendererAppearance?: RendererAppearance;
|
|
13
7
|
tableNode: PMNode | undefined;
|
|
14
8
|
};
|
|
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;
|
|
9
|
+
export declare const isContentModeSupported: ({ allowTableResizing, rendererAppearance, }: Pick<ContentModeOptions, "allowTableResizing" | "rendererAppearance">) => boolean;
|
|
34
10
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "130.1
|
|
3
|
+
"version": "130.2.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"@atlaskit/status": "^4.0.0",
|
|
60
60
|
"@atlaskit/task-decision": "^20.0.0",
|
|
61
61
|
"@atlaskit/theme": "^23.1.0",
|
|
62
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
62
|
+
"@atlaskit/tmp-editor-statsig": "^63.0.0",
|
|
63
63
|
"@atlaskit/tokens": "^13.0.0",
|
|
64
64
|
"@atlaskit/tooltip": "^21.1.0",
|
|
65
65
|
"@atlaskit/visually-hidden": "^3.0.0",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^3.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^114.
|
|
75
|
+
"@atlaskit/editor-common": "^114.2.0",
|
|
76
76
|
"@atlaskit/link-provider": "^4.3.0",
|
|
77
77
|
"@atlaskit/media-core": "^37.0.0",
|
|
78
78
|
"react": "^18.2.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@atlaskit/media-test-helpers": "^41.0.0",
|
|
92
92
|
"@atlaskit/mention": "^25.0.0",
|
|
93
93
|
"@atlaskit/modal-dialog": "^14.15.0",
|
|
94
|
-
"@atlaskit/navigation-system": "^
|
|
94
|
+
"@atlaskit/navigation-system": "^8.0.0",
|
|
95
95
|
"@atlaskit/profilecard": "^25.1.0",
|
|
96
96
|
"@atlaskit/side-nav-items": "^1.13.0",
|
|
97
97
|
"@atlaskit/util-data-test": "^18.5.0",
|