@atlaskit/editor-plugin-table 15.3.22 → 15.4.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 +15 -0
- package/dist/cjs/nodeviews/TableContainer.js +2 -1
- package/dist/cjs/nodeviews/TableResizer.js +3 -3
- package/dist/cjs/nodeviews/TableRow.js +15 -2
- package/dist/cjs/nodeviews/toDOM.js +1 -1
- package/dist/cjs/pm-plugins/commands/insert.js +7 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/consts.js +4 -2
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +2 -1
- package/dist/cjs/pm-plugins/table-width.js +7 -4
- package/dist/cjs/pm-plugins/utils/create.js +9 -3
- package/dist/cjs/pm-plugins/utils/snapping.js +10 -5
- package/dist/cjs/tablePlugin.js +8 -2
- package/dist/es2019/nodeviews/TableContainer.js +3 -2
- package/dist/es2019/nodeviews/TableResizer.js +4 -4
- package/dist/es2019/nodeviews/TableRow.js +15 -2
- package/dist/es2019/nodeviews/toDOM.js +2 -2
- package/dist/es2019/pm-plugins/commands/insert.js +6 -2
- package/dist/es2019/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +3 -2
- package/dist/es2019/pm-plugins/table-width.js +9 -6
- package/dist/es2019/pm-plugins/utils/create.js +10 -4
- package/dist/es2019/pm-plugins/utils/snapping.js +11 -6
- package/dist/es2019/tablePlugin.js +8 -2
- package/dist/esm/nodeviews/TableContainer.js +3 -2
- package/dist/esm/nodeviews/TableResizer.js +4 -4
- package/dist/esm/nodeviews/TableRow.js +15 -2
- package/dist/esm/nodeviews/toDOM.js +2 -2
- package/dist/esm/pm-plugins/commands/insert.js +7 -2
- package/dist/esm/pm-plugins/table-resizing/utils/consts.js +3 -1
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +3 -2
- package/dist/esm/pm-plugins/table-width.js +9 -6
- package/dist/esm/pm-plugins/utils/create.js +10 -4
- package/dist/esm/pm-plugins/utils/snapping.js +11 -6
- package/dist/esm/tablePlugin.js +8 -2
- package/dist/types/pm-plugins/commands/insert.d.ts +3 -2
- package/dist/types/pm-plugins/table-resizing/utils/consts.d.ts +2 -1
- package/dist/types/pm-plugins/table-width.d.ts +1 -1
- package/dist/types/pm-plugins/utils/create.d.ts +2 -1
- package/dist/types/pm-plugins/utils/snapping.d.ts +1 -1
- package/dist/types/tablePluginType.d.ts +2 -0
- package/dist/types/types/index.d.ts +4 -2
- package/dist/types-ts4.5/pm-plugins/commands/insert.d.ts +3 -2
- package/dist/types-ts4.5/pm-plugins/table-resizing/utils/consts.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/table-width.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/utils/create.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/utils/snapping.d.ts +1 -1
- package/dist/types-ts4.5/tablePluginType.d.ts +2 -0
- package/dist/types-ts4.5/types/index.d.ts +4 -2
- package/package.json +13 -10
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
2
|
-
import {
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
|
+
import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from '../table-resizing/utils/consts';
|
|
3
4
|
const NESTED_TABLE_DEFAULT_ROWS = 2;
|
|
4
5
|
const NESTED_TABLE_DEFAULT_COLS = 2;
|
|
5
6
|
export const createTableWithWidth = ({
|
|
6
7
|
isTableScalingEnabled,
|
|
7
8
|
isTableAlignmentEnabled,
|
|
8
9
|
isFullWidthModeEnabled,
|
|
10
|
+
isMaxWidthModeEnabled,
|
|
9
11
|
isCommentEditor,
|
|
10
12
|
isChromelessEditor,
|
|
11
13
|
isTableResizingEnabled,
|
|
@@ -17,10 +19,14 @@ export const createTableWithWidth = ({
|
|
|
17
19
|
attrsOverrides.rowsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.rowsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.rowsCount : NESTED_TABLE_DEFAULT_ROWS;
|
|
18
20
|
attrsOverrides.colsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.colsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.colsCount : NESTED_TABLE_DEFAULT_COLS;
|
|
19
21
|
}
|
|
20
|
-
if (isTableScalingEnabled &&
|
|
21
|
-
|
|
22
|
+
if (isTableScalingEnabled && !isCommentEditor) {
|
|
23
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) && isMaxWidthModeEnabled) {
|
|
24
|
+
attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
|
|
25
|
+
} else if (isFullWidthModeEnabled) {
|
|
26
|
+
attrsOverrides.tableWidth = TABLE_FULL_WIDTH;
|
|
27
|
+
}
|
|
22
28
|
}
|
|
23
|
-
if (isTableAlignmentEnabled && (isFullWidthModeEnabled || isCommentEditor)) {
|
|
29
|
+
if (isTableAlignmentEnabled && (isFullWidthModeEnabled || expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) && isMaxWidthModeEnabled || isCommentEditor)) {
|
|
24
30
|
attrsOverrides.layout = 'align-start';
|
|
25
31
|
}
|
|
26
32
|
if (isCommentEditor && isTableResizingEnabled || isChromelessEditor) {
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
import { isVerticalPosition } from '@atlaskit/editor-common/guideline';
|
|
2
|
-
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
2
|
+
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMaxWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
4
5
|
const numberOfLanesInDefaultLayoutWidth = 12;
|
|
5
6
|
const calculateSubSnappingWidths = (totalLanes, totalWidth) => new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map((v, i) => v * (i + 1) * 2);
|
|
6
7
|
export const calculateDefaultSnappings = (lengthOffset = 0) => [...calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset), akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, akEditorFullWidthLayoutWidth + lengthOffset];
|
|
7
|
-
const getPadding =
|
|
8
|
-
return
|
|
8
|
+
const getPadding = editorContainerWidth => {
|
|
9
|
+
return editorContainerWidth <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
9
10
|
exposure: true
|
|
10
11
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
// FF TablePreserve for calculateDefaultSnappings
|
|
14
|
-
export const calculateDefaultTablePreserveSnappings = (lengthOffset = 0,
|
|
15
|
+
export const calculateDefaultTablePreserveSnappings = (lengthOffset = 0, editorContainerWidth = akEditorFullWidthLayoutWidth, exclude = {
|
|
15
16
|
innerGuidelines: false,
|
|
16
17
|
breakoutPoints: false
|
|
17
18
|
}) => {
|
|
18
|
-
const padding = getPadding(
|
|
19
|
-
const dynamicFullWidthLine =
|
|
19
|
+
const padding = getPadding(editorContainerWidth);
|
|
20
|
+
const dynamicFullWidthLine = editorContainerWidth - padding * 2 >= akEditorFullWidthLayoutWidth ? akEditorFullWidthLayoutWidth : editorContainerWidth - padding * 2;
|
|
21
|
+
const dynamicMaxWidthLine = editorContainerWidth - padding * 2 >= akEditorMaxWidthLayoutWidth ? akEditorMaxWidthLayoutWidth : editorContainerWidth - padding * 2;
|
|
20
22
|
const guides = [dynamicFullWidthLine - lengthOffset];
|
|
23
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
24
|
+
guides.push(dynamicMaxWidthLine - lengthOffset);
|
|
25
|
+
}
|
|
21
26
|
if (!exclude.breakoutPoints) {
|
|
22
27
|
guides.unshift(akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset);
|
|
23
28
|
}
|
|
@@ -92,6 +92,8 @@ const tablePlugin = ({
|
|
|
92
92
|
const sharedStateInternal = {
|
|
93
93
|
isFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.fullWidthEnabled),
|
|
94
94
|
wasFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasFullWidthEnabled),
|
|
95
|
+
isMaxWidthModeEnabled: !!(options !== null && options !== void 0 && options.maxWidthEnabled),
|
|
96
|
+
wasMaxWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasMaxWidthEnabled),
|
|
95
97
|
isHeaderRowEnabled: tablePluginState.isHeaderRowEnabled,
|
|
96
98
|
isHeaderColumnEnabled: tablePluginState.isHeaderColumnEnabled,
|
|
97
99
|
ordering: tablePluginState.ordering,
|
|
@@ -136,6 +138,7 @@ const tablePlugin = ({
|
|
|
136
138
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
137
139
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
138
140
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
141
|
+
isMaxWidthModeEnabled: options === null || options === void 0 ? void 0 : options.maxWidthEnabled,
|
|
139
142
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
140
143
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
141
144
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
@@ -146,6 +149,7 @@ const tablePlugin = ({
|
|
|
146
149
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
147
150
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
148
151
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
152
|
+
isMaxWidthModeEnabled: options === null || options === void 0 ? void 0 : options.maxWidthEnabled,
|
|
149
153
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
150
154
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
151
155
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
@@ -173,6 +177,7 @@ const tablePlugin = ({
|
|
|
173
177
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
174
178
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
175
179
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
180
|
+
isMaxWidthModeEnabled: options === null || options === void 0 ? void 0 : options.maxWidthEnabled,
|
|
176
181
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
177
182
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
178
183
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing,
|
|
@@ -373,8 +378,8 @@ const tablePlugin = ({
|
|
|
373
378
|
dispatchAnalyticsEvent,
|
|
374
379
|
dispatch
|
|
375
380
|
}) => {
|
|
376
|
-
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
377
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
381
|
+
var _options$fullWidthEna, _options$maxWidthEnab, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
382
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$maxWidthEnab = options.maxWidthEnabled) !== null && _options$maxWidthEnab !== void 0 ? _options$maxWidthEnab : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
378
383
|
}
|
|
379
384
|
}, {
|
|
380
385
|
name: 'tableWidthInCommentFix',
|
|
@@ -526,6 +531,7 @@ const tablePlugin = ({
|
|
|
526
531
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
527
532
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
528
533
|
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
534
|
+
isMaxWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isMaxWidthModeEnabled,
|
|
529
535
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
530
536
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
531
537
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
@@ -7,10 +7,11 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
7
7
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
8
|
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
9
9
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
11
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
11
12
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
12
13
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
13
|
-
import { TABLE_MAX_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
|
|
14
|
+
import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
|
|
14
15
|
import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
|
|
15
16
|
import { ALIGN_CENTER, ALIGN_START } from '../pm-plugins/utils/alignment';
|
|
16
17
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -248,7 +249,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
248
249
|
|
|
249
250
|
// Ensure minimum width for usability while respecting container constraints
|
|
250
251
|
var width = Math.max(calculatedWidth, Math.min(responsiveContainerWidth * 0.5, 300));
|
|
251
|
-
var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, TABLE_MAX_WIDTH);
|
|
252
|
+
var maxResizerWidth = isCommentEditor ? responsiveContainerWidth : Math.min(responsiveContainerWidth, expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH);
|
|
252
253
|
return {
|
|
253
254
|
width: width,
|
|
254
255
|
maxResizerWidth: maxResizerWidth
|
|
@@ -25,7 +25,7 @@ import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plu
|
|
|
25
25
|
import { updateWidthToWidest } from '../pm-plugins/commands/misc';
|
|
26
26
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
27
27
|
import { getColgroupChildrenLength } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
28
|
-
import { COLUMN_MIN_WIDTH, TABLE_MAX_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
|
|
28
|
+
import { COLUMN_MIN_WIDTH, TABLE_MAX_WIDTH, TABLE_FULL_WIDTH, TABLE_OFFSET_IN_COMMENT_EDITOR } from '../pm-plugins/table-resizing/utils/consts';
|
|
29
29
|
import { previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils/scale-table';
|
|
30
30
|
import { pluginKey as tableWidthPluginKey } from '../pm-plugins/table-width';
|
|
31
31
|
import { ALIGN_CENTER, ALIGN_START, normaliseAlignment, shouldChangeAlignmentToCenterResized } from '../pm-plugins/utils/alignment';
|
|
@@ -297,8 +297,8 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
297
297
|
var fullWidthGuideline = defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig).filter(function (guideline) {
|
|
298
298
|
return guideline.isFullWidth;
|
|
299
299
|
})[0];
|
|
300
|
-
var isFullWidthGuidelineActive = closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
301
|
-
var tableMaxWidth = isCommentEditor ? Math.floor(containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR) : TABLE_MAX_WIDTH;
|
|
300
|
+
var isFullWidthGuidelineActive = expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? closestSnap && fullWidthGuideline && closestSnap.keys.includes(fullWidthGuideline.key) : closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
301
|
+
var tableMaxWidth = isCommentEditor ? Math.floor(containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR) : expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH;
|
|
302
302
|
var shouldUpdateWidthToWidest = isCommentEditor ? tableMaxWidth <= newWidth : !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
303
303
|
var previewParentWidth = isCommentEditor && shouldUpdateWidthToWidest ? tableMaxWidth : newWidth;
|
|
304
304
|
previewScaleTable(tableRef, {
|
|
@@ -326,7 +326,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
326
326
|
var pos = getPos();
|
|
327
327
|
var currentTableNodeLocalId = (_node$attrs$localId2 = node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== null && _node$attrs$localId2 !== void 0 ? _node$attrs$localId2 : '';
|
|
328
328
|
var tableMaxWidth = isCommentEditor ? undefined // Table's full-width in comment appearance inherit the width of the Editor/Renderer
|
|
329
|
-
: TABLE_MAX_WIDTH;
|
|
329
|
+
: expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH;
|
|
330
330
|
newWidth = widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId] ? tableMaxWidth : newWidth;
|
|
331
331
|
var tr = state.tr.setMeta(tableWidthPluginKey, {
|
|
332
332
|
resizing: false,
|
|
@@ -12,6 +12,7 @@ import { getParentOfTypeCount } from '@atlaskit/editor-common/nesting';
|
|
|
12
12
|
import { nodeVisibilityManager } from '@atlaskit/editor-common/node-visibility';
|
|
13
13
|
import { findOverflowScrollParent } from '@atlaskit/editor-common/ui';
|
|
14
14
|
import { findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
15
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
16
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
16
17
|
import { pluginKey as tablePluginKey } from '../pm-plugins/plugin-key';
|
|
17
18
|
import { updateStickyState } from '../pm-plugins/sticky-headers/commands';
|
|
@@ -93,8 +94,20 @@ var TableRow = /*#__PURE__*/function (_TableNodeView) {
|
|
|
93
94
|
}
|
|
94
95
|
var pos = _this.getPos();
|
|
95
96
|
_this.isInNestedTable = false;
|
|
96
|
-
if (
|
|
97
|
-
|
|
97
|
+
if (fg('platform_editor_ai_aifc_patch_ga')) {
|
|
98
|
+
try {
|
|
99
|
+
// We cannot trust that the value from getPos will be defined
|
|
100
|
+
// https://discuss.prosemirror.net/t/getpos-is-undefined-in-nodeview-constructor/1246/4
|
|
101
|
+
// There are also scenarios where the value it brings back does not tally with the current doc
|
|
102
|
+
// E.g. when AI streaming brings in new content, this position brings back incorrect values that cannot be resolved
|
|
103
|
+
if (pos) {
|
|
104
|
+
_this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
105
|
+
}
|
|
106
|
+
} catch (e) {}
|
|
107
|
+
} else {
|
|
108
|
+
if (pos) {
|
|
109
|
+
_this.isInNestedTable = getParentOfTypeCount(view.state.schema.nodes.table)(view.state.doc.resolve(pos)) > 1;
|
|
110
|
+
}
|
|
98
111
|
}
|
|
99
112
|
if (_this.isHeaderRow) {
|
|
100
113
|
_this.dom.setAttribute('data-vc-nvs', 'true');
|
|
@@ -8,7 +8,7 @@ import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
|
8
8
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
9
9
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
10
|
import { generateColgroupFromNode, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
11
|
-
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
11
|
+
import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
12
12
|
import { getTableResizerContainerMaxWidthInCSS, getTableResizerContainerForFullPageWidthInCSS, getTableResizerItemWidthInCSS } from '../pm-plugins/table-resizing/utils/misc';
|
|
13
13
|
import { getAlignmentStyle } from './table-container-styles';
|
|
14
14
|
export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(config) {
|
|
@@ -112,7 +112,7 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
112
112
|
position: 'relative',
|
|
113
113
|
userSelect: 'auto',
|
|
114
114
|
boxSizing: 'border-box',
|
|
115
|
-
'--ak-editor-table-max-width': "".concat(TABLE_MAX_WIDTH, "px"),
|
|
115
|
+
'--ak-editor-table-max-width': "".concat(expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH, "px"),
|
|
116
116
|
'--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
|
|
117
117
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
118
118
|
maxWidth: getTableResizerContainerMaxWidthInCSS(config.isCommentEditor, config.isChromelessEditor, config.isTableScalingEnabled),
|
|
@@ -155,12 +155,13 @@ export var insertRow = function insertRow(row, moveCursorToTheNewRow) {
|
|
|
155
155
|
* @deprecated This function is deprecated - please use insertTableWithNestingSupport instead.
|
|
156
156
|
* (To be removed with feature gate: `platform_editor_use_nested_table_pm_nodes`)
|
|
157
157
|
*/
|
|
158
|
-
export var createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
158
|
+
export var createTable = function createTable(isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isMaxWidthModeEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor, isTableResizingEnabled) {
|
|
159
159
|
return function (state, dispatch) {
|
|
160
160
|
var table = createTableWithWidth({
|
|
161
161
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
162
162
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
163
163
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
164
|
+
isMaxWidthModeEnabled: isMaxWidthModeEnabled,
|
|
164
165
|
isCommentEditor: isCommentEditor,
|
|
165
166
|
isChromelessEditor: isChromelessEditor,
|
|
166
167
|
isTableResizingEnabled: isTableResizingEnabled
|
|
@@ -189,13 +190,14 @@ export var createTable = function createTable(isTableScalingEnabled, isTableAlig
|
|
|
189
190
|
* @deprecated This function is deprecated - please use insertTableWithNestingSupport instead.
|
|
190
191
|
* (To be removed with feature gate: `platform_editor_use_nested_table_pm_nodes`)
|
|
191
192
|
*/
|
|
192
|
-
export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor) {
|
|
193
|
+
export var insertTableWithSize = function insertTableWithSize(isFullWidthModeEnabled, isMaxWidthModeEnabled, isTableScalingEnabled, isTableAlignmentEnabled, editorAnalyticsAPI, isCommentEditor, isChromelessEditor) {
|
|
193
194
|
return function (rowsCount, colsCount, inputMethod) {
|
|
194
195
|
return function (_ref) {
|
|
195
196
|
var tr = _ref.tr;
|
|
196
197
|
var tableNode = createTableWithWidth({
|
|
197
198
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
198
199
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
200
|
+
isMaxWidthModeEnabled: isMaxWidthModeEnabled,
|
|
199
201
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
200
202
|
isCommentEditor: isCommentEditor,
|
|
201
203
|
isChromelessEditor: isChromelessEditor,
|
|
@@ -246,6 +248,8 @@ export var insertTableWithNestingSupport = function insertTableWithNestingSuppor
|
|
|
246
248
|
isTableAlignmentEnabled = _ref2$isTableAlignmen === void 0 ? false : _ref2$isTableAlignmen,
|
|
247
249
|
_ref2$isFullWidthMode = _ref2.isFullWidthModeEnabled,
|
|
248
250
|
isFullWidthModeEnabled = _ref2$isFullWidthMode === void 0 ? false : _ref2$isFullWidthMode,
|
|
251
|
+
_ref2$isMaxWidthModeE = _ref2.isMaxWidthModeEnabled,
|
|
252
|
+
isMaxWidthModeEnabled = _ref2$isMaxWidthModeE === void 0 ? false : _ref2$isMaxWidthModeE,
|
|
249
253
|
_ref2$isCommentEditor = _ref2.isCommentEditor,
|
|
250
254
|
isCommentEditor = _ref2$isCommentEditor === void 0 ? false : _ref2$isCommentEditor,
|
|
251
255
|
_ref2$isChromelessEdi = _ref2.isChromelessEditor,
|
|
@@ -281,6 +285,7 @@ export var insertTableWithNestingSupport = function insertTableWithNestingSuppor
|
|
|
281
285
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
282
286
|
isTableAlignmentEnabled: isTableAlignmentEnabled,
|
|
283
287
|
isFullWidthModeEnabled: isFullWidthModeEnabled,
|
|
288
|
+
isMaxWidthModeEnabled: isMaxWidthModeEnabled,
|
|
284
289
|
isCommentEditor: isCommentEditor,
|
|
285
290
|
isChromelessEditor: isChromelessEditor,
|
|
286
291
|
isTableResizingEnabled: isTableResizingEnabled,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export var COLUMN_MIN_WIDTH = 48;
|
|
2
|
-
|
|
2
|
+
// Remove TABLE_MAX_WIDTH_OLD when cleaning up editor_tinymce_full_width_mode experiment
|
|
3
|
+
export var TABLE_FULL_WIDTH = 1800;
|
|
4
|
+
export var TABLE_MAX_WIDTH = 4000;
|
|
3
5
|
export var FULL_WIDTH_EDITOR_CONTENT_WIDTH = 1800;
|
|
4
6
|
export var MAX_SCALING_PERCENT = 0.3;
|
|
5
7
|
export var MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION = 0.4;
|
|
@@ -2,9 +2,10 @@ import { getParentNodeWidth, getTableContainerWidth, layoutToWidth } from '@atla
|
|
|
2
2
|
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
4
4
|
import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
6
7
|
import { hasTableBeenResized, hasTableColumnBeenResized } from './colgroup';
|
|
7
|
-
import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION, TABLE_MAX_WIDTH } from './consts';
|
|
8
|
+
import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION, TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from './consts';
|
|
8
9
|
|
|
9
10
|
// Translates named layouts in number values.
|
|
10
11
|
export function getLayoutSize(tableLayout) {
|
|
@@ -97,7 +98,7 @@ export var getTableContainerElementWidth = function getTableContainerElementWidt
|
|
|
97
98
|
* @returns The CSS max-width value
|
|
98
99
|
*/
|
|
99
100
|
export var getTableResizerContainerMaxWidthInCSS = function getTableResizerContainerMaxWidthInCSS(isCommentEditor, isChromelessEditor, isTableScalingEnabled) {
|
|
100
|
-
var maxResizerWidthForNonCommentEditor = isTableScalingEnabled ? "min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2)), ".concat(TABLE_MAX_WIDTH, "px)") : "min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2) - var(--ak-editor--resizer-handle-spacing)), ".concat(TABLE_MAX_WIDTH, "px)");
|
|
101
|
+
var maxResizerWidthForNonCommentEditor = isTableScalingEnabled ? "min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2)), ".concat(expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH, "px)") : "min(calc(100cqw - calc(var(--ak-editor--large-gutter-padding) * 2) - var(--ak-editor--resizer-handle-spacing)), ".concat(expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH, "px)");
|
|
101
102
|
return isCommentEditor || isChromelessEditor ? '100%' : maxResizerWidthForNonCommentEditor;
|
|
102
103
|
};
|
|
103
104
|
|
|
@@ -13,11 +13,12 @@ import { SetAttrsStep } from '@atlaskit/adf-schema/steps';
|
|
|
13
13
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
14
14
|
import { isReplaceDocOperation } from '@atlaskit/editor-common/utils/document';
|
|
15
15
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
16
|
-
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
17
|
-
import {
|
|
16
|
+
import { akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorMaxWidthLayoutWidth, akEditorWideLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
17
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
|
+
import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from './table-resizing/utils/consts';
|
|
18
19
|
import { ALIGN_START } from './utils/alignment';
|
|
19
20
|
export var pluginKey = new PluginKey('tableWidthPlugin');
|
|
20
|
-
var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
21
|
+
var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullWidthEnabled, maxWidthEnabled, isTableScalingEnabled, isTableAlignmentEnabled, isCommentEditor) {
|
|
21
22
|
return new SafePlugin({
|
|
22
23
|
key: pluginKey,
|
|
23
24
|
state: {
|
|
@@ -67,7 +68,9 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
67
68
|
var layout = node.attrs.layout;
|
|
68
69
|
if (!width && layout) {
|
|
69
70
|
var tableWidthCal;
|
|
70
|
-
if (
|
|
71
|
+
if (maxWidthEnabled) {
|
|
72
|
+
tableWidthCal = akEditorMaxWidthLayoutWidth;
|
|
73
|
+
} else if (fullWidthEnabled) {
|
|
71
74
|
tableWidthCal = akEditorFullWidthLayoutWidth;
|
|
72
75
|
} else {
|
|
73
76
|
switch (layout) {
|
|
@@ -101,8 +104,8 @@ var createPlugin = function createPlugin(dispatch, dispatchAnalyticsEvent, fullW
|
|
|
101
104
|
step.getMap().forEach(function (_, __, newStart, newEnd) {
|
|
102
105
|
newState.doc.nodesBetween(newStart, newEnd, function (node, pos) {
|
|
103
106
|
if (node.type === table) {
|
|
104
|
-
if (shouldPatchTableWidth && node.attrs.width !== TABLE_MAX_WIDTH) {
|
|
105
|
-
tr.setNodeAttribute(pos, 'width', TABLE_MAX_WIDTH);
|
|
107
|
+
if (shouldPatchTableWidth && node.attrs.width !== expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH) {
|
|
108
|
+
tr.setNodeAttribute(pos, 'width', expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) ? TABLE_MAX_WIDTH : TABLE_FULL_WIDTH);
|
|
106
109
|
}
|
|
107
110
|
if (shouldPatchTableAlignment) {
|
|
108
111
|
tr.setNodeAttribute(pos, 'layout', ALIGN_START);
|
|
@@ -2,13 +2,15 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
2
2
|
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; }
|
|
3
3
|
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; }
|
|
4
4
|
import { createTable } from '@atlaskit/editor-tables/utils';
|
|
5
|
-
import {
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
|
+
import { TABLE_MAX_WIDTH, TABLE_FULL_WIDTH } from '../table-resizing/utils/consts';
|
|
6
7
|
var NESTED_TABLE_DEFAULT_ROWS = 2;
|
|
7
8
|
var NESTED_TABLE_DEFAULT_COLS = 2;
|
|
8
9
|
export var createTableWithWidth = function createTableWithWidth(_ref) {
|
|
9
10
|
var isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
10
11
|
isTableAlignmentEnabled = _ref.isTableAlignmentEnabled,
|
|
11
12
|
isFullWidthModeEnabled = _ref.isFullWidthModeEnabled,
|
|
13
|
+
isMaxWidthModeEnabled = _ref.isMaxWidthModeEnabled,
|
|
12
14
|
isCommentEditor = _ref.isCommentEditor,
|
|
13
15
|
isChromelessEditor = _ref.isChromelessEditor,
|
|
14
16
|
isTableResizingEnabled = _ref.isTableResizingEnabled,
|
|
@@ -20,10 +22,14 @@ export var createTableWithWidth = function createTableWithWidth(_ref) {
|
|
|
20
22
|
attrsOverrides.rowsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.rowsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.rowsCount : NESTED_TABLE_DEFAULT_ROWS;
|
|
21
23
|
attrsOverrides.colsCount = createTableProps !== null && createTableProps !== void 0 && createTableProps.colsCount ? createTableProps === null || createTableProps === void 0 ? void 0 : createTableProps.colsCount : NESTED_TABLE_DEFAULT_COLS;
|
|
22
24
|
}
|
|
23
|
-
if (isTableScalingEnabled &&
|
|
24
|
-
|
|
25
|
+
if (isTableScalingEnabled && !isCommentEditor) {
|
|
26
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) && isMaxWidthModeEnabled) {
|
|
27
|
+
attrsOverrides.tableWidth = TABLE_MAX_WIDTH;
|
|
28
|
+
} else if (isFullWidthModeEnabled) {
|
|
29
|
+
attrsOverrides.tableWidth = TABLE_FULL_WIDTH;
|
|
30
|
+
}
|
|
25
31
|
}
|
|
26
|
-
if (isTableAlignmentEnabled && (isFullWidthModeEnabled || isCommentEditor)) {
|
|
32
|
+
if (isTableAlignmentEnabled && (isFullWidthModeEnabled || expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true) && isMaxWidthModeEnabled || isCommentEditor)) {
|
|
27
33
|
attrsOverrides.layout = 'align-start';
|
|
28
34
|
}
|
|
29
35
|
if (isCommentEditor && isTableResizingEnabled || isChromelessEditor) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import { isVerticalPosition } from '@atlaskit/editor-common/guideline';
|
|
3
|
-
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMaxWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
5
6
|
var numberOfLanesInDefaultLayoutWidth = 12;
|
|
6
7
|
var calculateSubSnappingWidths = function calculateSubSnappingWidths(totalLanes, totalWidth) {
|
|
@@ -12,8 +13,8 @@ export var calculateDefaultSnappings = function calculateDefaultSnappings() {
|
|
|
12
13
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
13
14
|
return [].concat(_toConsumableArray(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset)), [akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, akEditorFullWidthLayoutWidth + lengthOffset]);
|
|
14
15
|
};
|
|
15
|
-
var getPadding = function getPadding(
|
|
16
|
-
return
|
|
16
|
+
var getPadding = function getPadding(editorContainerWidth) {
|
|
17
|
+
return editorContainerWidth <= akEditorFullPageNarrowBreakout && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
17
18
|
exposure: true
|
|
18
19
|
}) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
19
20
|
};
|
|
@@ -21,14 +22,18 @@ var getPadding = function getPadding(editorContainerWith) {
|
|
|
21
22
|
// FF TablePreserve for calculateDefaultSnappings
|
|
22
23
|
export var calculateDefaultTablePreserveSnappings = function calculateDefaultTablePreserveSnappings() {
|
|
23
24
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
24
|
-
var
|
|
25
|
+
var editorContainerWidth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : akEditorFullWidthLayoutWidth;
|
|
25
26
|
var exclude = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {
|
|
26
27
|
innerGuidelines: false,
|
|
27
28
|
breakoutPoints: false
|
|
28
29
|
};
|
|
29
|
-
var padding = getPadding(
|
|
30
|
-
var dynamicFullWidthLine =
|
|
30
|
+
var padding = getPadding(editorContainerWidth);
|
|
31
|
+
var dynamicFullWidthLine = editorContainerWidth - padding * 2 >= akEditorFullWidthLayoutWidth ? akEditorFullWidthLayoutWidth : editorContainerWidth - padding * 2;
|
|
32
|
+
var dynamicMaxWidthLine = editorContainerWidth - padding * 2 >= akEditorMaxWidthLayoutWidth ? akEditorMaxWidthLayoutWidth : editorContainerWidth - padding * 2;
|
|
31
33
|
var guides = [dynamicFullWidthLine - lengthOffset];
|
|
34
|
+
if (expValEquals('editor_tinymce_full_width_mode', 'isEnabled', true)) {
|
|
35
|
+
guides.push(dynamicMaxWidthLine - lengthOffset);
|
|
36
|
+
}
|
|
32
37
|
if (!exclude.breakoutPoints) {
|
|
33
38
|
guides.unshift(akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset);
|
|
34
39
|
}
|
package/dist/esm/tablePlugin.js
CHANGED
|
@@ -96,6 +96,8 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
96
96
|
var sharedStateInternal = {
|
|
97
97
|
isFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.fullWidthEnabled),
|
|
98
98
|
wasFullWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasFullWidthEnabled),
|
|
99
|
+
isMaxWidthModeEnabled: !!(options !== null && options !== void 0 && options.maxWidthEnabled),
|
|
100
|
+
wasMaxWidthModeEnabled: !!(options !== null && options !== void 0 && options.wasMaxWidthEnabled),
|
|
99
101
|
isHeaderRowEnabled: tablePluginState.isHeaderRowEnabled,
|
|
100
102
|
isHeaderColumnEnabled: tablePluginState.isHeaderColumnEnabled,
|
|
101
103
|
ordering: tablePluginState.ordering,
|
|
@@ -141,6 +143,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
141
143
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
142
144
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
143
145
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
146
|
+
isMaxWidthModeEnabled: options === null || options === void 0 ? void 0 : options.maxWidthEnabled,
|
|
144
147
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
145
148
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
146
149
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
@@ -151,6 +154,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
151
154
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
152
155
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
153
156
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
157
|
+
isMaxWidthModeEnabled: options === null || options === void 0 ? void 0 : options.maxWidthEnabled,
|
|
154
158
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
155
159
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
156
160
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
@@ -178,6 +182,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
178
182
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
179
183
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
180
184
|
isFullWidthModeEnabled: options === null || options === void 0 ? void 0 : options.fullWidthEnabled,
|
|
185
|
+
isMaxWidthModeEnabled: options === null || options === void 0 ? void 0 : options.maxWidthEnabled,
|
|
181
186
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
182
187
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
183
188
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing,
|
|
@@ -375,10 +380,10 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
375
380
|
}, {
|
|
376
381
|
name: 'tableWidth',
|
|
377
382
|
plugin: function plugin(_ref13) {
|
|
378
|
-
var _options$fullWidthEna, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
383
|
+
var _options$fullWidthEna, _options$maxWidthEnab, _options$isTableScali, _options$tableOptions3, _options$isCommentEdi;
|
|
379
384
|
var dispatchAnalyticsEvent = _ref13.dispatchAnalyticsEvent,
|
|
380
385
|
dispatch = _ref13.dispatch;
|
|
381
|
-
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
386
|
+
return options !== null && options !== void 0 && options.tableOptions.allowTableResizing ? createTableWidthPlugin(dispatch, dispatchAnalyticsEvent, (_options$fullWidthEna = options.fullWidthEnabled) !== null && _options$fullWidthEna !== void 0 ? _options$fullWidthEna : false, (_options$maxWidthEnab = options.maxWidthEnabled) !== null && _options$maxWidthEnab !== void 0 ? _options$maxWidthEnab : false, (_options$isTableScali = options.isTableScalingEnabled) !== null && _options$isTableScali !== void 0 ? _options$isTableScali : false, (_options$tableOptions3 = options.tableOptions.allowTableResizing) !== null && _options$tableOptions3 !== void 0 ? _options$tableOptions3 : false, (_options$isCommentEdi = options.isCommentEditor) !== null && _options$isCommentEdi !== void 0 ? _options$isCommentEdi : false) : undefined;
|
|
382
387
|
}
|
|
383
388
|
}, {
|
|
384
389
|
name: 'tableWidthInCommentFix',
|
|
@@ -530,6 +535,7 @@ var tablePlugin = function tablePlugin(_ref) {
|
|
|
530
535
|
isTableScalingEnabled: options === null || options === void 0 ? void 0 : options.isTableScalingEnabled,
|
|
531
536
|
isTableAlignmentEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableAlignment,
|
|
532
537
|
isFullWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isFullWidthModeEnabled,
|
|
538
|
+
isMaxWidthModeEnabled: tableState === null || tableState === void 0 ? void 0 : tableState.isMaxWidthModeEnabled,
|
|
533
539
|
isCommentEditor: options === null || options === void 0 ? void 0 : options.isCommentEditor,
|
|
534
540
|
isChromelessEditor: options === null || options === void 0 ? void 0 : options.isChromelessEditor,
|
|
535
541
|
isTableResizingEnabled: options === null || options === void 0 ? void 0 : options.tableOptions.allowTableResizing
|
|
@@ -12,6 +12,7 @@ type InsertTableWithNestingSupportCommand = (options: {
|
|
|
12
12
|
isChromelessEditor?: boolean;
|
|
13
13
|
isCommentEditor?: boolean;
|
|
14
14
|
isFullWidthModeEnabled?: boolean;
|
|
15
|
+
isMaxWidthModeEnabled?: boolean;
|
|
15
16
|
isTableAlignmentEnabled?: boolean;
|
|
16
17
|
isTableResizingEnabled?: boolean;
|
|
17
18
|
isTableScalingEnabled?: boolean;
|
|
@@ -26,13 +27,13 @@ export declare const insertRow: (row: number, moveCursorToTheNewRow: boolean) =>
|
|
|
26
27
|
* @deprecated This function is deprecated - please use insertTableWithNestingSupport instead.
|
|
27
28
|
* (To be removed with feature gate: `platform_editor_use_nested_table_pm_nodes`)
|
|
28
29
|
*/
|
|
29
|
-
export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
|
|
30
|
+
export declare const createTable: (isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, isFullWidthModeEnabled?: boolean, isMaxWidthModeEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined | null, isCommentEditor?: boolean, isChromelessEditor?: boolean, isTableResizingEnabled?: boolean) => Command;
|
|
30
31
|
/**
|
|
31
32
|
* @private
|
|
32
33
|
* @deprecated This function is deprecated - please use insertTableWithNestingSupport instead.
|
|
33
34
|
* (To be removed with feature gate: `platform_editor_use_nested_table_pm_nodes`)
|
|
34
35
|
*/
|
|
35
|
-
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean, isChromelessEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
36
|
+
export declare const insertTableWithSize: (isFullWidthModeEnabled?: boolean, isMaxWidthModeEnabled?: boolean, isTableScalingEnabled?: boolean, isTableAlignmentEnabled?: boolean, editorAnalyticsAPI?: EditorAnalyticsAPI, isCommentEditor?: boolean, isChromelessEditor?: boolean) => (rowsCount: number, colsCount: number, inputMethod?: INPUT_METHOD.PICKER) => EditorCommand;
|
|
36
37
|
/**
|
|
37
38
|
* Unified command to insert a new table into the editor.
|
|
38
39
|
*
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const COLUMN_MIN_WIDTH = 48;
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const TABLE_FULL_WIDTH = 1800;
|
|
3
|
+
export declare const TABLE_MAX_WIDTH = 4000;
|
|
3
4
|
export declare const FULL_WIDTH_EDITOR_CONTENT_WIDTH = 1800;
|
|
4
5
|
export declare const MAX_SCALING_PERCENT = 0.3;
|
|
5
6
|
export declare const MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION = 0.4;
|
|
@@ -13,7 +13,7 @@ type TableWidthPluginState = {
|
|
|
13
13
|
tableRef: HTMLTableElement | null;
|
|
14
14
|
};
|
|
15
15
|
export declare const pluginKey: PluginKey<TableWidthPluginState>;
|
|
16
|
-
declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, fullWidthEnabled: boolean, isTableScalingEnabled: boolean, isTableAlignmentEnabled: boolean, isCommentEditor: boolean) => SafePlugin<{
|
|
16
|
+
declare const createPlugin: (dispatch: Dispatch, dispatchAnalyticsEvent: DispatchAnalyticsEvent, fullWidthEnabled: boolean, maxWidthEnabled: boolean, isTableScalingEnabled: boolean, isTableAlignmentEnabled: boolean, isCommentEditor: boolean) => SafePlugin<{
|
|
17
17
|
resizing: boolean;
|
|
18
18
|
tableLocalId: string;
|
|
19
19
|
tableRef: null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isCommentEditor, isChromelessEditor, isTableResizingEnabled, isNestedTable, createTableProps, }: {
|
|
2
|
+
export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlignmentEnabled, isFullWidthModeEnabled, isMaxWidthModeEnabled, isCommentEditor, isChromelessEditor, isTableResizingEnabled, isNestedTable, createTableProps, }: {
|
|
3
3
|
createTableProps?: {
|
|
4
4
|
colsCount?: number;
|
|
5
5
|
rowsCount?: number;
|
|
@@ -7,6 +7,7 @@ export declare const createTableWithWidth: ({ isTableScalingEnabled, isTableAlig
|
|
|
7
7
|
isChromelessEditor?: boolean;
|
|
8
8
|
isCommentEditor?: boolean;
|
|
9
9
|
isFullWidthModeEnabled?: boolean;
|
|
10
|
+
isMaxWidthModeEnabled?: boolean;
|
|
10
11
|
isNestedTable?: boolean;
|
|
11
12
|
isTableAlignmentEnabled?: boolean;
|
|
12
13
|
isTableResizingEnabled?: boolean;
|
|
@@ -4,7 +4,7 @@ export type GuidelineExcludeConfig = {
|
|
|
4
4
|
breakoutPoints: boolean;
|
|
5
5
|
innerGuidelines: boolean;
|
|
6
6
|
};
|
|
7
|
-
export declare const calculateDefaultTablePreserveSnappings: (lengthOffset?: number,
|
|
7
|
+
export declare const calculateDefaultTablePreserveSnappings: (lengthOffset?: number, editorContainerWidth?: number, exclude?: GuidelineExcludeConfig) => number[];
|
|
8
8
|
export declare const defaultSnappingWidths: number[];
|
|
9
9
|
export declare const PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET = 0;
|
|
10
10
|
export declare const defaultTablePreserveSnappingWidths: (lengthOffset: number, editorContainerWidth: number, exclude?: GuidelineExcludeConfig) => number[];
|
|
@@ -23,8 +23,10 @@ export interface TablePluginOptions {
|
|
|
23
23
|
isChromelessEditor?: boolean;
|
|
24
24
|
isCommentEditor?: boolean;
|
|
25
25
|
isTableScalingEnabled?: boolean;
|
|
26
|
+
maxWidthEnabled?: boolean;
|
|
26
27
|
tableOptions: PluginConfig;
|
|
27
28
|
wasFullWidthEnabled?: boolean;
|
|
29
|
+
wasMaxWidthEnabled?: boolean;
|
|
28
30
|
}
|
|
29
31
|
type InsertTableAction = (analyticsPayload: AnalyticsEventPayload) => Command;
|
|
30
32
|
type MediaPlugin = NextEditorPlugin<'media', {
|
|
@@ -34,7 +34,7 @@ export type PluginInjectionAPIWithA11y = ExtractInjectionAPI<TablePlugin> & {
|
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
36
|
};
|
|
37
|
-
export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'isHeaderRowEnabled' | 'isHeaderColumnEnabled' | 'ordering' | 'isInDanger' | 'hoveredRows' | 'hoveredColumns' | 'hoveredCell' | 'isTableHovered' | 'tableNode' | 'widthToWidest' | 'tableRef' | 'tablePos' | 'targetCellPosition' | 'isContextualMenuOpen' | 'pluginConfig' | 'insertColumnButtonIndex' | 'insertRowButtonIndex' | 'isDragAndDropEnabled' | 'tableWrapperTarget' | 'isCellMenuOpenByKeyboard'> & {
|
|
37
|
+
export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'isMaxWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'wasMaxWidthModeEnabled' | 'isHeaderRowEnabled' | 'isHeaderColumnEnabled' | 'ordering' | 'isInDanger' | 'hoveredRows' | 'hoveredColumns' | 'hoveredCell' | 'isTableHovered' | 'tableNode' | 'widthToWidest' | 'tableRef' | 'tablePos' | 'targetCellPosition' | 'isContextualMenuOpen' | 'pluginConfig' | 'insertColumnButtonIndex' | 'insertRowButtonIndex' | 'isDragAndDropEnabled' | 'tableWrapperTarget' | 'isCellMenuOpenByKeyboard'> & {
|
|
38
38
|
dragMenuDirection?: TableDirection;
|
|
39
39
|
dragMenuIndex?: number;
|
|
40
40
|
isDragMenuOpen?: boolean;
|
|
@@ -47,7 +47,7 @@ export type TableSharedStateInternal = Pick<TablePluginState, 'isFullWidthModeEn
|
|
|
47
47
|
sizeSelectorTargetRef?: HTMLElement;
|
|
48
48
|
stickyHeader?: RowStickyState;
|
|
49
49
|
};
|
|
50
|
-
export type TableSharedState = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'wasFullWidthModeEnabled'>;
|
|
50
|
+
export type TableSharedState = Pick<TablePluginState, 'isFullWidthModeEnabled' | 'wasFullWidthModeEnabled' | 'isMaxWidthModeEnabled' | 'wasMaxWidthModeEnabled'>;
|
|
51
51
|
export type AlignmentOptions = 'center' | 'align-start';
|
|
52
52
|
export type InsertRowMethods = INPUT_METHOD.CONTEXT_MENU | INPUT_METHOD.BUTTON | INPUT_METHOD.SHORTCUT | INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB | INPUT_METHOD.TABLE_CONTEXT_MENU;
|
|
53
53
|
export interface PluginConfig {
|
|
@@ -100,6 +100,7 @@ export interface TablePluginState {
|
|
|
100
100
|
isHeaderRowEnabled: boolean;
|
|
101
101
|
isInDanger?: boolean;
|
|
102
102
|
isKeyboardResize?: boolean;
|
|
103
|
+
isMaxWidthModeEnabled?: boolean;
|
|
103
104
|
isNumberColumnEnabled?: boolean;
|
|
104
105
|
isResizeHandleWidgetAdded?: boolean;
|
|
105
106
|
isTableCollapsed?: boolean;
|
|
@@ -117,6 +118,7 @@ export interface TablePluginState {
|
|
|
117
118
|
tableWrapperTarget?: HTMLElement;
|
|
118
119
|
targetCellPosition?: number;
|
|
119
120
|
wasFullWidthModeEnabled?: boolean;
|
|
121
|
+
wasMaxWidthModeEnabled?: boolean;
|
|
120
122
|
widthToWidest?: WidthToWidest;
|
|
121
123
|
}
|
|
122
124
|
export type TablePluginAction = {
|