@atlaskit/editor-plugin-table 11.1.3 → 11.1.5
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/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/toolbar.js +1 -1
- 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/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/toolbar.js +1 -1
- package/package.json +3 -6
- 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/toolbar.tsx +1 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 11.1.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#185723](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/185723)
|
|
8
|
+
[`751aeb4580469`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/751aeb4580469) -
|
|
9
|
+
ED-28315 clean up fg platform_editor_controls_patch_13
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 11.1.4
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#185940](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/185940)
|
|
17
|
+
[`456bee393c4d3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/456bee393c4d3) -
|
|
18
|
+
[ux] When editor-area is less than 768px wide, we reduce editor gutters to 24px in Full-page
|
|
19
|
+
editor.
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 11.1.3
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -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
|
/**
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -545,7 +545,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(getE
|
|
|
545
545
|
}
|
|
546
546
|
});
|
|
547
547
|
}
|
|
548
|
-
}].concat((0, _toConsumableArray2.default)(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider
|
|
548
|
+
}].concat((0, _toConsumableArray2.default)(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider ? [{
|
|
549
549
|
type: 'separator'
|
|
550
550
|
}] : []), [_objectSpread({
|
|
551
551
|
title: intl.formatMessage(_messages.default.copyToClipboard),
|
|
@@ -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') {
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import { isVerticalPosition } from '@atlaskit/editor-common/guideline';
|
|
2
|
-
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
2
|
+
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
const numberOfLanesInDefaultLayoutWidth = 12;
|
|
4
5
|
const calculateSubSnappingWidths = (totalLanes, totalWidth) => new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map((v, i) => v * (i + 1) * 2);
|
|
5
6
|
export const calculateDefaultSnappings = (lengthOffset = 0) => [...calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset), akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, akEditorFullWidthLayoutWidth + lengthOffset];
|
|
7
|
+
const getPadding = editorContainerWith => {
|
|
8
|
+
return editorContainerWith <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
9
|
+
};
|
|
10
|
+
|
|
6
11
|
// FF TablePreserve for calculateDefaultSnappings
|
|
7
12
|
export const calculateDefaultTablePreserveSnappings = (lengthOffset = 0, editorContainerWith = akEditorFullWidthLayoutWidth, exclude = {
|
|
8
13
|
innerGuidelines: false,
|
|
9
14
|
breakoutPoints: false
|
|
10
15
|
}) => {
|
|
11
|
-
const
|
|
16
|
+
const padding = getPadding(editorContainerWith);
|
|
17
|
+
const dynamicFullWidthLine = editorContainerWith - padding * 2 >= akEditorFullWidthLayoutWidth ? akEditorFullWidthLayoutWidth : editorContainerWith - padding * 2;
|
|
12
18
|
const guides = [dynamicFullWidthLine - lengthOffset];
|
|
13
19
|
if (!exclude.breakoutPoints) {
|
|
14
20
|
guides.unshift(akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset);
|
|
@@ -25,7 +31,8 @@ export const defaultTablePreserveSnappingWidths = (lengthOffset, editorContainer
|
|
|
25
31
|
innerGuidelines: false,
|
|
26
32
|
breakoutPoints: false
|
|
27
33
|
}) => {
|
|
28
|
-
|
|
34
|
+
const padding = getPadding(editorContainerWidth);
|
|
35
|
+
return editorContainerWidth - padding * 2 > akEditorFullWidthLayoutWidth ? calculateDefaultSnappings() : calculateDefaultTablePreserveSnappings(lengthOffset, editorContainerWidth, exclude); // lengthOffset was hardcoded 0 here, created PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
29
36
|
};
|
|
30
37
|
|
|
31
38
|
/**
|
|
@@ -515,7 +515,7 @@ export const getToolbarConfig = (getEditorContainerWidth, api, editorAnalyticsAP
|
|
|
515
515
|
}
|
|
516
516
|
});
|
|
517
517
|
}
|
|
518
|
-
}, ...(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider
|
|
518
|
+
}, ...(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider ? [{
|
|
519
519
|
type: 'separator'
|
|
520
520
|
}] : []), {
|
|
521
521
|
title: intl.formatMessage(commonMessages.copyToClipboard),
|
|
@@ -5,8 +5,9 @@ import classNames from 'classnames';
|
|
|
5
5
|
import { CHANGE_ALIGNMENT_REASON, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
6
6
|
import { sharedPluginStateHookMigratorFactory, useSharedPluginState, useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
7
7
|
import { getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
8
|
-
import { akEditorDefaultLayoutWidth, akEditorGutterPaddingDynamic, akEditorMobileBreakoutPoint } from '@atlaskit/editor-shared-styles';
|
|
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';
|
|
@@ -149,6 +150,9 @@ var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
|
149
150
|
editorViewModeState: editorViewModeState
|
|
150
151
|
};
|
|
151
152
|
});
|
|
153
|
+
var getPadding = function getPadding(containerWidth) {
|
|
154
|
+
return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
155
|
+
};
|
|
152
156
|
export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
153
157
|
var children = _ref4.children,
|
|
154
158
|
className = _ref4.className,
|
|
@@ -233,6 +237,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
233
237
|
var tableWidth = getTableContainerWidth(node);
|
|
234
238
|
var responsiveContainerWidth = 0;
|
|
235
239
|
var resizeHandleSpacing = 12;
|
|
240
|
+
var padding = getPadding(containerWidth);
|
|
236
241
|
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
237
242
|
// updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
|
|
238
243
|
// issues when viwport width is less than full width Editor's width. To detect avoid them
|
|
@@ -242,7 +247,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
242
247
|
// When: Show scroll bars -> containerWidth = akEditorGutterPadding * 2 + lineLength;
|
|
243
248
|
// When: Always -> containerWidth = akEditorGutterPadding * 2 + lineLength + scrollbarWidth;
|
|
244
249
|
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
245
|
-
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth -
|
|
250
|
+
responsiveContainerWidth = isTableScalingEnabled ? lineLength : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
246
251
|
|
|
247
252
|
// platform_editor_table_fw_numcol_overflow_fix:
|
|
248
253
|
// lineLength is undefined on first paint → width: NaN → wrapper expands to page
|
|
@@ -256,7 +261,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
256
261
|
// 2) TODO: widen lineLength to `number|undefined` and remove this block.
|
|
257
262
|
if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
|
|
258
263
|
if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
|
|
259
|
-
responsiveContainerWidth = containerWidth -
|
|
264
|
+
responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
|
|
260
265
|
}
|
|
261
266
|
}
|
|
262
267
|
} else if (isCommentEditor) {
|
|
@@ -266,7 +271,7 @@ export var ResizableTableContainer = /*#__PURE__*/React.memo(function (_ref4) {
|
|
|
266
271
|
// containerWidth = width of a DIV with test id="ak-editor-fp-content-area". It is a parent of
|
|
267
272
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
268
273
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
269
|
-
responsiveContainerWidth = isTableScalingEnabled ? containerWidth -
|
|
274
|
+
responsiveContainerWidth = isTableScalingEnabled ? containerWidth - padding * 2 : containerWidth - padding * 2 - resizeHandleSpacing;
|
|
270
275
|
}
|
|
271
276
|
var width = !node.attrs.width && isCommentEditor ? responsiveContainerWidth : Math.min(tableWidth, responsiveContainerWidth);
|
|
272
277
|
if (!isResizing) {
|
|
@@ -15,9 +15,10 @@ import { logException } from '@atlaskit/editor-common/monitoring';
|
|
|
15
15
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
16
16
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
17
17
|
import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
18
|
-
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
18
|
+
import { akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
19
19
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
20
20
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
21
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
21
22
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
22
23
|
import { updateWidthToWidest } from '../pm-plugins/commands/misc';
|
|
23
24
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
@@ -67,6 +68,9 @@ var getResizerMinWidth = function getResizerMinWidth(node) {
|
|
|
67
68
|
// the table can't scale past its min-width, so instead restrict table container min width to avoid that situation
|
|
68
69
|
return minColumnWidth + 1;
|
|
69
70
|
};
|
|
71
|
+
var getPadding = function getPadding(containerWidth) {
|
|
72
|
+
return containerWidth <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
73
|
+
};
|
|
70
74
|
|
|
71
75
|
/**
|
|
72
76
|
* When guidelines are outside the viewport, filter them out, do not show
|
|
@@ -87,8 +91,9 @@ var getVisibleGuidelines = function getVisibleGuidelines(guidelines, containerWi
|
|
|
87
91
|
// For PTW we need to ensure that dynamic guideline never gets excluded: 1181 should be > width + guidelineVisibleAdjustment
|
|
88
92
|
// guidelineVisibleAdjustment is set as a negative value, so we making it positive and adding + 1
|
|
89
93
|
var preserve_table_widths_adjustment = -1 * PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET + 1;
|
|
94
|
+
var padding = getPadding(containerWidth);
|
|
90
95
|
guidelineVisibleAdjustment = isFullWidthModeEnabled ? preserve_table_widths_adjustment // guidelineVisibleAdjustment = -2, if lineLength = 1180, 1181 < 1180 + 2 is true.
|
|
91
|
-
: -2 *
|
|
96
|
+
: -2 * padding + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
|
|
92
97
|
}
|
|
93
98
|
var width = isTableScalingEnabled && isFullWidthModeEnabled ? lineLength : containerWidth;
|
|
94
99
|
return guidelines.filter(function (guideline) {
|
|
@@ -200,7 +205,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
200
205
|
keys = _ref2.keys;
|
|
201
206
|
if (gap !== currentGap.current) {
|
|
202
207
|
currentGap.current = gap;
|
|
203
|
-
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 *
|
|
208
|
+
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
204
209
|
displayGuideline(getGuidelinesWithHighlights(gap, TABLE_SNAP_GAP, keys, visibleGuidelines));
|
|
205
210
|
}
|
|
206
211
|
}, [isTableScalingEnabled, excludeGuidelineConfig, containerWidth, displayGuideline, lineLength, isFullWidthModeEnabled]);
|
|
@@ -208,7 +213,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
208
213
|
return snappingEnabled ? {
|
|
209
214
|
x: isTableScalingEnabled ? defaultTablePreserveSnappingWidths(PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET,
|
|
210
215
|
// was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
211
|
-
isFullWidthModeEnabled ? lineLength + 2 *
|
|
216
|
+
isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : defaultSnappingWidths
|
|
212
217
|
} : undefined;
|
|
213
218
|
}, [snappingEnabled, isTableScalingEnabled, excludeGuidelineConfig, containerWidth, lineLength, isFullWidthModeEnabled]);
|
|
214
219
|
var switchToCenterAlignment = useCallback(function (pos, node, newWidth, state, dispatch) {
|
|
@@ -257,7 +262,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
257
262
|
name: TABLE_OVERFLOW_CHANGE_TRIGGER.RESIZED
|
|
258
263
|
});
|
|
259
264
|
dispatch(tr);
|
|
260
|
-
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 *
|
|
265
|
+
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth, excludeGuidelineConfig) : defaultGuidelines, containerWidth, lineLength, Boolean(isTableScalingEnabled), Boolean(isFullWidthModeEnabled));
|
|
261
266
|
setSnappingEnabled(displayGuideline(visibleGuidelines));
|
|
262
267
|
if (onResizeStart) {
|
|
263
268
|
onResizeStart();
|
|
@@ -279,7 +284,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
279
284
|
if (typeof pos !== 'number') {
|
|
280
285
|
return;
|
|
281
286
|
}
|
|
282
|
-
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 *
|
|
287
|
+
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth;
|
|
283
288
|
var 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);
|
|
284
289
|
closestSnap && updateActiveGuidelines(closestSnap);
|
|
285
290
|
|
|
@@ -7,6 +7,7 @@ import kebabCase from 'lodash/kebabCase';
|
|
|
7
7
|
import { table, tableWithNestedTable } from '@atlaskit/adf-schema';
|
|
8
8
|
import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
9
9
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
10
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
11
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
11
12
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
12
13
|
import { getAlignmentStyle } from './table-container-styles';
|
|
@@ -14,7 +15,13 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
14
15
|
var tableNode = config.isNestingSupported ? tableWithNestedTable : table;
|
|
15
16
|
return _objectSpread(_objectSpread({}, tableNode), {}, {
|
|
16
17
|
toDOM: function toDOM(node) {
|
|
17
|
-
var gutterPadding =
|
|
18
|
+
var gutterPadding = function gutterPadding() {
|
|
19
|
+
if (expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
20
|
+
return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
|
|
21
|
+
} else {
|
|
22
|
+
return "".concat(akEditorGutterPaddingDynamic() * 2, "px");
|
|
23
|
+
}
|
|
24
|
+
};
|
|
18
25
|
var alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout)).map(function (_ref) {
|
|
19
26
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
20
27
|
k = _ref2[0],
|
|
@@ -71,14 +78,14 @@ export var tableNodeSpecWithFixedToDOM = function tableNodeSpecWithFixedToDOM(co
|
|
|
71
78
|
style: alignmentStyle
|
|
72
79
|
}, ['div', {
|
|
73
80
|
class: 'pm-table-resizer-container',
|
|
74
|
-
style: "width: min(calc(100cqw - ".concat(gutterPadding, "
|
|
81
|
+
style: "width: min(calc(100cqw - ".concat(gutterPadding(), "), ").concat(tableWidthAttribute, ");")
|
|
75
82
|
}, ['div', {
|
|
76
83
|
class: 'resizer-item display-handle',
|
|
77
84
|
style: convertToInlineCss({
|
|
78
85
|
position: 'relative',
|
|
79
86
|
userSelect: 'auto',
|
|
80
87
|
boxSizing: 'border-box',
|
|
81
|
-
'--ak-editor-table-gutter-padding': "".concat(gutterPadding
|
|
88
|
+
'--ak-editor-table-gutter-padding': "".concat(gutterPadding()),
|
|
82
89
|
'--ak-editor-table-max-width': "".concat(TABLE_MAX_WIDTH, "px"),
|
|
83
90
|
'--ak-editor-table-min-width': "".concat(tableMinWidth, "px"),
|
|
84
91
|
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) {
|
|
|
11
12
|
var options = arguments.length > 2 ? arguments[2] : undefined;
|
|
12
13
|
var isFullWidthModeEnabled = options.isFullWidthModeEnabled;
|
|
13
14
|
if (isFullWidthModeEnabled) {
|
|
14
|
-
|
|
15
|
+
var 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
|
var calculatedTableWidth = calcTableWidth(tableLayout, containerWidth, true);
|
|
17
22
|
if (calculatedTableWidth !== 'inherit') {
|
|
@@ -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 } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { akEditorCalculatedWideLayoutWidth, akEditorDefaultLayoutWidth, akEditorFullWidthLayoutWidth, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced, akEditorFullPageNarrowBreakout } from '@atlaskit/editor-shared-styles';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
var numberOfLanesInDefaultLayoutWidth = 12;
|
|
5
6
|
var calculateSubSnappingWidths = function calculateSubSnappingWidths(totalLanes, totalWidth) {
|
|
6
7
|
return new Array(Math.round(totalLanes / 2) - 1).fill(totalWidth / totalLanes).map(function (v, i) {
|
|
@@ -11,6 +12,10 @@ export var calculateDefaultSnappings = function calculateDefaultSnappings() {
|
|
|
11
12
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
12
13
|
return [].concat(_toConsumableArray(calculateSubSnappingWidths(numberOfLanesInDefaultLayoutWidth, akEditorDefaultLayoutWidth + lengthOffset)), [akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset, akEditorFullWidthLayoutWidth + lengthOffset]);
|
|
13
14
|
};
|
|
15
|
+
var getPadding = function getPadding(editorContainerWith) {
|
|
16
|
+
return editorContainerWith <= akEditorFullPageNarrowBreakout && expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true) ? akEditorGutterPaddingReduced : akEditorGutterPaddingDynamic();
|
|
17
|
+
};
|
|
18
|
+
|
|
14
19
|
// FF TablePreserve for calculateDefaultSnappings
|
|
15
20
|
export var calculateDefaultTablePreserveSnappings = function calculateDefaultTablePreserveSnappings() {
|
|
16
21
|
var lengthOffset = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
@@ -19,7 +24,8 @@ export var calculateDefaultTablePreserveSnappings = function calculateDefaultTab
|
|
|
19
24
|
innerGuidelines: false,
|
|
20
25
|
breakoutPoints: false
|
|
21
26
|
};
|
|
22
|
-
var
|
|
27
|
+
var padding = getPadding(editorContainerWith);
|
|
28
|
+
var dynamicFullWidthLine = editorContainerWith - padding * 2 >= akEditorFullWidthLayoutWidth ? akEditorFullWidthLayoutWidth : editorContainerWith - padding * 2;
|
|
23
29
|
var guides = [dynamicFullWidthLine - lengthOffset];
|
|
24
30
|
if (!exclude.breakoutPoints) {
|
|
25
31
|
guides.unshift(akEditorDefaultLayoutWidth + lengthOffset, akEditorCalculatedWideLayoutWidth + lengthOffset);
|
|
@@ -37,7 +43,8 @@ export var defaultTablePreserveSnappingWidths = function defaultTablePreserveSna
|
|
|
37
43
|
innerGuidelines: false,
|
|
38
44
|
breakoutPoints: false
|
|
39
45
|
};
|
|
40
|
-
|
|
46
|
+
var padding = getPadding(editorContainerWidth);
|
|
47
|
+
return editorContainerWidth - padding * 2 > akEditorFullWidthLayoutWidth ? calculateDefaultSnappings() : calculateDefaultTablePreserveSnappings(lengthOffset, editorContainerWidth, exclude); // lengthOffset was hardcoded 0 here, created PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
41
48
|
};
|
|
42
49
|
|
|
43
50
|
/**
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -538,7 +538,7 @@ export var getToolbarConfig = function getToolbarConfig(getEditorContainerWidth,
|
|
|
538
538
|
}
|
|
539
539
|
});
|
|
540
540
|
}
|
|
541
|
-
}].concat(_toConsumableArray(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider
|
|
541
|
+
}].concat(_toConsumableArray(extensionApi && extensionState !== null && extensionState !== void 0 && extensionState.extensionProvider ? [{
|
|
542
542
|
type: 'separator'
|
|
543
543
|
}] : []), [_objectSpread({
|
|
544
544
|
title: intl.formatMessage(commonMessages.copyToClipboard),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.5",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/editor-plugin-selection": "^3.0.0",
|
|
44
44
|
"@atlaskit/editor-plugin-width": "^4.0.0",
|
|
45
45
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
46
|
-
"@atlaskit/editor-shared-styles": "^3.
|
|
46
|
+
"@atlaskit/editor-shared-styles": "^3.5.0",
|
|
47
47
|
"@atlaskit/editor-tables": "^2.9.0",
|
|
48
48
|
"@atlaskit/icon": "^27.3.0",
|
|
49
49
|
"@atlaskit/menu": "^8.0.0",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@atlaskit/primitives": "^14.10.0",
|
|
55
55
|
"@atlaskit/react-ufo": "^4.0.0",
|
|
56
56
|
"@atlaskit/theme": "^19.0.0",
|
|
57
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
57
|
+
"@atlaskit/tmp-editor-statsig": "^9.8.0",
|
|
58
58
|
"@atlaskit/toggle": "^15.0.0",
|
|
59
59
|
"@atlaskit/tokens": "^5.5.0",
|
|
60
60
|
"@atlaskit/tooltip": "^20.3.0",
|
|
@@ -151,9 +151,6 @@
|
|
|
151
151
|
"platform_editor_nested_tables_sticky_header_bug": {
|
|
152
152
|
"type": "boolean"
|
|
153
153
|
},
|
|
154
|
-
"platform_editor_controls_patch_13": {
|
|
155
|
-
"type": "boolean"
|
|
156
|
-
},
|
|
157
154
|
"platform_editor_sort_decoration_fix_on_live_page": {
|
|
158
155
|
"type": "boolean"
|
|
159
156
|
},
|
|
@@ -22,9 +22,12 @@ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
|
22
22
|
import {
|
|
23
23
|
akEditorDefaultLayoutWidth,
|
|
24
24
|
akEditorGutterPaddingDynamic,
|
|
25
|
+
akEditorGutterPaddingReduced,
|
|
26
|
+
akEditorFullPageNarrowBreakout,
|
|
25
27
|
akEditorMobileBreakoutPoint,
|
|
26
28
|
} from '@atlaskit/editor-shared-styles';
|
|
27
29
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
30
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
28
31
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
29
32
|
|
|
30
33
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
@@ -252,6 +255,13 @@ const useSharedState = sharedPluginStateHookMigratorFactory(
|
|
|
252
255
|
},
|
|
253
256
|
);
|
|
254
257
|
|
|
258
|
+
const getPadding = (containerWidth: number) => {
|
|
259
|
+
return containerWidth <= akEditorFullPageNarrowBreakout &&
|
|
260
|
+
expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)
|
|
261
|
+
? akEditorGutterPaddingReduced
|
|
262
|
+
: akEditorGutterPaddingDynamic();
|
|
263
|
+
};
|
|
264
|
+
|
|
255
265
|
export const ResizableTableContainer = React.memo(
|
|
256
266
|
({
|
|
257
267
|
children,
|
|
@@ -355,6 +365,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
355
365
|
|
|
356
366
|
let responsiveContainerWidth = 0;
|
|
357
367
|
const resizeHandleSpacing = 12;
|
|
368
|
+
const padding = getPadding(containerWidth);
|
|
358
369
|
// When Full width editor enabled, a Mac OS user can change "ak-editor-content-area" width by
|
|
359
370
|
// updating Settings -> Appearance -> Show scroll bars from "When scrolling" to "Always". It causes
|
|
360
371
|
// issues when viwport width is less than full width Editor's width. To detect avoid them
|
|
@@ -366,7 +377,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
366
377
|
// scrollbarWidth can vary. Values can be 14, 15, 16 and up to 20px;
|
|
367
378
|
responsiveContainerWidth = isTableScalingEnabled
|
|
368
379
|
? lineLength
|
|
369
|
-
: containerWidth -
|
|
380
|
+
: containerWidth - padding * 2 - resizeHandleSpacing;
|
|
370
381
|
|
|
371
382
|
// platform_editor_table_fw_numcol_overflow_fix:
|
|
372
383
|
// lineLength is undefined on first paint → width: NaN → wrapper expands to page
|
|
@@ -380,8 +391,7 @@ export const ResizableTableContainer = React.memo(
|
|
|
380
391
|
// 2) TODO: widen lineLength to `number|undefined` and remove this block.
|
|
381
392
|
if (fg('platform_editor_table_fw_numcol_overflow_fix')) {
|
|
382
393
|
if (isTableScalingEnabled && !Number.isFinite(responsiveContainerWidth)) {
|
|
383
|
-
responsiveContainerWidth =
|
|
384
|
-
containerWidth - akEditorGutterPaddingDynamic() * 2 - resizeHandleSpacing;
|
|
394
|
+
responsiveContainerWidth = containerWidth - padding * 2 - resizeHandleSpacing;
|
|
385
395
|
}
|
|
386
396
|
}
|
|
387
397
|
} else if (isCommentEditor) {
|
|
@@ -392,8 +402,8 @@ export const ResizableTableContainer = React.memo(
|
|
|
392
402
|
// a DIV with className="ak-editor-content-area". This DIV has padding left and padding right.
|
|
393
403
|
// padding left = padding right = akEditorGutterPadding = 32
|
|
394
404
|
responsiveContainerWidth = isTableScalingEnabled
|
|
395
|
-
? containerWidth -
|
|
396
|
-
: containerWidth -
|
|
405
|
+
? containerWidth - padding * 2
|
|
406
|
+
: containerWidth - padding * 2 - resizeHandleSpacing;
|
|
397
407
|
}
|
|
398
408
|
const width =
|
|
399
409
|
!node.attrs.width && isCommentEditor
|
|
@@ -28,9 +28,14 @@ import { chainCommands } from '@atlaskit/editor-prosemirror/commands';
|
|
|
28
28
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
29
29
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
30
30
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
31
|
-
import {
|
|
31
|
+
import {
|
|
32
|
+
akEditorGutterPaddingDynamic,
|
|
33
|
+
akEditorGutterPaddingReduced,
|
|
34
|
+
akEditorFullPageNarrowBreakout,
|
|
35
|
+
} from '@atlaskit/editor-shared-styles';
|
|
32
36
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
33
37
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
38
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
34
39
|
import { token } from '@atlaskit/tokens';
|
|
35
40
|
|
|
36
41
|
import { setTableAlignmentWithTableContentWithPosWithAnalytics } from '../pm-plugins/commands/commands-with-analytics';
|
|
@@ -143,6 +148,13 @@ const getResizerMinWidth = (node: PMNode) => {
|
|
|
143
148
|
return minColumnWidth + 1;
|
|
144
149
|
};
|
|
145
150
|
|
|
151
|
+
const getPadding = (containerWidth: number) => {
|
|
152
|
+
return containerWidth <= akEditorFullPageNarrowBreakout &&
|
|
153
|
+
expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)
|
|
154
|
+
? akEditorGutterPaddingReduced
|
|
155
|
+
: akEditorGutterPaddingDynamic();
|
|
156
|
+
};
|
|
157
|
+
|
|
146
158
|
/**
|
|
147
159
|
* When guidelines are outside the viewport, filter them out, do not show
|
|
148
160
|
* So the guideline container won't make the fabric-editor-popup-scroll-parent overflow
|
|
@@ -168,10 +180,10 @@ const getVisibleGuidelines = (
|
|
|
168
180
|
// For PTW we need to ensure that dynamic guideline never gets excluded: 1181 should be > width + guidelineVisibleAdjustment
|
|
169
181
|
// guidelineVisibleAdjustment is set as a negative value, so we making it positive and adding + 1
|
|
170
182
|
const preserve_table_widths_adjustment = -1 * PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET + 1;
|
|
171
|
-
|
|
183
|
+
const padding = getPadding(containerWidth);
|
|
172
184
|
guidelineVisibleAdjustment = isFullWidthModeEnabled
|
|
173
185
|
? preserve_table_widths_adjustment // guidelineVisibleAdjustment = -2, if lineLength = 1180, 1181 < 1180 + 2 is true.
|
|
174
|
-
: -2 *
|
|
186
|
+
: -2 * padding + preserve_table_widths_adjustment; // guidelineVisibleAdjustment = -62, if containerWidth is 1244, 1181 < 1244 - 62 = 1182 is true.
|
|
175
187
|
}
|
|
176
188
|
const width = isTableScalingEnabled && isFullWidthModeEnabled ? lineLength : containerWidth;
|
|
177
189
|
|
|
@@ -296,12 +308,13 @@ export const TableResizer = ({
|
|
|
296
308
|
({ gap, keys }: { gap: number; keys: string[] }) => {
|
|
297
309
|
if (gap !== currentGap.current) {
|
|
298
310
|
currentGap.current = gap;
|
|
311
|
+
|
|
299
312
|
const visibleGuidelines = getVisibleGuidelines(
|
|
300
313
|
isTableScalingEnabled
|
|
301
314
|
? defaultGuidelinesForPreserveTable(
|
|
302
315
|
PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET,
|
|
303
316
|
isFullWidthModeEnabled
|
|
304
|
-
? lineLength + 2 *
|
|
317
|
+
? lineLength + 2 * getPadding(containerWidth)
|
|
305
318
|
: containerWidth,
|
|
306
319
|
excludeGuidelineConfig,
|
|
307
320
|
)
|
|
@@ -332,7 +345,7 @@ export const TableResizer = ({
|
|
|
332
345
|
? defaultTablePreserveSnappingWidths(
|
|
333
346
|
PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET, // was hardcoded to 0, using PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
334
347
|
isFullWidthModeEnabled
|
|
335
|
-
? lineLength + 2 *
|
|
348
|
+
? lineLength + 2 * getPadding(containerWidth)
|
|
336
349
|
: containerWidth,
|
|
337
350
|
excludeGuidelineConfig,
|
|
338
351
|
)
|
|
@@ -428,9 +441,7 @@ export const TableResizer = ({
|
|
|
428
441
|
isTableScalingEnabled
|
|
429
442
|
? defaultGuidelinesForPreserveTable(
|
|
430
443
|
PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET,
|
|
431
|
-
isFullWidthModeEnabled
|
|
432
|
-
? lineLength + 2 * akEditorGutterPaddingDynamic()
|
|
433
|
-
: containerWidth,
|
|
444
|
+
isFullWidthModeEnabled ? lineLength + 2 * getPadding(containerWidth) : containerWidth,
|
|
434
445
|
excludeGuidelineConfig,
|
|
435
446
|
)
|
|
436
447
|
: defaultGuidelines,
|
|
@@ -476,7 +487,7 @@ export const TableResizer = ({
|
|
|
476
487
|
}
|
|
477
488
|
|
|
478
489
|
const editorContainerWidth = isFullWidthModeEnabled
|
|
479
|
-
? lineLength + 2 *
|
|
490
|
+
? lineLength + 2 * getPadding(containerWidth)
|
|
480
491
|
: containerWidth;
|
|
481
492
|
|
|
482
493
|
const closestSnap =
|
package/src/nodeviews/toDOM.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { convertToInlineCss } from '@atlaskit/editor-common/lazy-node-view';
|
|
|
5
5
|
import type { GetEditorContainerWidth } from '@atlaskit/editor-common/types';
|
|
6
6
|
import type { DOMOutputSpec, NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
7
7
|
import { akEditorGutterPaddingDynamic } from '@atlaskit/editor-shared-styles';
|
|
8
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
9
|
|
|
9
10
|
import { generateColgroup, getResizerMinWidth } from '../pm-plugins/table-resizing/utils/colgroup';
|
|
10
11
|
import { TABLE_MAX_WIDTH } from '../pm-plugins/table-resizing/utils/consts';
|
|
@@ -25,7 +26,13 @@ export const tableNodeSpecWithFixedToDOM = (
|
|
|
25
26
|
return {
|
|
26
27
|
...tableNode,
|
|
27
28
|
toDOM: (node: PMNode): DOMOutputSpec => {
|
|
28
|
-
const gutterPadding =
|
|
29
|
+
const gutterPadding = () => {
|
|
30
|
+
if (expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)) {
|
|
31
|
+
return 'calc(var(--ak-editor--large-gutter-padding) * 2)';
|
|
32
|
+
} else {
|
|
33
|
+
return `${akEditorGutterPaddingDynamic() * 2}px`;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
29
36
|
|
|
30
37
|
const alignmentStyle = Object.entries(getAlignmentStyle(node.attrs.layout))
|
|
31
38
|
.map(([k, v]) => `${kebabCase(k)}: ${kebabCase(v)}`)
|
|
@@ -129,7 +136,7 @@ export const tableNodeSpecWithFixedToDOM = (
|
|
|
129
136
|
'div',
|
|
130
137
|
{
|
|
131
138
|
class: 'pm-table-resizer-container',
|
|
132
|
-
style: `width: min(calc(100cqw - ${gutterPadding}
|
|
139
|
+
style: `width: min(calc(100cqw - ${gutterPadding()}), ${tableWidthAttribute});`,
|
|
133
140
|
},
|
|
134
141
|
[
|
|
135
142
|
'div',
|
|
@@ -139,7 +146,7 @@ export const tableNodeSpecWithFixedToDOM = (
|
|
|
139
146
|
position: 'relative',
|
|
140
147
|
userSelect: 'auto',
|
|
141
148
|
boxSizing: 'border-box',
|
|
142
|
-
'--ak-editor-table-gutter-padding': `${gutterPadding}
|
|
149
|
+
'--ak-editor-table-gutter-padding': `${gutterPadding()}`,
|
|
143
150
|
'--ak-editor-table-max-width': `${TABLE_MAX_WIDTH}px`,
|
|
144
151
|
'--ak-editor-table-min-width': `${tableMinWidth}px`,
|
|
145
152
|
minWidth: 'var(--ak-editor-table-min-width)',
|
|
@@ -14,7 +14,10 @@ import {
|
|
|
14
14
|
akEditorFullWidthLayoutWidth,
|
|
15
15
|
akEditorGutterPaddingDynamic,
|
|
16
16
|
akEditorTableNumberColumnWidth,
|
|
17
|
+
akEditorGutterPaddingReduced,
|
|
18
|
+
akEditorFullPageNarrowBreakout,
|
|
17
19
|
} from '@atlaskit/editor-shared-styles';
|
|
20
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
18
21
|
|
|
19
22
|
import type { TableOptions } from '../../../nodeviews/types';
|
|
20
23
|
|
|
@@ -33,8 +36,16 @@ export function getLayoutSize(
|
|
|
33
36
|
const { isFullWidthModeEnabled } = options;
|
|
34
37
|
|
|
35
38
|
if (isFullWidthModeEnabled) {
|
|
39
|
+
let padding: number = akEditorGutterPaddingDynamic();
|
|
40
|
+
if (
|
|
41
|
+
containerWidth <= akEditorFullPageNarrowBreakout &&
|
|
42
|
+
expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)
|
|
43
|
+
) {
|
|
44
|
+
padding = akEditorGutterPaddingReduced;
|
|
45
|
+
}
|
|
46
|
+
|
|
36
47
|
return containerWidth
|
|
37
|
-
? Math.min(containerWidth -
|
|
48
|
+
? Math.min(containerWidth - padding * 2, akEditorFullWidthLayoutWidth)
|
|
38
49
|
: akEditorFullWidthLayoutWidth;
|
|
39
50
|
}
|
|
40
51
|
|
|
@@ -5,7 +5,10 @@ import {
|
|
|
5
5
|
akEditorDefaultLayoutWidth,
|
|
6
6
|
akEditorFullWidthLayoutWidth,
|
|
7
7
|
akEditorGutterPaddingDynamic,
|
|
8
|
+
akEditorGutterPaddingReduced,
|
|
9
|
+
akEditorFullPageNarrowBreakout,
|
|
8
10
|
} from '@atlaskit/editor-shared-styles';
|
|
11
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
9
12
|
|
|
10
13
|
const numberOfLanesInDefaultLayoutWidth = 12;
|
|
11
14
|
|
|
@@ -29,6 +32,13 @@ export type GuidelineExcludeConfig = {
|
|
|
29
32
|
breakoutPoints: boolean;
|
|
30
33
|
};
|
|
31
34
|
|
|
35
|
+
const getPadding = (editorContainerWith: number) => {
|
|
36
|
+
return editorContainerWith <= akEditorFullPageNarrowBreakout &&
|
|
37
|
+
expValEquals('platform_editor_preview_panel_responsiveness', 'isEnabled', true)
|
|
38
|
+
? akEditorGutterPaddingReduced
|
|
39
|
+
: akEditorGutterPaddingDynamic();
|
|
40
|
+
};
|
|
41
|
+
|
|
32
42
|
// FF TablePreserve for calculateDefaultSnappings
|
|
33
43
|
export const calculateDefaultTablePreserveSnappings = (
|
|
34
44
|
lengthOffset = 0,
|
|
@@ -38,10 +48,11 @@ export const calculateDefaultTablePreserveSnappings = (
|
|
|
38
48
|
breakoutPoints: false,
|
|
39
49
|
},
|
|
40
50
|
) => {
|
|
51
|
+
const padding = getPadding(editorContainerWith);
|
|
41
52
|
const dynamicFullWidthLine =
|
|
42
|
-
editorContainerWith -
|
|
53
|
+
editorContainerWith - padding * 2 >= akEditorFullWidthLayoutWidth
|
|
43
54
|
? akEditorFullWidthLayoutWidth
|
|
44
|
-
: editorContainerWith -
|
|
55
|
+
: editorContainerWith - padding * 2;
|
|
45
56
|
|
|
46
57
|
const guides = [dynamicFullWidthLine - lengthOffset];
|
|
47
58
|
|
|
@@ -77,7 +88,8 @@ export const defaultTablePreserveSnappingWidths = (
|
|
|
77
88
|
breakoutPoints: false,
|
|
78
89
|
},
|
|
79
90
|
) => {
|
|
80
|
-
|
|
91
|
+
const padding = getPadding(editorContainerWidth);
|
|
92
|
+
return editorContainerWidth - padding * 2 > akEditorFullWidthLayoutWidth
|
|
81
93
|
? calculateDefaultSnappings()
|
|
82
94
|
: calculateDefaultTablePreserveSnappings(lengthOffset, editorContainerWidth, exclude); // lengthOffset was hardcoded 0 here, created PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET instead.
|
|
83
95
|
};
|
package/src/ui/toolbar.tsx
CHANGED