@atlaskit/editor-plugin-table 11.1.2 → 11.1.4
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 +19 -0
- package/afm-rovo-extension/tsconfig.json +108 -0
- package/dist/cjs/nodeviews/TableContainer.js +8 -3
- package/dist/cjs/nodeviews/TableResizer.js +10 -5
- package/dist/cjs/nodeviews/toDOM.js +10 -3
- package/dist/cjs/pm-plugins/table-resizing/utils/misc.js +6 -1
- package/dist/cjs/pm-plugins/utils/snapping.js +9 -2
- package/dist/cjs/ui/DragPreview/index.js +2 -0
- package/dist/cjs/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +2 -0
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +2 -0
- package/dist/cjs/ui/TableFullWidthLabel/index.js +2 -0
- package/dist/es2019/nodeviews/TableContainer.js +9 -4
- package/dist/es2019/nodeviews/TableResizer.js +11 -6
- package/dist/es2019/nodeviews/toDOM.js +10 -3
- package/dist/es2019/pm-plugins/table-resizing/utils/misc.js +7 -2
- package/dist/es2019/pm-plugins/utils/snapping.js +10 -3
- package/dist/es2019/ui/DragPreview/index.js +2 -0
- package/dist/es2019/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +1 -0
- package/dist/es2019/ui/TableFullWidthLabel/index.js +1 -0
- package/dist/es2019/ui/toolbar.js +1 -1
- package/dist/esm/nodeviews/TableContainer.js +9 -4
- package/dist/esm/nodeviews/TableResizer.js +11 -6
- package/dist/esm/nodeviews/toDOM.js +10 -3
- package/dist/esm/pm-plugins/table-resizing/utils/misc.js +7 -2
- package/dist/esm/pm-plugins/utils/snapping.js +10 -3
- package/dist/esm/ui/DragPreview/index.js +2 -0
- package/dist/esm/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.js +1 -0
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +1 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +1 -0
- package/dist/esm/ui/TableFullWidthLabel/index.js +1 -0
- package/dist/esm/ui/toolbar.js +1 -1
- package/package.json +4 -4
- package/src/nodeviews/TableContainer.tsx +15 -5
- package/src/nodeviews/TableResizer.tsx +20 -9
- package/src/nodeviews/toDOM.ts +10 -3
- package/src/pm-plugins/table-resizing/utils/misc.ts +12 -1
- package/src/pm-plugins/utils/snapping.ts +15 -3
- package/src/ui/DragPreview/index.tsx +1 -0
- package/src/ui/FloatingAlignmentButtons/FloatingAlignmentButtons.tsx +1 -0
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +1 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +1 -0
- package/src/ui/TableFullWidthLabel/index.tsx +1 -0
- package/src/ui/toolbar.tsx +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 11.1.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#185940](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/185940)
|
|
8
|
+
[`456bee393c4d3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/456bee393c4d3) -
|
|
9
|
+
[ux] When editor-area is less than 768px wide, we reduce editor gutters to 24px in Full-page
|
|
10
|
+
editor.
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## 11.1.3
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#187144](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/187144)
|
|
18
|
+
[`a16147d8fbdfe`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a16147d8fbdfe) -
|
|
19
|
+
Bump @atlaskit/adf-schema to v49.0.5
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 11.1.2
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.rovo-extension.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../rovo-extension/tsDist/@atlaskit__editor-plugin-table/app",
|
|
7
|
+
"rootDir": "../",
|
|
8
|
+
"composite": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*"
|
|
18
|
+
],
|
|
19
|
+
"references": [
|
|
20
|
+
{
|
|
21
|
+
"path": "../../../design-system/button/afm-rovo-extension/tsconfig.json"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"path": "../../custom-steps/afm-rovo-extension/tsconfig.json"
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"path": "../../editor-palette/afm-rovo-extension/tsconfig.json"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"path": "../../editor-plugin-accessibility-utils/afm-rovo-extension/tsconfig.json"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"path": "../../editor-plugin-analytics/afm-rovo-extension/tsconfig.json"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"path": "../../editor-plugin-batch-attribute-updates/afm-rovo-extension/tsconfig.json"
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"path": "../../editor-plugin-content-insertion/afm-rovo-extension/tsconfig.json"
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"path": "../../editor-plugin-editor-viewmode/afm-rovo-extension/tsconfig.json"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"path": "../../editor-plugin-extension/afm-rovo-extension/tsconfig.json"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"path": "../../editor-plugin-guideline/afm-rovo-extension/tsconfig.json"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"path": "../../editor-plugin-interaction/afm-rovo-extension/tsconfig.json"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"path": "../../editor-plugin-selection/afm-rovo-extension/tsconfig.json"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "../../editor-plugin-width/afm-rovo-extension/tsconfig.json"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"path": "../../editor-shared-styles/afm-rovo-extension/tsconfig.json"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"path": "../../editor-tables/afm-rovo-extension/tsconfig.json"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"path": "../../../design-system/icon/afm-rovo-extension/tsconfig.json"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"path": "../../../design-system/menu/afm-rovo-extension/tsconfig.json"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "../../../platform/feature-flags/afm-rovo-extension/tsconfig.json"
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"path": "../../../pragmatic-drag-and-drop/core/afm-rovo-extension/tsconfig.json"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"path": "../../../pragmatic-drag-and-drop/auto-scroll/afm-rovo-extension/tsconfig.json"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"path": "../../../pragmatic-drag-and-drop/hitbox/afm-rovo-extension/tsconfig.json"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"path": "../../../design-system/primitives/afm-rovo-extension/tsconfig.json"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"path": "../../../react-ufo/atlaskit/afm-rovo-extension/tsconfig.json"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"path": "../../../design-system/theme/afm-rovo-extension/tsconfig.json"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"path": "../../tmp-editor-statsig/afm-rovo-extension/tsconfig.json"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"path": "../../../design-system/toggle/afm-rovo-extension/tsconfig.json"
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"path": "../../../design-system/tokens/afm-rovo-extension/tsconfig.json"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"path": "../../../design-system/tooltip/afm-rovo-extension/tsconfig.json"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"path": "../../editor-common/afm-rovo-extension/tsconfig.json"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
@@ -15,6 +15,7 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
15
15
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
16
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
17
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
18
19
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
19
20
|
var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
|
|
20
21
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
@@ -158,6 +159,9 @@ var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (
|
|
|
158
159
|
editorViewModeState: editorViewModeState
|
|
159
160
|
};
|
|
160
161
|
});
|
|
162
|
+
var getPadding = function getPadding(containerWidth) {
|
|
163
|
+
return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
|
|
164
|
+
};
|
|
161
165
|
var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_react.default.memo(function (_ref4) {
|
|
162
166
|
var children = _ref4.children,
|
|
163
167
|
className = _ref4.className,
|
|
@@ -242,6 +246,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
242
246
|
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
243
247
|
var responsiveContainerWidth = 0;
|
|
244
248
|
var resizeHandleSpacing = 12;
|
|
249
|
+
var padding = getPadding(containerWidth);
|
|
245
250
|
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
246
251
|
// updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
|
|
247
252
|
// issues when viwport width is less than full width Editor's width. To detect avoid them
|
|
@@ -251,7 +256,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
251
256
|
// When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
|
|
252
257
|
// When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
|
|
253
258
|
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
254
|
-
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth -
|
|
259
|
+
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
255
260
|
|
|
256
261
|
// platform_editor_table_fw_numcol_overflow_fix:
|
|
257
262
|
// lineLength is undefined on first paint → width: NaN → wrapper expands to page
|
|
@@ -265,7 +270,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
265
270
|
// 2) TODO: widen lineLength to `number|undefined` and remove this block.
|
|
266
271
|
if ((0, _platformFeatureFlags.fg)('platform_editor_table_fw_numcol_overflow_fix')) {
|
|
267
272
|
if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
|
|
268
|
-
responsiveContainerWidth = containerWidth -
|
|
273
|
+
responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
|
|
269
274
|
}
|
|
270
275
|
}
|
|
271
276
|
} else if (isCommentEditor) {
|
|
@@ -275,7 +280,7 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
275
280
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
276
281
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
277
282
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
278
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth -
|
|
283
|
+
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
279
284
|
}
|
|
280
285
|
var width = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
281
286
|
if (!isResizing) {
|
|
@@ -24,6 +24,7 @@ var _commands = require("@atlaskit/editor-prosemirror/commands");
|
|
|
24
24
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
25
25
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
26
26
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
27
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
27
28
|
var _commandsWithAnalytics = require("../pm-plugins/commands/commands-with-analytics");
|
|
28
29
|
var _misc = require("../pm-plugins/commands/misc");
|
|
29
30
|
var _tableAnalytics = require("../pm-plugins/table-analytics");
|
|
@@ -76,6 +77,9 @@ var getResizerMinWidth = function getResizerMinWidth(node) {
|
|
|
76
77
|
// the table can't scale past its min-width, so instead restrict table container min width to avoid that situation
|
|
77
78
|
return minColumnWidth + 1;
|
|
78
79
|
};
|
|
80
|
+
var getPadding = function getPadding(containerWidth) {
|
|
81
|
+
return containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
|
|
82
|
+
};
|
|
79
83
|
|
|
80
84
|
/**
|
|
81
85
|
* When guidelines are outside the viewport, filter them out, do not show
|
|
@@ -96,8 +100,9 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
|
|
|
96
100
|
// For PTW we need to ensure that dynamic guideline never gets excluded: 1181 should be > width + guidelineVisibleAdjustment
|
|
97
101
|
// guidelineVisibleAdjustment is set as a negative value, so we making it positive and adding + 1
|
|
98
102
|
var preserve_table_widths_adjustment = -1 * _guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET + 1;
|
|
103
|
+
var padding = getPadding(containerWidth);
|
|
99
104
|
guidelineVisibleAdjustment = isFullWidthModeEnabled ? preserve_table_widths_adjustment // guidelineVisibleAdjustment = -2, if lineLength = 1180, 1181 < 1180 + 2 is true.
|
|
100
|
-
: -2 *
|
|
105
|
+
: -2 * padding + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
|
|
101
106
|
}
|
|
102
107
|
var width = isTableScalingEnabled && isFullWidthModeEnabled ? lineLength : containerWidth;
|
|
103
108
|
return guidelines.filter(function (guideline) {
|
|
@@ -209,7 +214,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
209
214
|
keys = _ref2.keys;
|
|
210
215
|
if (gap !== currentGap.current) {
|
|
211
216
|
currentGap.current = gap;
|
|
212
|
-
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * (
|
|
217
|
+
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : _guidelines.defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
213
218
|
displayGuideline((0, _guideline.getGuidelinesWithHighlights)(gap, _consts2.TABLE_SNAP_GAP, keys, visibleGuidelines));
|
|
214
219
|
}
|
|
215
220
|
}, [isTableScalingEnabled, excludeGuidelineConfig, containerWidth, displayGuideline, lineLength, isFullWidthModeEnabled]);
|
|
@@ -217,7 +222,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
217
222
|
return snappingEnabled ? {
|
|
218
223
|
x: isTableScalingEnabled ? (0, _snapping.defaultTablePreserveSnappingWidths)(_snapping.PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET,
|
|
219
224
|
// was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
220
|
-
isFullWidthModeEnabled ? lineLength + 2 * (
|
|
225
|
+
isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : _snapping.defaultSnappingWidths
|
|
221
226
|
} : undefined;
|
|
222
227
|
}, [snappingEnabled, isTableScalingEnabled, excludeGuidelineConfig, containerWidth, lineLength, isFullWidthModeEnabled]);
|
|
223
228
|
var switchToCenterAlignment = (0, _react.useCallback)(function (pos, node, newWidth, state, dispatch) {
|
|
@@ -266,7 +271,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
266
271
|
name: _analytics.TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
267
272
|
});
|
|
268
273
|
dispatch(tr);
|
|
269
|
-
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * (
|
|
274
|
+
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : _guidelines.defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
270
275
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
271
276
|
if (onResizeStart) {
|
|
272
277
|
onResizeStart();
|
|
@@ -288,7 +293,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
288
293
|
if (typeof pos !== 'number') {
|
|
289
294
|
return;
|
|
290
295
|
}
|
|
291
|
-
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * (
|
|
296
|
+
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth;
|
|
292
297
|
var closestSnap = !isCommentEditor && (0, _snapping.findClosestSnap)(newWidth, isTableScalingEnabled ? (0, _snapping.defaultTablePreserveSnappingWidths)(_snapping.PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : _snapping.defaultSnappingWidths, isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : _guidelines.defaultGuidelines, _consts2.TABLE_HIGHLIGHT_GAP, _consts2.TABLE_HIGHLIGHT_TOLERANCE);
|
|
293
298
|
closestSnap && updateActiveGuidelines(closestSnap);
|
|
294
299
|
|
|
@@ -12,6 +12,7 @@ var _kebabCase = _interopRequireDefault(require("lodash/kebabCase"));
|
|
|
12
12
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
13
|
var _lazyNodeView = require("@atlaskit/editor-common/lazy-node-view");
|
|
14
14
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
16
|
var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
|
|
16
17
|
var _consts = require("../pm-plugins/table-resizing/utils/consts");
|
|
17
18
|
var _tableContainerStyles = require("./table-container-styles");
|
|
@@ -21,7 +22,13 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
21
22
|
var tableNode = config.isNestingSupported ? _adfSchema.tableWithNestedTable : _adfSchema.table;
|
|
22
23
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
23
24
|
toDOM: function toDOM(node) {
|
|
24
|
-
var gutterPadding =
|
|
25
|
+
var gutterPadding = function gutterPadding() {
|
|
26
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
27
|
+
return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
|
|
28
|
+
} else {
|
|
29
|
+
return "".concat((0, _editorSharedStyles.akEditorGutterPaddingDynamic)() * 2, "px");
|
|
30
|
+
}
|
|
31
|
+
};
|
|
25
32
|
var alignmentStyle = Object.entries((0, _tableContainerStyles.getAlignmentStyle)(node.attrs.layout)).map(function (_ref) {
|
|
26
33
|
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
27
34
|
k = _ref2[0],
|
|
@@ -78,14 +85,14 @@ var tableNodeSpecWithFixedToDOM = exports.tableNodeSpecWithFixedToDOM = function
|
|
|
78
85
|
style: alignmentStyle
|
|
79
86
|
}, ['div', {
|
|
80
87
|
class: 'pm-table-resizer-container',
|
|
81
|
-
style: "width: min(calc(100cqw - ".concat(gutterPadding, "
|
|
88
|
+
style: "width: min(calc(100cqw - ".concat(gutterPadding(), "), ").concat(tableWidthAttribute, ");")
|
|
82
89
|
}, ['div', {
|
|
83
90
|
class: 'resizer-item display-handle',
|
|
84
91
|
style: (0, _lazyNodeView.convertToInlineCss)({
|
|
85
92
|
position: 'relative',
|
|
86
93
|
userSelect: 'auto',
|
|
87
94
|
boxSizing: 'border-box',
|
|
88
|
-
'--ak-editor-table-gutter-padding': "".concat(gutterPadding
|
|
95
|
+
'--ak-editor-table-gutter-padding': "".concat(gutterPadding()),
|
|
89
96
|
'--ak-editor-table-max-width': "".concat(_consts.TABLE_MAX_WIDTH, "px"),
|
|
90
97
|
'--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
|
|
91
98
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
@@ -11,6 +11,7 @@ var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
|
11
11
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
12
12
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
13
13
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
15
|
var _colgroup = require("./colgroup");
|
|
15
16
|
var _consts = require("./consts");
|
|
16
17
|
// Translates named layouts in number values.
|
|
@@ -19,7 +20,11 @@ function getLayoutSize(tableLayout) {
|
|
|
19
20
|
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
20
21
|
var isFullWidthModeEnabled = options.isFullWidthModeEnabled;
|
|
21
22
|
if (isFullWidthModeEnabled) {
|
|
22
|
-
|
|
23
|
+
var padding = (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
|
|
24
|
+
if (containerWidth <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
25
|
+
padding = _editorSharedStyles.akEditorGutterPaddingReduced;
|
|
26
|
+
}
|
|
27
|
+
return containerWidth ? Math.min(containerWidth - padding * 2, _editorSharedStyles.akEditorFullWidthLayoutWidth) : _editorSharedStyles.akEditorFullWidthLayoutWidth;
|
|
23
28
|
}
|
|
24
29
|
var calculatedTableWidth = (0, _styles.calcTableWidth)(tableLayout, containerWidth, true);
|
|
25
30
|
if (calculatedTableWidth !== 'inherit') {
|
|
@@ -8,6 +8,7 @@ exports.findClosestSnap = exports.defaultTablePreserveSnappingWidths = exports.d
|
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _guideline = require("@atlaskit/editor-common/guideline");
|
|
10
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
12
|
var numberOfLanesInDefaultLayoutWidth = 12;
|
|
12
13
|
var calculateSubSnappingWidths = function calculateSubSnappingWidths(totalLanes, totalWidth) {
|
|
13
14
|
return new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map(function (v, i) {
|
|
@@ -18,6 +19,10 @@ var calculateDefaultSnappings = exports.calculateDefaultSnappings = function cal
|
|
|
18
19
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
19
20
|
return [].concat((0, _toConsumableArray2.default)(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, _editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset)), [_editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset, _editorSharedStyles.akEditorCalculatedWideLayoutWidth + lengthOffset, _editorSharedStyles.akEditorFullWidthLayoutWidth + lengthOffset]);
|
|
20
21
|
};
|
|
22
|
+
var getPadding = function getPadding(editorContainerWith) {
|
|
23
|
+
return editorContainerWith <= _editorSharedStyles.akEditorFullPageNarrowBreakout && (0, _expValEquals.expValEquals)('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? _editorSharedStyles.akEditorGutterPaddingReduced : (0, _editorSharedStyles.akEditorGutterPaddingDynamic)();
|
|
24
|
+
};
|
|
25
|
+
|
|
21
26
|
// FF TablePreserve for calculateDefaultSnappings
|
|
22
27
|
var calculateDefaultTablePreserveSnappings = exports.calculateDefaultTablePreserveSnappings = function calculateDefaultTablePreserveSnappings() {
|
|
23
28
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
@@ -26,7 +31,8 @@ var calculateDefaultTablePreserveSnappings = exports.calculateDefaultTablePreser
|
|
|
26
31
|
innerGuidelines: false,
|
|
27
32
|
breakoutPoints: false
|
|
28
33
|
};
|
|
29
|
-
var
|
|
34
|
+
var padding = getPadding(editorContainerWith);
|
|
35
|
+
var dynamicFullWidthLine = editorContainerWith - padding * 2 >= _editorSharedStyles.akEditorFullWidthLayoutWidth ? _editorSharedStyles.akEditorFullWidthLayoutWidth : editorContainerWith - padding * 2;
|
|
30
36
|
var guides = [dynamicFullWidthLine - lengthOffset];
|
|
31
37
|
if (!exclude.breakoutPoints) {
|
|
32
38
|
guides.unshift(_editorSharedStyles.akEditorDefaultLayoutWidth + lengthOffset, _editorSharedStyles.akEditorCalculatedWideLayoutWidth + lengthOffset);
|
|
@@ -44,7 +50,8 @@ var defaultTablePreserveSnappingWidths = exports.defaultTablePreserveSnappingWid
|
|
|
44
50
|
innerGuidelines: false,
|
|
45
51
|
breakoutPoints: false
|
|
46
52
|
};
|
|
47
|
-
|
|
53
|
+
var padding = getPadding(editorContainerWidth);
|
|
54
|
+
return editorContainerWidth - padding * 2 > _editorSharedStyles.akEditorFullWidthLayoutWidth ? calculateDefaultSnappings() : calculateDefaultTablePreserveSnappings(lengthOffset, editorContainerWidth, exclude); // lengthOffset was hardcoded 0 here, created PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
48
55
|
};
|
|
49
56
|
|
|
50
57
|
/**
|
|
@@ -8,6 +8,8 @@ exports.DragPreview = void 0;
|
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _primitives = require("@atlaskit/primitives");
|
|
10
10
|
var _DragInMotionIcon = require("../icons/DragInMotionIcon");
|
|
11
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
12
|
+
|
|
11
13
|
var boxStyles = (0, _primitives.xcss)({
|
|
12
14
|
borderColor: 'color.border.focused',
|
|
13
15
|
borderStyle: 'solid',
|
|
@@ -14,6 +14,8 @@ var _primitives = require("@atlaskit/primitives");
|
|
|
14
14
|
*/
|
|
15
15
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
16
16
|
|
|
17
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
18
|
+
|
|
17
19
|
var containerStyles = (0, _primitives.xcss)({
|
|
18
20
|
marginLeft: 'space.100'
|
|
19
21
|
});
|
|
@@ -63,6 +63,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
63
63
|
* @jsxRuntime classic
|
|
64
64
|
* @jsx jsx
|
|
65
65
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
66
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
66
67
|
var arrowsList = new Set(['ArrowRight', 'ArrowLeft']);
|
|
67
68
|
var elementBeforeIconStyles = (0, _primitives.xcss)({
|
|
68
69
|
marginRight: 'space.negative.075',
|
|
@@ -46,6 +46,8 @@ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r
|
|
|
46
46
|
|
|
47
47
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
48
48
|
|
|
49
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
50
|
+
|
|
49
51
|
var MapDragMenuOptionIdToMessage = {
|
|
50
52
|
add_row_above: {
|
|
51
53
|
message: _messages.tableMessages.addRowAbove,
|
|
@@ -9,6 +9,8 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
10
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
11
|
var _primitives = require("@atlaskit/primitives");
|
|
12
|
+
// eslint-disable-next-line @atlaskit/design-system/no-emotion-primitives -- to be migrated to @atlaskit/primitives/compiled – go/akcss
|
|
13
|
+
|
|
12
14
|
var tableFullWidthLabelWrapperStyles = (0, _primitives.xcss)({
|
|
13
15
|
height: "var(--ds-space-400, 32px)",
|
|
14
16
|
display: 'flex',
|
|
@@ -4,8 +4,9 @@ import classNames from 'classnames';
|
|
|
4
4
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
6
6
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
7
|
-
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
10
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
10
11
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
11
12
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
@@ -156,6 +157,9 @@ const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
|
156
157
|
editorViewModeState
|
|
157
158
|
};
|
|
158
159
|
});
|
|
160
|
+
const getPadding = containerWidth => {
|
|
161
|
+
return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
162
|
+
};
|
|
159
163
|
export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
160
164
|
children,
|
|
161
165
|
className,
|
|
@@ -239,6 +243,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
239
243
|
const tableWidth = getTableContainerWidth(node);
|
|
240
244
|
let responsiveContainerWidth = 0;
|
|
241
245
|
const resizeHandleSpacing = 12;
|
|
246
|
+
const padding = getPadding(containerWidth);
|
|
242
247
|
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
243
248
|
// updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
|
|
244
249
|
// issues when viwport width is less than full width Editor's width. To detect avoid them
|
|
@@ -248,7 +253,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
248
253
|
// When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
|
|
249
254
|
// When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
|
|
250
255
|
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
251
|
-
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth -
|
|
256
|
+
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
252
257
|
|
|
253
258
|
// platform_editor_table_fw_numcol_overflow_fix:
|
|
254
259
|
// lineLength is undefined on first paint → width: NaN → wrapper expands to page
|
|
@@ -262,7 +267,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
262
267
|
// 2) TODO: widen lineLength to `number|undefined` and remove this block.
|
|
263
268
|
if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
|
|
264
269
|
if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
|
|
265
|
-
responsiveContainerWidth = containerWidth -
|
|
270
|
+
responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
|
|
266
271
|
}
|
|
267
272
|
}
|
|
268
273
|
} else if (isCommentEditor) {
|
|
@@ -272,7 +277,7 @@ export const ResizableTableContainer = /*#__PURE__*/React.memo(({
|
|
|
272
277
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
273
278
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
274
279
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
275
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth -
|
|
280
|
+
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
276
281
|
}
|
|
277
282
|
const width = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
278
283
|
if (!isResizing) {
|
|
@@ -11,9 +11,10 @@ import { logException } from '@atlaskit/editor-common/monitoring';
|
|
|
11
11
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
12
12
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
13
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
14
|
-
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
14
|
+
import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
15
15
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
16
16
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
17
18
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
18
19
|
import { updateWidthToWidest } from '../pm-plugins/commands/misc';
|
|
19
20
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
@@ -63,6 +64,9 @@ const getResizerMinWidth = node => {
|
|
|
63
64
|
// the table can't scale past its min-width, so instead restrict table container min width to avoid that situation
|
|
64
65
|
return minColumnWidth + 1;
|
|
65
66
|
};
|
|
67
|
+
const getPadding = containerWidth => {
|
|
68
|
+
return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
69
|
+
};
|
|
66
70
|
|
|
67
71
|
/**
|
|
68
72
|
* When guidelines are outside the viewport, filter them out, do not show
|
|
@@ -83,8 +87,9 @@ const getVisibleGuidelines = (guidelines, containerWidth, lineLength, isTableSca
|
|
|
83
87
|
// For PTW we need to ensure that dynamic guideline never gets excluded: 1181 should be > width + guidelineVisibleAdjustment
|
|
84
88
|
// guidelineVisibleAdjustment is set as a negative value, so we making it positive and adding + 1
|
|
85
89
|
const preserve_table_widths_adjustment = -1 * PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET + 1;
|
|
90
|
+
const padding = getPadding(containerWidth);
|
|
86
91
|
guidelineVisibleAdjustment = isFullWidthModeEnabled ? preserve_table_widths_adjustment // guidelineVisibleAdjustment = -2, if lineLength = 1180, 1181 < 1180 + 2 is true.
|
|
87
|
-
: -2 *
|
|
92
|
+
: -2 * padding + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
|
|
88
93
|
}
|
|
89
94
|
const width = isTableScalingEnabled && isFullWidthModeEnabled ? lineLength : containerWidth;
|
|
90
95
|
return guidelines.filter(guideline => {
|
|
@@ -198,14 +203,14 @@ export const TableResizer = ({
|
|
|
198
203
|
}) => {
|
|
199
204
|
if (gap !== currentGap.current) {
|
|
200
205
|
currentGap.current = gap;
|
|
201
|
-
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 *
|
|
206
|
+
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
202
207
|
displayGuideline(getGuidelinesWithHighlights(gap, TABLE_SNAP_GAP, keys, visibleGuidelines));
|
|
203
208
|
}
|
|
204
209
|
}, [isTableScalingEnabled, excludeGuidelineConfig, containerWidth, displayGuideline, lineLength, isFullWidthModeEnabled]);
|
|
205
210
|
const guidelineSnaps = useMemo(() => snappingEnabled ? {
|
|
206
211
|
x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET,
|
|
207
212
|
// was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
208
|
-
isFullWidthModeEnabled ? lineLength + 2 *
|
|
213
|
+
isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
|
|
209
214
|
} : undefined, [snappingEnabled, isTableScalingEnabled, excludeGuidelineConfig, containerWidth, lineLength, isFullWidthModeEnabled]);
|
|
210
215
|
const switchToCenterAlignment = useCallback((pos, node, newWidth, state, dispatch) => {
|
|
211
216
|
if (shouldChangeAlignmentToCenterResized(isTableAlignmentEnabled, node, lineLength, newWidth) && isResizing.current) {
|
|
@@ -261,7 +266,7 @@ export const TableResizer = ({
|
|
|
261
266
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
262
267
|
});
|
|
263
268
|
dispatch(tr);
|
|
264
|
-
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 *
|
|
269
|
+
const visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
265
270
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
266
271
|
if (onResizeStart) {
|
|
267
272
|
onResizeStart();
|
|
@@ -283,7 +288,7 @@ export const TableResizer = ({
|
|
|
283
288
|
if (typeof pos !== 'number') {
|
|
284
289
|
return;
|
|
285
290
|
}
|
|
286
|
-
const editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 *
|
|
291
|
+
const editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth;
|
|
287
292
|
const closestSnap = !isCommentEditor && findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE);
|
|
288
293
|
closestSnap && updateActiveGuidelines(closestSnap);
|
|
289
294
|
|
|
@@ -2,6 +2,7 @@ import kebabCase from 'lodash/kebabCase';
|
|
|
2
2
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
3
3
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
4
4
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
5
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
6
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
6
7
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
7
8
|
import { getAlignmentStyle } from './table-container-styles';
|
|
@@ -10,7 +11,13 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
10
11
|
return {
|
|
11
12
|
...tableNode,
|
|
12
13
|
toDOM: node => {
|
|
13
|
-
const gutterPadding =
|
|
14
|
+
const gutterPadding = () => {
|
|
15
|
+
if (expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
16
|
+
return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
|
|
17
|
+
} else {
|
|
18
|
+
return `${akEditorGutterPaddingDynamic() * 2}px`;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
14
21
|
const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`).join(';');
|
|
15
22
|
const tableMinWidth = getResizerMinWidth(node);
|
|
16
23
|
const attrs = {
|
|
@@ -62,14 +69,14 @@ export const tableNodeSpecWithFixedToDOM = config => {
|
|
|
62
69
|
style: alignmentStyle
|
|
63
70
|
}, ['div', {
|
|
64
71
|
class: 'pm-table-resizer-container',
|
|
65
|
-
style: `width: min(calc(100cqw - ${gutterPadding}
|
|
72
|
+
style: `width: min(calc(100cqw - ${gutterPadding()}), ${tableWidthAttribute});`
|
|
66
73
|
}, ['div', {
|
|
67
74
|
class: 'resizer-item display-handle',
|
|
68
75
|
style: convertToInlineCss({
|
|
69
76
|
position: 'relative',
|
|
70
77
|
userSelect: 'auto',
|
|
71
78
|
boxSizing: 'border-box',
|
|
72
|
-
'--ak-editor-table-gutter-padding': `${gutterPadding}
|
|
79
|
+
'--ak-editor-table-gutter-padding': `${gutterPadding()}`,
|
|
73
80
|
'--ak-editor-table-max-width': `${TABLE_MAX_WIDTH}px`,
|
|
74
81
|
'--ak-editor-table-min-width': `${tableMinWidth}px`,
|
|
75
82
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { getParentNodeWidth, getTableContainerWidth, layoutToWidth } from '@atlaskit/editor-common/node-width';
|
|
2
2
|
import { calcTableWidth } from '@atlaskit/editor-common/styles';
|
|
3
3
|
import { calcTableColumnWidths } from '@atlaskit/editor-common/utils';
|
|
4
|
-
import { akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorTableNumberColumnWidth } from '@atlaskit/editor-shared-styles';
|
|
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 { hasTableBeenResized, hasTableColumnBeenResized } from './colgroup';
|
|
6
7
|
import { MAX_SCALING_PERCENT, MAX_SCALING_PERCENT_TABLES_WITH_FIXED_COLUMN_WIDTHS_OPTION } from './consts';
|
|
7
8
|
|
|
@@ -11,7 +12,11 @@ export function getLayoutSize(tableLayout, containerWidth = 0, options) {
|
|
|
11
12
|
isFullWidthModeEnabled
|
|
12
13
|
} = options;
|
|
13
14
|
if (isFullWidthModeEnabled) {
|
|
14
|
-
|
|
15
|
+
let padding = akEditorGutterPaddingDynamic();
|
|
16
|
+
if (containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
17
|
+
padding = akEditorGutterPaddingReduced;
|
|
18
|
+
}
|
|
19
|
+
return containerWidth ? Math.min(containerWidth - padding * 2, akEditorFullWidthLayoutWidth) : akEditorFullWidthLayoutWidth;
|
|
15
20
|
}
|
|
16
21
|
const calculatedTableWidth = calcTableWidth(tableLayout, containerWidth, true);
|
|
17
22
|
if (calculatedTableWidth !== 'inherit') {
|