@atlaskit/editor-plugin-table 12.1.14 → 12.2.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 +25 -0
- package/afm-cc/tsconfig.json +6 -0
- package/afm-dev-agents/tsconfig.json +6 -0
- package/afm-jira/tsconfig.json +6 -0
- package/afm-passionfruit/tsconfig.json +120 -0
- package/afm-post-office/tsconfig.json +6 -0
- package/afm-rovo-extension/tsconfig.json +6 -0
- package/afm-townsquare/tsconfig.json +6 -0
- package/afm-volt/tsconfig.json +13 -4
- package/dist/cjs/nodeviews/TableComponent.js +77 -26
- package/dist/cjs/nodeviews/TableContainer.js +270 -10
- package/dist/cjs/nodeviews/TableResizer.js +9 -2
- package/dist/cjs/nodeviews/TableRow.js +24 -1
- package/dist/cjs/nodeviews/table-node-views.js +1 -1
- package/dist/cjs/nodeviews/table.js +22 -7
- package/dist/cjs/nodeviews/toDOM.js +23 -7
- package/dist/cjs/pm-plugins/main.js +57 -22
- package/dist/cjs/pm-plugins/table-resizing/utils/colgroup.js +72 -1
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +70 -1
- package/dist/cjs/tablePlugin.js +17 -3
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +2 -7
- package/dist/es2019/nodeviews/TableComponent.js +80 -26
- package/dist/es2019/nodeviews/TableContainer.js +256 -2
- package/dist/es2019/nodeviews/TableResizer.js +9 -2
- package/dist/es2019/nodeviews/TableRow.js +24 -1
- package/dist/es2019/nodeviews/table-node-views.js +1 -1
- package/dist/es2019/nodeviews/table.js +21 -6
- package/dist/es2019/nodeviews/toDOM.js +24 -8
- package/dist/es2019/pm-plugins/main.js +57 -22
- package/dist/es2019/pm-plugins/table-resizing/utils/colgroup.js +72 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +70 -1
- package/dist/es2019/tablePlugin.js +17 -3
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +5 -14
- package/dist/esm/nodeviews/TableComponent.js +77 -26
- package/dist/esm/nodeviews/TableContainer.js +270 -10
- package/dist/esm/nodeviews/TableResizer.js +9 -2
- package/dist/esm/nodeviews/TableRow.js +24 -1
- package/dist/esm/nodeviews/table-node-views.js +1 -1
- package/dist/esm/nodeviews/table.js +22 -7
- package/dist/esm/nodeviews/toDOM.js +24 -8
- package/dist/esm/pm-plugins/main.js +57 -22
- package/dist/esm/pm-plugins/table-resizing/utils/colgroup.js +74 -3
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +70 -1
- package/dist/esm/tablePlugin.js +17 -3
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -6
- package/dist/types/nodeviews/ExternalDropTargets.d.ts +1 -1
- package/dist/types/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types/nodeviews/TableContainer.d.ts +7 -2
- package/dist/types/nodeviews/TableResizer.d.ts +1 -1
- package/dist/types/nodeviews/TableRow.d.ts +3 -1
- package/dist/types/nodeviews/table.d.ts +1 -1
- package/dist/types/nodeviews/toDOM.d.ts +5 -0
- package/dist/types/nodeviews/types.d.ts +1 -0
- package/dist/types/pm-plugins/analytics/commands.d.ts +2 -2
- package/dist/types/pm-plugins/analytics/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/analytics/utils/moved-event.d.ts +1 -1
- package/dist/types/pm-plugins/commands/column-resize.d.ts +10 -10
- package/dist/types/pm-plugins/commands/commands-with-analytics.d.ts +1 -1
- package/dist/types/pm-plugins/commands/go-to-next-cell.d.ts +1 -1
- package/dist/types/pm-plugins/commands/misc.d.ts +2 -2
- package/dist/types/pm-plugins/commands/selection.d.ts +6 -6
- package/dist/types/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +3 -3
- package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types/pm-plugins/drag-and-drop/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -0
- package/dist/types/pm-plugins/table-resizing/utils/misc.d.ts +41 -0
- package/dist/types/pm-plugins/utils/create.d.ts +10 -10
- package/dist/types/pm-plugins/utils/decoration.d.ts +3 -3
- package/dist/types/pm-plugins/utils/dom.d.ts +2 -2
- package/dist/types/pm-plugins/utils/drag-menu.d.ts +3 -3
- package/dist/types/pm-plugins/utils/merged-cells.d.ts +3 -2
- package/dist/types/tablePluginType.d.ts +2 -0
- package/dist/types/ui/DragHandle/index.d.ts +4 -14
- package/dist/types/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -7
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -14
- package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
- package/dist/types/ui/TableFloatingControls/index.d.ts +1 -7
- package/dist/types/ui/global-styles.d.ts +2 -8
- package/dist/types/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/ExternalDropTargets.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableComponent.d.ts +1 -0
- package/dist/types-ts4.5/nodeviews/TableContainer.d.ts +7 -2
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/TableRow.d.ts +3 -1
- package/dist/types-ts4.5/nodeviews/table.d.ts +1 -1
- package/dist/types-ts4.5/nodeviews/toDOM.d.ts +5 -0
- package/dist/types-ts4.5/nodeviews/types.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/analytics/commands.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/analytics/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/analytics/utils/moved-event.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/column-resize.d.ts +10 -10
- package/dist/types-ts4.5/pm-plugins/commands/commands-with-analytics.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/go-to-next-cell.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/commands/misc.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/commands/selection.d.ts +6 -6
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands-with-analytics.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/colgroup.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/misc.d.ts +41 -0
- package/dist/types-ts4.5/pm-plugins/utils/create.d.ts +10 -10
- package/dist/types-ts4.5/pm-plugins/utils/decoration.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/utils/dom.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/utils/drag-menu.d.ts +3 -3
- package/dist/types-ts4.5/pm-plugins/utils/merged-cells.d.ts +3 -2
- package/dist/types-ts4.5/tablePluginType.d.ts +2 -0
- package/dist/types-ts4.5/ui/DragHandle/index.d.ts +4 -14
- package/dist/types-ts4.5/ui/TableFloatingColumnControls/ColumnControls/index.d.ts +1 -7
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +4 -14
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +1 -1
- package/dist/types-ts4.5/ui/TableFloatingControls/index.d.ts +1 -7
- package/dist/types-ts4.5/ui/global-styles.d.ts +2 -8
- package/dist/types-ts4.5/ui/hooks/useInternalTablePluginStateSelector.d.ts +1 -1
- package/package.json +10 -11
- package/src/nodeviews/TableComponent.tsx +113 -23
- package/src/nodeviews/TableContainer.tsx +331 -2
- package/src/nodeviews/TableResizer.tsx +10 -5
- package/src/nodeviews/TableRow.ts +38 -1
- package/src/nodeviews/table-node-views.ts +1 -1
- package/src/nodeviews/table.tsx +23 -0
- package/src/nodeviews/toDOM.ts +75 -9
- package/src/nodeviews/types.ts +1 -0
- package/src/pm-plugins/main.ts +41 -18
- package/src/pm-plugins/table-resizing/utils/colgroup.ts +139 -6
- package/src/pm-plugins/table-resizing/utils/misc.ts +87 -0
- package/src/tablePlugin.tsx +21 -0
- package/src/tablePluginType.ts +2 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +5 -14
- package/tsconfig.app.json +6 -0
- package/types/package.json +1 -1
- package/ui/common-styles/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { tableCellMinWidth } from '@atlaskit/editor-common/styles';
|
|
2
|
-
import { getFragmentBackingArray } from '@atlaskit/editor-common/utils';
|
|
2
|
+
import { calcTableColumnWidths, getFragmentBackingArray } from '@atlaskit/editor-common/utils';
|
|
3
3
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
4
|
+
import { akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
4
5
|
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
5
|
-
import { COLUMN_MIN_WIDTH } from './consts';
|
|
6
|
-
import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from './misc';
|
|
6
|
+
import { COLUMN_MIN_WIDTH, MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION } from './consts';
|
|
7
|
+
import { getScalingPercentForTableWithoutWidth, getTableContainerElementWidth, getTableScalingPercent } from './misc';
|
|
7
8
|
/**
|
|
8
9
|
* This ensures the combined width of the columns (and tbody) of table is always smaller or equal
|
|
9
10
|
* than the table and table wrapper elements. This is necessary as there is no longer
|
|
@@ -11,6 +12,73 @@ import { getScalingPercentForTableWithoutWidth, getTableScalingPercent } from '.
|
|
|
11
12
|
* overflow.
|
|
12
13
|
*/
|
|
13
14
|
export const getColWidthFix = (colwidth, tableColumnCount) => colwidth - 1 / tableColumnCount;
|
|
15
|
+
const generateColStyle = (fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth, hasTableBeenResized) => {
|
|
16
|
+
const maxScalingPercent = shouldUseIncreasedScalingPercent ? MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION : MAX_SCALING_PERCENT;
|
|
17
|
+
const maxScaledRatio = 1 - maxScalingPercent;
|
|
18
|
+
const isFullPageEditor = !isChromelessEditor && !isCommentEditor;
|
|
19
|
+
|
|
20
|
+
// for nested tables, or chromeless editor, which used non resizable table container
|
|
21
|
+
if (isNested || isChromelessEditor) {
|
|
22
|
+
if (hasTableBeenResized) {
|
|
23
|
+
return `width: max(${fixedColWidth}px, ${tableCellMinWidth}px)`;
|
|
24
|
+
}
|
|
25
|
+
return `width: ${tableCellMinWidth}px)`;
|
|
26
|
+
}
|
|
27
|
+
if (isFullPageEditor || !isFullPageEditor && isTableHasWidth) {
|
|
28
|
+
const scaledPercent = isNumberColumnEnabled ? `calc(calc(var(--ak-editor-table-width) - ${akEditorTableNumberColumnWidth}px - 1px)/${tableWidth})` : `calc(calc(var(--ak-editor-table-width) - 1px)/${tableWidth})`;
|
|
29
|
+
return `width: max(calc(${fixedColWidth}px * ${maxScaledRatio}), calc(${fixedColWidth} * ${scaledPercent}), ${tableCellMinWidth}px)`;
|
|
30
|
+
}
|
|
31
|
+
// table resized to full-width in comment editor
|
|
32
|
+
// it doesn't have a width attribute, and cols has been resized
|
|
33
|
+
if (hasTableBeenResized) {
|
|
34
|
+
const scaledPercent = isNumberColumnEnabled ? `calc(calc(var(--ak-editor-table-width) - ${akEditorTableNumberColumnWidth}px - 1px)/${tableWidth})` : `calc(calc(var(--ak-editor-table-width) - 1px)/${tableWidth})`;
|
|
35
|
+
return `width: max(calc(${fixedColWidth} * ${scaledPercent}), ${tableCellMinWidth}px)`;
|
|
36
|
+
}
|
|
37
|
+
return `width: ${tableCellMinWidth}px`;
|
|
38
|
+
};
|
|
39
|
+
export const generateColgroupFromNode = (table, isCommentEditor, isChromelessEditor, isNested, isTableScalingEnabled, shouldUseIncreasedScalingPercent) => {
|
|
40
|
+
const cols = [];
|
|
41
|
+
const map = TableMap.get(table);
|
|
42
|
+
const isTableHasWidth = !!table.attrs.width;
|
|
43
|
+
const isNumberColumnEnabled = table.attrs.isNumberColumnEnabled || false;
|
|
44
|
+
const isFullPageEditor = !isChromelessEditor && !isCommentEditor;
|
|
45
|
+
|
|
46
|
+
// Ignored via go/ees005
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
48
|
+
table.content.firstChild.content.forEach(cell => {
|
|
49
|
+
const colspan = cell.attrs.colspan || 1;
|
|
50
|
+
// if the table has been resized
|
|
51
|
+
if (Array.isArray(cell.attrs.colwidth)) {
|
|
52
|
+
cell.attrs.colwidth.slice(0, colspan).forEach(width => {
|
|
53
|
+
// existing logic for calculating the width of the column
|
|
54
|
+
const fixedColWidth = getColWidthFix(width, map.width);
|
|
55
|
+
const tableWidth = isFullPageEditor || !isFullPageEditor && isTableHasWidth ? getTableContainerElementWidth(table) : calcTableColumnWidths(table).reduce((sum, width) => sum + width, 0);
|
|
56
|
+
if (isTableScalingEnabled) {
|
|
57
|
+
cols.push(['col', {
|
|
58
|
+
style: generateColStyle(fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth, true)
|
|
59
|
+
}]);
|
|
60
|
+
} else {
|
|
61
|
+
cols.push(['col', {
|
|
62
|
+
style: `width: max(${fixedColWidth}px, ${tableCellMinWidth}px)`
|
|
63
|
+
}]);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
} else {
|
|
67
|
+
// columns has not been resized, so distribute the width evenly
|
|
68
|
+
cols.push(...Array.from({
|
|
69
|
+
length: colspan
|
|
70
|
+
}, _ => {
|
|
71
|
+
const tableWidth = getTableContainerElementWidth(table);
|
|
72
|
+
const columnWidth = tableWidth / map.width || 0;
|
|
73
|
+
const fixedColWidth = getColWidthFix(columnWidth, map.width || 0);
|
|
74
|
+
return ['col', {
|
|
75
|
+
style: generateColStyle(fixedColWidth, tableWidth, isCommentEditor, isChromelessEditor, isNested, shouldUseIncreasedScalingPercent, isNumberColumnEnabled, isTableHasWidth)
|
|
76
|
+
}];
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return cols;
|
|
81
|
+
};
|
|
14
82
|
export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPercent, isCommentEditor) => {
|
|
15
83
|
const cols = [];
|
|
16
84
|
const map = TableMap.get(table);
|
|
@@ -32,6 +100,7 @@ export const generateColgroup = (table, tableRef, shouldUseIncreasedScalingPerce
|
|
|
32
100
|
scalePercent = getTableScalingPercent(table, tableRef, shouldUseIncreasedScalingPercent);
|
|
33
101
|
}
|
|
34
102
|
cell.attrs.colwidth.slice(0, colspan).forEach(width => {
|
|
103
|
+
// existing logic for calculating the width of the column
|
|
35
104
|
const fixedColWidth = getColWidthFix(width, map.width);
|
|
36
105
|
const scaledWidth = fixedColWidth * scalePercent;
|
|
37
106
|
const finalWidth = Math.max(scaledWidth, tableCellMinWidth);
|
|
@@ -4,7 +4,7 @@ import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
|
4
4
|
import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
5
5
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
6
|
import { hasTableBeenResized, hasTableColumnBeenResized } from './colgroup';
|
|
7
|
-
import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION } from './consts';
|
|
7
|
+
import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION, TABLE_MAX_WIDTH } from './consts';
|
|
8
8
|
|
|
9
9
|
// Translates named layouts in number values.
|
|
10
10
|
export function getLayoutSize(tableLayout, containerWidth = 0, options) {
|
|
@@ -85,6 +85,75 @@ export const getTableElementWidth = table => {
|
|
|
85
85
|
export const getTableContainerElementWidth = table => {
|
|
86
86
|
return getTableContainerWidth(table);
|
|
87
87
|
};
|
|
88
|
+
|
|
89
|
+
// eslint-disable-next-line jsdoc/require-example
|
|
90
|
+
/**
|
|
91
|
+
* This function is used to set the max width for table resizer container.
|
|
92
|
+
* @param isCommentEditor Whether the editor is in comment mode.
|
|
93
|
+
* @param isChromelessEditor Whether the editor is chromeless.
|
|
94
|
+
* @param isTableScalingEnabled Whether table scaling is enabled.
|
|
95
|
+
* @returns The CSS max-width value
|
|
96
|
+
*/
|
|
97
|
+
export const getTableResizerContainerMaxWidthInCSS = (isCommentEditor, isChromelessEditor, isTableScalingEnabled) => {
|
|
98
|
+
const maxResizerWidthForNonCommentEditor = isTableScalingEnabled ? `min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2)), ${TABLE_MAX_WIDTH}px)` : `min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2) - var(--ak-editor--resizer-handle-spacing)), ${TABLE_MAX_WIDTH}px)`;
|
|
99
|
+
return isCommentEditor || isChromelessEditor ? '100%' : maxResizerWidthForNonCommentEditor;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
// eslint-disable-next-line jsdoc/require-example
|
|
103
|
+
/**
|
|
104
|
+
* This function is used in NodeView for TableResizer to set the max width for table resizer container
|
|
105
|
+
* @param node The ProseMirror node representing the table.
|
|
106
|
+
* @param isCommentEditor Whether the editor is in comment mode.
|
|
107
|
+
* @param isChromelessEditor Whether the editor is chromeless.
|
|
108
|
+
* @returns The CSS max-width value for the table resizer container.
|
|
109
|
+
*/
|
|
110
|
+
export const getTableResizerItemWidth = (node, isCommentEditor, isChromelessEditor) => {
|
|
111
|
+
const tableWidthAttribute = getTableContainerWidth(node);
|
|
112
|
+
if (!node.attrs.width && (isCommentEditor || isChromelessEditor)) {
|
|
113
|
+
// width undefined would make .resizer-item width to be `auto`
|
|
114
|
+
return undefined;
|
|
115
|
+
}
|
|
116
|
+
return tableWidthAttribute;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
// eslint-disable-next-line jsdoc/require-example
|
|
120
|
+
/**
|
|
121
|
+
* This function is used to set the CSS width value for the table resizer-item.
|
|
122
|
+
* Because comment and chromeless editors don't have container-type: inline-size set,
|
|
123
|
+
* we need to calculate the width based on the table node width.
|
|
124
|
+
* If the table node width is not set, it will return 'auto'.
|
|
125
|
+
* This is used in table toDOM
|
|
126
|
+
* @param node The ProseMirror node representing the table.
|
|
127
|
+
* @param isCommentEditor Whether the editor is in comment mode.
|
|
128
|
+
* @param isChromelessEditor Whether the editor is chromeless.
|
|
129
|
+
* @returns The CSS width value for the table container.
|
|
130
|
+
*/
|
|
131
|
+
export const getTableResizerItemWidthInCSS = (node, isCommentEditor, isChromelessEditor) => {
|
|
132
|
+
const tableWidthAttribute = getTableResizerItemWidth(node, isCommentEditor, isChromelessEditor);
|
|
133
|
+
return tableWidthAttribute ? `${tableWidthAttribute}px` : 'auto';
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// eslint-disable-next-line jsdoc/require-example
|
|
137
|
+
/**
|
|
138
|
+
* This function is used to set the table width --ak-editor-table-width CSS property for full page editor.
|
|
139
|
+
* Which is applied to the table resizer container.
|
|
140
|
+
* For Full page appearance, we don't need to use containerWidth from JS, as we can use cqw value.
|
|
141
|
+
* So we set dynamic containerWidth from JS to CSS property.
|
|
142
|
+
* @param node The ProseMirror node representing the table.
|
|
143
|
+
* @param isCommentEditor Whether the editor is in comment mode.
|
|
144
|
+
* @param isChromelessEditor Whether the editor is chromeless.
|
|
145
|
+
* @param isTableScalingEnabled Whether table scaling is enabled.
|
|
146
|
+
* @param tableWidthFromJS The width of the container element. In toDOM it'd be undefined, but will have a value from nodeView.
|
|
147
|
+
* @returns The CSS width value for the table.
|
|
148
|
+
*/
|
|
149
|
+
export const getTableResizerContainerForFullPageWidthInCSS = (node, isTableScalingEnabled) => {
|
|
150
|
+
const tableWidth = getTableContainerElementWidth(node);
|
|
151
|
+
// for full page appearance
|
|
152
|
+
if (isTableScalingEnabled) {
|
|
153
|
+
return `min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2)), ${tableWidth}px)`;
|
|
154
|
+
}
|
|
155
|
+
return `min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2) - var(--ak-editor--resizer-handle-spacing)), ${tableWidth}px)`;
|
|
156
|
+
};
|
|
88
157
|
export const getTableScalingPercent = (table, tableRef, shouldUseIncreasedScalingPercent) => {
|
|
89
158
|
var _tableRef$parentEleme;
|
|
90
159
|
const maxScalingPercent = shouldUseIncreasedScalingPercent ? MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION : MAX_SCALING_PERCENT;
|
|
@@ -228,19 +228,29 @@ const tablePlugin = ({
|
|
|
228
228
|
}) : insertTableWithSize(options === null || options === void 0 ? void 0 : options.fullWidthEnabled, options === null || options === void 0 ? void 0 : options.isTableScalingEnabled, options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment, api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, options === null || options === void 0 ? void 0 : options.isCommentEditor)
|
|
229
229
|
},
|
|
230
230
|
nodes() {
|
|
231
|
-
var _options$tableOptions2;
|
|
231
|
+
var _options$tableOptions2, _options$getEditorFea3;
|
|
232
232
|
const {
|
|
233
233
|
allowColumnResizing
|
|
234
234
|
} = pluginConfig(options === null || options === void 0 ? void 0 : options.tableOptions);
|
|
235
235
|
// TODO: ED-25901 - We need to move this into a plugin config option so we don't accidentally enable nested nodes in Jira
|
|
236
236
|
const isNestingSupported = Boolean(options === null || options === void 0 ? void 0 : (_options$tableOptions2 = options.tableOptions) === null || _options$tableOptions2 === void 0 ? void 0 : _options$tableOptions2.allowNestedTables);
|
|
237
|
+
const isTableFixedColumnWidthsOptionEnabled = (options === null || options === void 0 ? void 0 : (_options$getEditorFea3 = options.getEditorFeatureFlags) === null || _options$getEditorFea3 === void 0 ? void 0 : _options$getEditorFea3.call(options).tableWithFixedColumnWidthsOption) || false;
|
|
238
|
+
const shouldUseIncreasedScalingPercent = (options === null || options === void 0 ? void 0 : options.isTableScalingEnabled) && (isTableFixedColumnWidthsOptionEnabled || ( // When in comment editor, we need the scaling percent to be 40% while tableWithFixedColumnWidthsOption is not visible
|
|
239
|
+
options === null || options === void 0 ? void 0 : options.isCommentEditor));
|
|
240
|
+
const isTableScalingEnabled = options === null || options === void 0 ? void 0 : options.isTableScalingEnabled;
|
|
241
|
+
const isCommentEditor = options === null || options === void 0 ? void 0 : options.isCommentEditor;
|
|
242
|
+
const isChromelessEditor = options === null || options === void 0 ? void 0 : options.isChromelessEditor;
|
|
237
243
|
return isNestingSupported ? [{
|
|
238
244
|
name: 'table',
|
|
239
245
|
node: tableNodeSpecWithFixedToDOM({
|
|
240
246
|
allowColumnResizing: Boolean(allowColumnResizing),
|
|
241
247
|
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing),
|
|
242
248
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
243
|
-
isNestingSupported
|
|
249
|
+
isNestingSupported,
|
|
250
|
+
isTableScalingEnabled,
|
|
251
|
+
shouldUseIncreasedScalingPercent,
|
|
252
|
+
isCommentEditor,
|
|
253
|
+
isChromelessEditor
|
|
244
254
|
})
|
|
245
255
|
}, {
|
|
246
256
|
name: 'tableHeader',
|
|
@@ -257,7 +267,11 @@ const tablePlugin = ({
|
|
|
257
267
|
allowColumnResizing: Boolean(allowColumnResizing),
|
|
258
268
|
tableResizingEnabled: Boolean(options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing),
|
|
259
269
|
getEditorContainerWidth: defaultGetEditorContainerWidth,
|
|
260
|
-
isNestingSupported
|
|
270
|
+
isNestingSupported,
|
|
271
|
+
isTableScalingEnabled,
|
|
272
|
+
shouldUseIncreasedScalingPercent,
|
|
273
|
+
isCommentEditor,
|
|
274
|
+
isChromelessEditor
|
|
261
275
|
})
|
|
262
276
|
}, {
|
|
263
277
|
name: 'tableHeader',
|
|
@@ -3,7 +3,6 @@ import React, { Component } from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
5
5
|
import { isRowSelected } from '@atlaskit/editor-tables/utils';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
6
|
import { clearHoverSelection } from '../../../pm-plugins/commands';
|
|
8
7
|
import { getRowHeights } from '../../../pm-plugins/utils/row-controls';
|
|
9
8
|
import { TableCssClassName as ClassName } from '../../../types';
|
|
@@ -79,19 +78,11 @@ export default class NumberColumn extends Component {
|
|
|
79
78
|
tableActive
|
|
80
79
|
} = this.props;
|
|
81
80
|
const isActive = isRowSelected(index)(editorView.state.selection) || (hoveredRows || []).indexOf(index) !== -1 && !isResizing;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
});
|
|
88
|
-
} else {
|
|
89
|
-
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
90
|
-
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
91
|
-
[ClassName.HOVERED_CELL_IN_DANGER]: isActive && isInDanger,
|
|
92
|
-
[ClassName.HOVERED_CELL_ACTIVE]: isActive
|
|
93
|
-
});
|
|
94
|
-
}
|
|
81
|
+
return classnames(ClassName.NUMBERED_COLUMN_BUTTON, {
|
|
82
|
+
[ClassName.NUMBERED_COLUMN_BUTTON_DISABLED]: isButtonDisabled,
|
|
83
|
+
[ClassName.HOVERED_CELL_IN_DANGER]: tableActive && isActive && isInDanger,
|
|
84
|
+
[ClassName.HOVERED_CELL_ACTIVE]: tableActive && isActive
|
|
85
|
+
});
|
|
95
86
|
});
|
|
96
87
|
}
|
|
97
88
|
render() {
|
|
@@ -88,10 +88,10 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
88
88
|
var _this;
|
|
89
89
|
_classCallCheck(this, TableComponent);
|
|
90
90
|
_this = _callSuper(this, TableComponent, [props]);
|
|
91
|
-
_defineProperty(_this, "state", _defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
91
|
+
_defineProperty(_this, "state", _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({
|
|
92
92
|
scroll: 0,
|
|
93
93
|
parentWidth: undefined
|
|
94
|
-
}, ShadowEvent.SHOW_BEFORE_SHADOW, false), ShadowEvent.SHOW_AFTER_SHADOW, false), "tableWrapperWidth", undefined), "tableWrapperHeight", undefined));
|
|
94
|
+
}, ShadowEvent.SHOW_BEFORE_SHADOW, false), ShadowEvent.SHOW_AFTER_SHADOW, false), "tableWrapperWidth", undefined), "tableWrapperHeight", undefined), "windowResized", false));
|
|
95
95
|
_defineProperty(_this, "holdCompleted", false);
|
|
96
96
|
_defineProperty(_this, "dispatchEventName", "tableResized-".concat(generateUniqueTableId()));
|
|
97
97
|
_defineProperty(_this, "handleMouseOut", function (event) {
|
|
@@ -328,6 +328,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
328
328
|
parentWidth: parentWidth
|
|
329
329
|
});
|
|
330
330
|
});
|
|
331
|
+
// This is a new handler for window resize events that sets the windowResized state immediately
|
|
332
|
+
// This is needed to update colgroup on window resize, to enforce the table scaling
|
|
333
|
+
_defineProperty(_this, "handleWindowResizeNew", function () {
|
|
334
|
+
// Set resizing to true immediately
|
|
335
|
+
if (!_this.state.windowResized) {
|
|
336
|
+
_this.setState({
|
|
337
|
+
windowResized: true
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
});
|
|
331
341
|
_defineProperty(_this, "getParentNodeWidth", function () {
|
|
332
342
|
var _this$props6 = _this.props,
|
|
333
343
|
getPos = _this$props6.getPos,
|
|
@@ -349,11 +359,29 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
349
359
|
_defineProperty(_this, "tableNodeLayoutSize", function (node, containerWidth, options) {
|
|
350
360
|
return getLayoutSize(node.attrs.layout, containerWidth || _this.props.containerWidth.width, options || _this.props.options || {});
|
|
351
361
|
});
|
|
362
|
+
_defineProperty(_this, "shouldUpdateColgroup", function (params) {
|
|
363
|
+
var _this$props$options, _this$props$options2;
|
|
364
|
+
var isWindowResized = params.isWindowResized,
|
|
365
|
+
isWidthChanged = params.isWidthChanged,
|
|
366
|
+
isTableWidthChanged = params.isTableWidthChanged,
|
|
367
|
+
isColumnsDistributed = params.isColumnsDistributed,
|
|
368
|
+
isTableResizedFullWidth = params.isTableResizedFullWidth,
|
|
369
|
+
isTableDisplayModeChanged = params.isTableDisplayModeChanged,
|
|
370
|
+
isNumberColumnChanged = params.isNumberColumnChanged,
|
|
371
|
+
isNumberOfColumnsChanged = params.isNumberOfColumnsChanged,
|
|
372
|
+
isFullWidthModeAndLineLengthChanged = params.isFullWidthModeAndLineLengthChanged;
|
|
373
|
+
var isFullPageEditor = !((_this$props$options = _this.props.options) !== null && _this$props$options !== void 0 && _this$props$options.isCommentEditor) && !((_this$props$options2 = _this.props.options) !== null && _this$props$options2 !== void 0 && _this$props$options2.isChromelessEditor);
|
|
374
|
+
if (expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) && isFullPageEditor) {
|
|
375
|
+
return !!isWindowResized || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
376
|
+
}
|
|
377
|
+
return isWidthChanged || isTableWidthChanged || isColumnsDistributed || !!isTableResizedFullWidth || isTableDisplayModeChanged || isNumberColumnChanged || isNumberOfColumnsChanged || !!isFullWidthModeAndLineLengthChanged;
|
|
378
|
+
});
|
|
352
379
|
_defineProperty(_this, "scaleTableDebounced", rafSchedule(_this.scaleTable));
|
|
353
380
|
_defineProperty(_this, "handleTableResizingDebounced", rafSchedule(_this.handleTableResizing));
|
|
354
381
|
_defineProperty(_this, "handleScrollDebounced", rafSchedule(_this.handleScroll));
|
|
355
382
|
_defineProperty(_this, "handleAutoSizeDebounced", rafSchedule(_this.handleAutoSize));
|
|
356
383
|
_defineProperty(_this, "handleWindowResizeDebounced", rafSchedule(_this.handleWindowResize));
|
|
384
|
+
_defineProperty(_this, "handleWindowResizeNewDebounced", rafSchedule(_this.handleWindowResizeNew));
|
|
357
385
|
_defineProperty(_this, "updateShadowStateDebounced", rafSchedule(_this.updateShadowState));
|
|
358
386
|
var _options = props.options,
|
|
359
387
|
_containerWidth = props.containerWidth,
|
|
@@ -459,11 +487,13 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
459
487
|
var _getEditorFeatureFlag = getEditorFeatureFlags(),
|
|
460
488
|
_getEditorFeatureFlag2 = _getEditorFeatureFlag.tableWithFixedColumnWidthsOption,
|
|
461
489
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag2 === void 0 ? false : _getEditorFeatureFlag2;
|
|
462
|
-
if (
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
490
|
+
if (!expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true)) {
|
|
491
|
+
if (isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
492
|
+
this.handleColgroupUpdates(true);
|
|
493
|
+
}
|
|
494
|
+
if (isTableScalingEnabled && tableWithFixedColumnWidthsOption && getNode().attrs.displayMode !== 'fixed') {
|
|
495
|
+
this.handleColgroupUpdates(true);
|
|
496
|
+
}
|
|
467
497
|
}
|
|
468
498
|
if (this.wrapper) {
|
|
469
499
|
this.wrapperReisizeObserver = new ResizeObserver(function (entries) {
|
|
@@ -515,6 +545,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
515
545
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
516
546
|
window.addEventListener('resize', this.handleWindowResizeDebounced);
|
|
517
547
|
}
|
|
548
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
549
|
+
window.addEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
518
550
|
this.handleTableResizingDebounced();
|
|
519
551
|
}
|
|
520
552
|
var currentStickyState = stickyHeadersPluginKey.getState(this.props.view.state);
|
|
@@ -562,11 +594,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
562
594
|
if (!allowTableResizing) {
|
|
563
595
|
this.handleWindowResizeDebounced.cancel();
|
|
564
596
|
}
|
|
597
|
+
this.handleWindowResizeNewDebounced.cancel();
|
|
565
598
|
if (!allowTableResizing && allowColumnResizing) {
|
|
566
599
|
// Ignored via go/ees005
|
|
567
600
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
568
601
|
window.removeEventListener('resize', this.handleWindowResizeDebounced);
|
|
569
602
|
}
|
|
603
|
+
if (allowColumnResizing) {
|
|
604
|
+
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
605
|
+
window.removeEventListener('resize', this.handleWindowResizeNewDebounced);
|
|
606
|
+
}
|
|
570
607
|
|
|
571
608
|
// Ignored via go/ees005
|
|
572
609
|
// eslint-disable-next-line @repo/internal/dom-events/no-unsafe-event-listeners
|
|
@@ -656,22 +693,32 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
656
693
|
containerLineLength = containerWidth.lineLength;
|
|
657
694
|
var isLineLengthChanged = ((_this$containerWidth = this.containerWidth) === null || _this$containerWidth === void 0 ? void 0 : _this$containerWidth.lineLength) !== containerLineLength;
|
|
658
695
|
var isFullWidthModeAndLineLengthChanged = this.updateColGroupFromFullWidthChange && isLineLengthChanged && fg('platform_editor_table_overflow_in_full_width_fix');
|
|
659
|
-
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged;
|
|
696
|
+
var maybeScale = isTableSquashed || isTableWidthChanged || isTableResizedFullWidth && !(options !== null && options !== void 0 && options.isCommentEditor) || isNumberColumnChanged || isNumberOfColumnsChanged || expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) && this.state.windowResized;
|
|
660
697
|
if (force || maybeScale || isFullWidthModeAndLineLengthChanged) {
|
|
661
|
-
var _this$containerWidth2, _this$props$
|
|
698
|
+
var _this$containerWidth2, _this$props$options3, _this$props$options4, _this$props$options5;
|
|
662
699
|
var isWidthChanged = ((_this$containerWidth2 = this.containerWidth) === null || _this$containerWidth2 === void 0 ? void 0 : _this$containerWidth2.width) !== containerWidthValue;
|
|
663
700
|
var wasTableResized = hasTableBeenResized(this.node);
|
|
664
701
|
var isTableResized = hasTableBeenResized(tableNode);
|
|
665
702
|
var isColumnsDistributed = wasTableResized && !isTableResized;
|
|
666
703
|
var isTableDisplayModeChanged = this.node.attrs.displayMode !== tableNode.attrs.displayMode;
|
|
667
|
-
var shouldUpdateColgroup =
|
|
704
|
+
var shouldUpdateColgroup = this.shouldUpdateColgroup({
|
|
705
|
+
isWindowResized: this.state.windowResized,
|
|
706
|
+
isWidthChanged: isWidthChanged,
|
|
707
|
+
isTableWidthChanged: isTableWidthChanged,
|
|
708
|
+
isColumnsDistributed: isColumnsDistributed,
|
|
709
|
+
isTableResizedFullWidth: isTableResizedFullWidth,
|
|
710
|
+
isTableDisplayModeChanged: isTableDisplayModeChanged,
|
|
711
|
+
isNumberColumnChanged: isNumberColumnChanged,
|
|
712
|
+
isNumberOfColumnsChanged: isNumberOfColumnsChanged,
|
|
713
|
+
isFullWidthModeAndLineLengthChanged: isFullWidthModeAndLineLengthChanged
|
|
714
|
+
});
|
|
668
715
|
var _getEditorFeatureFlag3 = getEditorFeatureFlags(),
|
|
669
716
|
_getEditorFeatureFlag4 = _getEditorFeatureFlag3.tableWithFixedColumnWidthsOption,
|
|
670
717
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag4 === void 0 ? false : _getEditorFeatureFlag4;
|
|
671
|
-
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$
|
|
672
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!((_this$props$
|
|
718
|
+
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!((_this$props$options3 = this.props.options) !== null && _this$props$options3 !== void 0 && _this$props$options3.isTableScalingEnabled) && tableWithFixedColumnWidthsOption;
|
|
719
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!((_this$props$options4 = this.props.options) !== null && _this$props$options4 !== void 0 && _this$props$options4.isTableScalingEnabled) && !!((_this$props$options5 = this.props.options) !== null && _this$props$options5 !== void 0 && _this$props$options5.isCommentEditor);
|
|
673
720
|
if (force || !isResizing && shouldUpdateColgroup) {
|
|
674
|
-
var _this$props$
|
|
721
|
+
var _this$props$options6, _this$props$options7, _this$props$options8, _this$props$options9;
|
|
675
722
|
var resizeState = getResizeState({
|
|
676
723
|
minWidth: COLUMN_MIN_WIDTH,
|
|
677
724
|
// When numbered column enabled, we need to subtract the width of the numbered column
|
|
@@ -682,16 +729,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
682
729
|
domAtPos: view.domAtPos.bind(view),
|
|
683
730
|
isTableScalingEnabled: true,
|
|
684
731
|
shouldUseIncreasedScalingPercent: shouldUseIncreasedScalingPercent,
|
|
685
|
-
isCommentEditor: !!((_this$props$
|
|
732
|
+
isCommentEditor: !!((_this$props$options6 = this.props.options) !== null && _this$props$options6 !== void 0 && _this$props$options6.isCommentEditor)
|
|
686
733
|
});
|
|
687
734
|
var shouldScaleOnColgroupUpdate = false;
|
|
688
|
-
if ((_this$props$
|
|
735
|
+
if ((_this$props$options7 = this.props.options) !== null && _this$props$options7 !== void 0 && _this$props$options7.isTableScalingEnabled && !tableWithFixedColumnWidthsOption) {
|
|
689
736
|
shouldScaleOnColgroupUpdate = true;
|
|
690
737
|
}
|
|
691
738
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && tableNode.attrs.displayMode !== 'fixed') {
|
|
692
739
|
shouldScaleOnColgroupUpdate = true;
|
|
693
740
|
}
|
|
694
|
-
if ((_this$props$
|
|
741
|
+
if ((_this$props$options8 = this.props.options) !== null && _this$props$options8 !== void 0 && _this$props$options8.isTableScalingEnabled && (_this$props$options9 = this.props.options) !== null && _this$props$options9 !== void 0 && _this$props$options9.isCommentEditor) {
|
|
695
742
|
shouldScaleOnColgroupUpdate = true;
|
|
696
743
|
}
|
|
697
744
|
var scalePercent = 1;
|
|
@@ -740,8 +787,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
740
787
|
}, {
|
|
741
788
|
key: "componentDidUpdate",
|
|
742
789
|
value: function componentDidUpdate(_, prevState) {
|
|
743
|
-
var _this$props$
|
|
744
|
-
_this$props$
|
|
790
|
+
var _this$props$options0,
|
|
791
|
+
_this$props$options1,
|
|
745
792
|
_this$wrapper,
|
|
746
793
|
_this5 = this;
|
|
747
794
|
var _this$props1 = this.props,
|
|
@@ -771,18 +818,21 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
771
818
|
shouldHandleColgroupUpdates = true;
|
|
772
819
|
}
|
|
773
820
|
var isTableScalingWithFixedColumnWidthsOptionEnabled = !!isTableScalingEnabled && tableWithFixedColumnWidthsOption;
|
|
774
|
-
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!isTableScalingEnabled && !!((_this$props$
|
|
821
|
+
var shouldUseIncreasedScalingPercent = isTableScalingWithFixedColumnWidthsOptionEnabled || !!isTableScalingEnabled && !!((_this$props$options0 = this.props.options) !== null && _this$props$options0 !== void 0 && _this$props$options0.isCommentEditor);
|
|
775
822
|
if (isTableScalingWithFixedColumnWidthsOptionEnabled && getNode().attrs.displayMode !== 'fixed') {
|
|
776
823
|
shouldScale = true;
|
|
777
824
|
shouldHandleColgroupUpdates = true;
|
|
778
825
|
}
|
|
826
|
+
if (expValEquals('platform_editor_tables_scaling_css', 'isEnabled', true) && this.state.windowResized) {
|
|
827
|
+
shouldHandleColgroupUpdates = true;
|
|
828
|
+
}
|
|
779
829
|
if (shouldHandleColgroupUpdates) {
|
|
780
830
|
this.handleColgroupUpdates();
|
|
781
831
|
}
|
|
782
832
|
if (isInDanger && !table) {
|
|
783
833
|
clearHoverSelection()(view.state, view.dispatch);
|
|
784
834
|
}
|
|
785
|
-
if ((_this$props$
|
|
835
|
+
if ((_this$props$options1 = this.props.options) !== null && _this$props$options1 !== void 0 && _this$props$options1.isCommentEditor && allowTableResizing && !(options !== null && options !== void 0 && options.isTableScalingEnabled)) {
|
|
786
836
|
this.removeInlineTableWidth();
|
|
787
837
|
}
|
|
788
838
|
if ((_this$wrapper = this.wrapper) !== null && _this$wrapper !== void 0 && _this$wrapper.parentElement && this.table && !this.overflowShadowsObserver) {
|
|
@@ -872,7 +922,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
872
922
|
key: "render",
|
|
873
923
|
value: function render() {
|
|
874
924
|
var _this6 = this,
|
|
875
|
-
_this$props$
|
|
925
|
+
_this$props$options10;
|
|
876
926
|
var _this$props10 = this.props,
|
|
877
927
|
view = _this$props10.view,
|
|
878
928
|
getNode = _this$props10.getNode,
|
|
@@ -934,7 +984,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
934
984
|
,
|
|
935
985
|
selection: view.state.selection,
|
|
936
986
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
937
|
-
stickyHeader: this.state.stickyHeader,
|
|
987
|
+
stickyHeader: !this.props.limitedMode ? this.state.stickyHeader : undefined,
|
|
938
988
|
tableWrapperWidth: this.state.tableWrapperWidth,
|
|
939
989
|
api: pluginInjectionApi,
|
|
940
990
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor
|
|
@@ -956,7 +1006,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
956
1006
|
,
|
|
957
1007
|
selection: view.state.selection,
|
|
958
1008
|
headerRowHeight: headerRow ? headerRow.offsetHeight : undefined,
|
|
959
|
-
stickyHeader: this.state.stickyHeader,
|
|
1009
|
+
stickyHeader: !this.props.limitedMode ? this.state.stickyHeader : undefined,
|
|
960
1010
|
getEditorFeatureFlags: getEditorFeatureFlags,
|
|
961
1011
|
tableContainerWidth: tableContainerWidth,
|
|
962
1012
|
isNumberColumnEnabled: node.attrs.isNumberColumnEnabled,
|
|
@@ -989,15 +1039,15 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
989
1039
|
var isNested = isTableNested(view.state, tablePos);
|
|
990
1040
|
var topShadowPadding = isDragAndDropEnabled ? 0 : shadowPadding;
|
|
991
1041
|
var topOffset = 0;
|
|
992
|
-
var topStickyShadowPosition = this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
1042
|
+
var topStickyShadowPosition = !this.props.limitedMode && this.state.stickyHeader && topOffset + this.state.stickyHeader.padding + topShadowPadding + 2;
|
|
993
1043
|
var _getEditorFeatureFlag7 = getEditorFeatureFlags(),
|
|
994
1044
|
_getEditorFeatureFlag8 = _getEditorFeatureFlag7.tableWithFixedColumnWidthsOption,
|
|
995
1045
|
tableWithFixedColumnWidthsOption = _getEditorFeatureFlag8 === void 0 ? false : _getEditorFeatureFlag8;
|
|
996
|
-
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$
|
|
1046
|
+
var shouldUseIncreasedScalingPercent = !!isTableScalingEnabled && (tableWithFixedColumnWidthsOption || !!((_this$props$options10 = this.props.options) !== null && _this$props$options10 !== void 0 && _this$props$options10.isCommentEditor));
|
|
997
1047
|
return /*#__PURE__*/React.createElement(TableContainer
|
|
998
1048
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
|
|
999
1049
|
, {
|
|
1000
|
-
className: classnames(ClassName.TABLE_CONTAINER, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ClassName.WITH_CONTROLS, allowControls && tableActive), ClassName.TABLE_STICKY, this.state.stickyHeader && hasHeaderRow), ClassName.HOVERED_DELETE_BUTTON, isInDanger), ClassName.TABLE_SELECTED, isTableSelected(selection !== null && selection !== void 0 ? selection : view.state.selection)), ClassName.NESTED_TABLE_WITH_CONTROLS, tableActive && allowControls && this.isNestedInTable)),
|
|
1050
|
+
className: classnames(ClassName.TABLE_CONTAINER, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ClassName.WITH_CONTROLS, allowControls && tableActive), ClassName.TABLE_STICKY, !this.props.limitedMode && this.state.stickyHeader && hasHeaderRow), ClassName.HOVERED_DELETE_BUTTON, isInDanger), ClassName.TABLE_SELECTED, isTableSelected(selection !== null && selection !== void 0 ? selection : view.state.selection)), ClassName.NESTED_TABLE_WITH_CONTROLS, tableActive && allowControls && this.isNestedInTable)),
|
|
1001
1051
|
editorView: view,
|
|
1002
1052
|
getPos: getPos,
|
|
1003
1053
|
node: node
|
|
@@ -1011,6 +1061,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
1011
1061
|
tableWrapperHeight: this.state.tableWrapperHeight,
|
|
1012
1062
|
isTableResizingEnabled: allowTableResizing,
|
|
1013
1063
|
isResizing: isResizing,
|
|
1064
|
+
isWindowResized: this.state.windowResized,
|
|
1014
1065
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
1015
1066
|
isTableWithFixedColumnWidthsOptionEnabled: tableWithFixedColumnWidthsOption,
|
|
1016
1067
|
isWholeTableInDanger: isWholeTableInDanger,
|