@atlaskit/editor-plugin-table 7.25.20 → 7.25.22
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 +24 -0
- package/dist/cjs/nodeviews/TableComponent.js +2 -1
- package/dist/cjs/nodeviews/TableResizer.js +12 -11
- package/dist/cjs/ui/global-styles.js +2 -3
- package/dist/es2019/nodeviews/TableComponent.js +3 -2
- package/dist/es2019/nodeviews/TableResizer.js +12 -11
- package/dist/es2019/ui/global-styles.js +2 -3
- package/dist/esm/nodeviews/TableComponent.js +3 -2
- package/dist/esm/nodeviews/TableResizer.js +12 -11
- package/dist/esm/ui/global-styles.js +2 -3
- package/dist/types/ui/global-styles.d.ts +1 -1
- package/dist/types-ts4.5/ui/global-styles.d.ts +1 -1
- package/package.json +7 -10
- package/src/nodeviews/TableComponent.tsx +8 -2
- package/src/nodeviews/TableResizer.tsx +47 -39
- package/src/ui/global-styles.tsx +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.25.22
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#138699](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/138699)
|
|
8
|
+
[`aa5140e59db5a`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/aa5140e59db5a) -
|
|
9
|
+
Cleanup feature flag moving styles from editor-core to tables plugin.
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 7.25.21
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#137821](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137821)
|
|
17
|
+
[`4d2173e85f8a6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4d2173e85f8a6) -
|
|
18
|
+
[ux] Fix full-width detection in Comment editor
|
|
19
|
+
- [#137928](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137928)
|
|
20
|
+
[`8b30e4c176e08`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8b30e4c176e08) -
|
|
21
|
+
ED-24841: Fixed number column table shows a scroll in comment editor
|
|
22
|
+
- [#138118](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/138118)
|
|
23
|
+
[`5e4d9eb1aefe4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/5e4d9eb1aefe4) -
|
|
24
|
+
NOISSUE: Upgrades editor React peer dependencies to v18
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 7.25.20
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
|
@@ -551,7 +551,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
551
551
|
var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7;
|
|
552
552
|
var resizeState = (0, _utils4.getResizeState)({
|
|
553
553
|
minWidth: _utils4.COLUMN_MIN_WIDTH,
|
|
554
|
-
|
|
554
|
+
// When numbered column enabled, we need to subtract the width of the numbered column
|
|
555
|
+
maxSize: tableNode.attrs.isNumberColumnEnabled ? tableRenderWidth - _editorSharedStyles.akEditorTableNumberColumnWidth : tableRenderWidth,
|
|
555
556
|
table: tableNode,
|
|
556
557
|
tableRef: this.table,
|
|
557
558
|
start: start,
|
|
@@ -260,15 +260,9 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
260
260
|
if (typeof pos !== 'number') {
|
|
261
261
|
return;
|
|
262
262
|
}
|
|
263
|
-
(0, _utils2.previewScaleTable)(tableRef, {
|
|
264
|
-
node: node,
|
|
265
|
-
prevNode: node,
|
|
266
|
-
start: pos + 1,
|
|
267
|
-
parentWidth: newWidth
|
|
268
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
269
263
|
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * (0, _editorSharedStyles.akEditorGutterPaddingDynamic)() : containerWidth;
|
|
270
|
-
var closestSnap = (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, _consts.TABLE_HIGHLIGHT_GAP, _consts.TABLE_HIGHLIGHT_TOLERANCE);
|
|
271
|
-
updateActiveGuidelines(closestSnap);
|
|
264
|
+
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, _consts.TABLE_HIGHLIGHT_GAP, _consts.TABLE_HIGHLIGHT_TOLERANCE);
|
|
265
|
+
closestSnap && updateActiveGuidelines(closestSnap);
|
|
272
266
|
|
|
273
267
|
// When snapping to the full width guideline, resize the table to be 1800px
|
|
274
268
|
var state = editorView.state,
|
|
@@ -277,9 +271,16 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
277
271
|
var fullWidthGuideline = (0, _guidelines.defaultGuidelinesForPreserveTable)(_guidelines.PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig).filter(function (guideline) {
|
|
278
272
|
return guideline.isFullWidth;
|
|
279
273
|
})[0];
|
|
280
|
-
var isFullWidthGuidelineActive = closestSnap.keys.includes(fullWidthGuideline.key);
|
|
281
|
-
var tableMaxWidth = isCommentEditor ? containerWidth - _utils2.TABLE_OFFSET_IN_COMMENT_EDITOR : _utils2.TABLE_MAX_WIDTH;
|
|
282
|
-
var shouldUpdateWidthToWidest = isCommentEditor
|
|
274
|
+
var isFullWidthGuidelineActive = closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
275
|
+
var tableMaxWidth = isCommentEditor ? Math.floor(containerWidth - _utils2.TABLE_OFFSET_IN_COMMENT_EDITOR) : _utils2.TABLE_MAX_WIDTH;
|
|
276
|
+
var shouldUpdateWidthToWidest = isCommentEditor ? tableMaxWidth <= newWidth : !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
277
|
+
var previewParentWidth = isCommentEditor && shouldUpdateWidthToWidest ? tableMaxWidth : newWidth;
|
|
278
|
+
(0, _utils2.previewScaleTable)(tableRef, {
|
|
279
|
+
node: node,
|
|
280
|
+
prevNode: node,
|
|
281
|
+
start: pos + 1,
|
|
282
|
+
parentWidth: previewParentWidth
|
|
283
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
283
284
|
(0, _commands.chainCommands)(function (state, dispatch) {
|
|
284
285
|
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
285
286
|
}, (0, _misc.updateWidthToWidest)((0, _defineProperty2.default)({}, currentTableNodeLocalId, shouldUpdateWidthToWidest)))(state, dispatch);
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.GlobalStylesWrapper = void 0;
|
|
7
7
|
var _react = require("@emotion/react");
|
|
8
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
9
8
|
var _commonStyles = require("./common-styles");
|
|
10
9
|
/**
|
|
11
10
|
* @jsxRuntime classic
|
|
@@ -15,9 +14,9 @@ var _commonStyles = require("./common-styles");
|
|
|
15
14
|
|
|
16
15
|
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
|
|
17
16
|
var featureFlags = _ref.featureFlags;
|
|
18
|
-
return (0,
|
|
17
|
+
return (0, _react.jsx)(_react.Global, {
|
|
19
18
|
styles: (0, _commonStyles.tableStyles)({
|
|
20
19
|
featureFlags: featureFlags
|
|
21
20
|
})
|
|
22
|
-
})
|
|
21
|
+
});
|
|
23
22
|
};
|
|
@@ -9,7 +9,7 @@ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
|
9
9
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
10
10
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
11
11
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
12
|
-
import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
12
|
+
import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
13
13
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
@@ -532,7 +532,8 @@ class TableComponent extends React.Component {
|
|
|
532
532
|
var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7;
|
|
533
533
|
const resizeState = getResizeState({
|
|
534
534
|
minWidth: COLUMN_MIN_WIDTH,
|
|
535
|
-
|
|
535
|
+
// When numbered column enabled, we need to subtract the width of the numbered column
|
|
536
|
+
maxSize: tableNode.attrs.isNumberColumnEnabled ? tableRenderWidth - akEditorTableNumberColumnWidth : tableRenderWidth,
|
|
536
537
|
table: tableNode,
|
|
537
538
|
tableRef: this.table,
|
|
538
539
|
start,
|
|
@@ -253,15 +253,9 @@ export const TableResizer = ({
|
|
|
253
253
|
if (typeof pos !== 'number') {
|
|
254
254
|
return;
|
|
255
255
|
}
|
|
256
|
-
previewScaleTable(tableRef, {
|
|
257
|
-
node,
|
|
258
|
-
prevNode: node,
|
|
259
|
-
start: pos + 1,
|
|
260
|
-
parentWidth: newWidth
|
|
261
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
262
256
|
const editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth;
|
|
263
|
-
const closestSnap = 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);
|
|
264
|
-
updateActiveGuidelines(closestSnap);
|
|
257
|
+
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);
|
|
258
|
+
closestSnap && updateActiveGuidelines(closestSnap);
|
|
265
259
|
|
|
266
260
|
// When snapping to the full width guideline, resize the table to be 1800px
|
|
267
261
|
const {
|
|
@@ -270,9 +264,16 @@ export const TableResizer = ({
|
|
|
270
264
|
} = editorView;
|
|
271
265
|
const currentTableNodeLocalId = (_node$attrs$localId = node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) !== null && _node$attrs$localId !== void 0 ? _node$attrs$localId : '';
|
|
272
266
|
const fullWidthGuideline = defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig).filter(guideline => guideline.isFullWidth)[0];
|
|
273
|
-
const isFullWidthGuidelineActive = closestSnap.keys.includes(fullWidthGuideline.key);
|
|
274
|
-
const tableMaxWidth = isCommentEditor ? containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR : TABLE_MAX_WIDTH;
|
|
275
|
-
const shouldUpdateWidthToWidest = isCommentEditor
|
|
267
|
+
const isFullWidthGuidelineActive = closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
268
|
+
const tableMaxWidth = isCommentEditor ? Math.floor(containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR) : TABLE_MAX_WIDTH;
|
|
269
|
+
const shouldUpdateWidthToWidest = isCommentEditor ? tableMaxWidth <= newWidth : !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
270
|
+
const previewParentWidth = isCommentEditor && shouldUpdateWidthToWidest ? tableMaxWidth : newWidth;
|
|
271
|
+
previewScaleTable(tableRef, {
|
|
272
|
+
node,
|
|
273
|
+
prevNode: node,
|
|
274
|
+
start: pos + 1,
|
|
275
|
+
parentWidth: previewParentWidth
|
|
276
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
276
277
|
chainCommands((state, dispatch) => {
|
|
277
278
|
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
278
279
|
}, updateWidthToWidest({
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { Global, jsx } from '@emotion/react';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { tableStyles } from './common-styles';
|
|
9
8
|
export const GlobalStylesWrapper = ({
|
|
10
9
|
featureFlags
|
|
11
10
|
}) => {
|
|
12
|
-
return
|
|
11
|
+
return jsx(Global, {
|
|
13
12
|
styles: tableStyles({
|
|
14
13
|
featureFlags
|
|
15
14
|
})
|
|
16
|
-
})
|
|
15
|
+
});
|
|
17
16
|
};
|
|
@@ -23,7 +23,7 @@ import { tintDirtyTransaction } from '@atlaskit/editor-common/collab';
|
|
|
23
23
|
import { getParentNodeWidth, getTableContainerWidth } from '@atlaskit/editor-common/node-width';
|
|
24
24
|
import { tableMarginSides } from '@atlaskit/editor-common/styles';
|
|
25
25
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
26
|
-
import { akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
26
|
+
import { akEditorTableNumberColumnWidth, akEditorTableToolbarSize as tableToolbarSize } from '@atlaskit/editor-shared-styles';
|
|
27
27
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
28
28
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
29
29
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
@@ -544,7 +544,8 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
544
544
|
var _this$props$options4, _this$props$options5, _this$props$options6, _this$props$options7;
|
|
545
545
|
var resizeState = getResizeState({
|
|
546
546
|
minWidth: COLUMN_MIN_WIDTH,
|
|
547
|
-
|
|
547
|
+
// When numbered column enabled, we need to subtract the width of the numbered column
|
|
548
|
+
maxSize: tableNode.attrs.isNumberColumnEnabled ? tableRenderWidth - akEditorTableNumberColumnWidth : tableRenderWidth,
|
|
548
549
|
table: tableNode,
|
|
549
550
|
tableRef: this.table,
|
|
550
551
|
start: start,
|
|
@@ -250,15 +250,9 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
250
250
|
if (typeof pos !== 'number') {
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
|
-
previewScaleTable(tableRef, {
|
|
254
|
-
node: node,
|
|
255
|
-
prevNode: node,
|
|
256
|
-
start: pos + 1,
|
|
257
|
-
parentWidth: newWidth
|
|
258
|
-
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
259
253
|
var editorContainerWidth = isFullWidthModeEnabled ? lineLength + 2 * akEditorGutterPaddingDynamic() : containerWidth;
|
|
260
|
-
var closestSnap = 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);
|
|
261
|
-
updateActiveGuidelines(closestSnap);
|
|
254
|
+
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);
|
|
255
|
+
closestSnap && updateActiveGuidelines(closestSnap);
|
|
262
256
|
|
|
263
257
|
// When snapping to the full width guideline, resize the table to be 1800px
|
|
264
258
|
var state = editorView.state,
|
|
@@ -267,9 +261,16 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
267
261
|
var fullWidthGuideline = defaultGuidelinesForPreserveTable(PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET, editorContainerWidth, excludeGuidelineConfig).filter(function (guideline) {
|
|
268
262
|
return guideline.isFullWidth;
|
|
269
263
|
})[0];
|
|
270
|
-
var isFullWidthGuidelineActive = closestSnap.keys.includes(fullWidthGuideline.key);
|
|
271
|
-
var tableMaxWidth = isCommentEditor ? containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR : TABLE_MAX_WIDTH;
|
|
272
|
-
var shouldUpdateWidthToWidest = isCommentEditor
|
|
264
|
+
var isFullWidthGuidelineActive = closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
265
|
+
var tableMaxWidth = isCommentEditor ? Math.floor(containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR) : TABLE_MAX_WIDTH;
|
|
266
|
+
var shouldUpdateWidthToWidest = isCommentEditor ? tableMaxWidth <= newWidth : !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
267
|
+
var previewParentWidth = isCommentEditor && shouldUpdateWidthToWidest ? tableMaxWidth : newWidth;
|
|
268
|
+
previewScaleTable(tableRef, {
|
|
269
|
+
node: node,
|
|
270
|
+
prevNode: node,
|
|
271
|
+
start: pos + 1,
|
|
272
|
+
parentWidth: previewParentWidth
|
|
273
|
+
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled, isTableWithFixedColumnWidthsOptionEnabled, isCommentEditor);
|
|
273
274
|
chainCommands(function (state, dispatch) {
|
|
274
275
|
return switchToCenterAlignment(pos, node, newWidth, state, dispatch);
|
|
275
276
|
}, updateWidthToWidest(_defineProperty({}, currentTableNodeLocalId, shouldUpdateWidthToWidest)))(state, dispatch);
|
|
@@ -4,13 +4,12 @@
|
|
|
4
4
|
*/
|
|
5
5
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
6
|
import { Global, jsx } from '@emotion/react';
|
|
7
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
8
7
|
import { tableStyles } from './common-styles';
|
|
9
8
|
export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
|
|
10
9
|
var featureFlags = _ref.featureFlags;
|
|
11
|
-
return
|
|
10
|
+
return jsx(Global, {
|
|
12
11
|
styles: tableStyles({
|
|
13
12
|
featureFlags: featureFlags
|
|
14
13
|
})
|
|
15
|
-
})
|
|
14
|
+
});
|
|
16
15
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.25.
|
|
3
|
+
"version": "7.25.22",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"atlassian": {
|
|
25
25
|
"team": "Editor: Jenga",
|
|
26
26
|
"singleton": true,
|
|
27
|
-
"runReact18":
|
|
27
|
+
"runReact18": true
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/adf-schema": "^40.9.0",
|
|
31
31
|
"@atlaskit/button": "^20.1.0",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.7.0",
|
|
33
|
-
"@atlaskit/editor-common": "^88.
|
|
33
|
+
"@atlaskit/editor-common": "^88.13.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.6.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.8.0",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"@atlaskit/editor-prosemirror": "5.0.1",
|
|
44
44
|
"@atlaskit/editor-shared-styles": "^2.13.0",
|
|
45
45
|
"@atlaskit/editor-tables": "^2.8.0",
|
|
46
|
-
"@atlaskit/icon": "^22.
|
|
46
|
+
"@atlaskit/icon": "^22.16.0",
|
|
47
47
|
"@atlaskit/menu": "^2.12.0",
|
|
48
48
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
49
49
|
"@atlaskit/pragmatic-drag-and-drop": "^1.3.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
52
52
|
"@atlaskit/primitives": "^12.1.0",
|
|
53
53
|
"@atlaskit/theme": "^13.0.0",
|
|
54
|
-
"@atlaskit/toggle": "^13.
|
|
54
|
+
"@atlaskit/toggle": "^13.4.0",
|
|
55
55
|
"@atlaskit/tokens": "^1.59.0",
|
|
56
56
|
"@atlaskit/tooltip": "^18.7.0",
|
|
57
57
|
"@babel/runtime": "^7.0.0",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"raf-schd": "^4.0.3"
|
|
63
63
|
},
|
|
64
64
|
"peerDependencies": {
|
|
65
|
-
"react": "^16.8.0",
|
|
66
|
-
"react-dom": "^16.8.0",
|
|
65
|
+
"react": "^16.8.0 || ^17.0.0 || ~18.2.0",
|
|
66
|
+
"react-dom": "^16.8.0 || ^17.0.0 || ~18.2.0",
|
|
67
67
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
@@ -117,9 +117,6 @@
|
|
|
117
117
|
"platform_editor_dark_mode_cell_header_color_fix": {
|
|
118
118
|
"type": "boolean"
|
|
119
119
|
},
|
|
120
|
-
"platform_editor_move_table_styles_to_plugin": {
|
|
121
|
-
"type": "boolean"
|
|
122
|
-
},
|
|
123
120
|
"platform_editor_a11y_table_context_menu": {
|
|
124
121
|
"type": "boolean"
|
|
125
122
|
},
|
|
@@ -18,7 +18,10 @@ import type { EditorContainerWidth, GetEditorFeatureFlags } from '@atlaskit/edit
|
|
|
18
18
|
import { browser, isValidPosition } from '@atlaskit/editor-common/utils';
|
|
19
19
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
20
20
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
akEditorTableNumberColumnWidth,
|
|
23
|
+
akEditorTableToolbarSize as tableToolbarSize,
|
|
24
|
+
} from '@atlaskit/editor-shared-styles';
|
|
22
25
|
import { findTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
23
26
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
24
27
|
import { combine } from '@atlaskit/pragmatic-drag-and-drop/combine';
|
|
@@ -456,7 +459,10 @@ class TableComponent extends React.Component<ComponentProps, TableState> {
|
|
|
456
459
|
if (force || (!isResizing && shouldUpdateColgroup)) {
|
|
457
460
|
const resizeState = getResizeState({
|
|
458
461
|
minWidth: COLUMN_MIN_WIDTH,
|
|
459
|
-
|
|
462
|
+
// When numbered column enabled, we need to subtract the width of the numbered column
|
|
463
|
+
maxSize: tableNode.attrs.isNumberColumnEnabled
|
|
464
|
+
? tableRenderWidth - akEditorTableNumberColumnWidth
|
|
465
|
+
: tableRenderWidth,
|
|
460
466
|
table: tableNode,
|
|
461
467
|
tableRef: this.table,
|
|
462
468
|
start,
|
|
@@ -436,45 +436,33 @@ export const TableResizer = ({
|
|
|
436
436
|
return;
|
|
437
437
|
}
|
|
438
438
|
|
|
439
|
-
previewScaleTable(
|
|
440
|
-
tableRef,
|
|
441
|
-
{
|
|
442
|
-
node,
|
|
443
|
-
prevNode: node,
|
|
444
|
-
start: pos + 1,
|
|
445
|
-
parentWidth: newWidth,
|
|
446
|
-
},
|
|
447
|
-
editorView.domAtPos.bind(editorView),
|
|
448
|
-
isTableScalingEnabled,
|
|
449
|
-
isTableWithFixedColumnWidthsOptionEnabled,
|
|
450
|
-
isCommentEditor,
|
|
451
|
-
);
|
|
452
|
-
|
|
453
439
|
const editorContainerWidth = isFullWidthModeEnabled
|
|
454
440
|
? lineLength + 2 * akEditorGutterPaddingDynamic()
|
|
455
441
|
: containerWidth;
|
|
456
442
|
|
|
457
|
-
const closestSnap =
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
443
|
+
const closestSnap =
|
|
444
|
+
!isCommentEditor &&
|
|
445
|
+
findClosestSnap(
|
|
446
|
+
newWidth,
|
|
447
|
+
isTableScalingEnabled
|
|
448
|
+
? defaultTablePreserveSnappingWidths(
|
|
449
|
+
PRESERVE_TABLE_SNAPPING_LENGTH_OFFSET,
|
|
450
|
+
editorContainerWidth,
|
|
451
|
+
excludeGuidelineConfig,
|
|
452
|
+
)
|
|
453
|
+
: defaultSnappingWidths,
|
|
454
|
+
isTableScalingEnabled
|
|
455
|
+
? defaultGuidelinesForPreserveTable(
|
|
456
|
+
PRESERVE_TABLE_GUIDELINES_LENGTH_OFFSET,
|
|
457
|
+
editorContainerWidth,
|
|
458
|
+
excludeGuidelineConfig,
|
|
459
|
+
)
|
|
460
|
+
: defaultGuidelines,
|
|
461
|
+
TABLE_HIGHLIGHT_GAP,
|
|
462
|
+
TABLE_HIGHLIGHT_TOLERANCE,
|
|
463
|
+
);
|
|
476
464
|
|
|
477
|
-
updateActiveGuidelines(closestSnap);
|
|
465
|
+
closestSnap && updateActiveGuidelines(closestSnap);
|
|
478
466
|
|
|
479
467
|
// When snapping to the full width guideline, resize the table to be 1800px
|
|
480
468
|
const { state, dispatch } = editorView;
|
|
@@ -486,13 +474,33 @@ export const TableResizer = ({
|
|
|
486
474
|
excludeGuidelineConfig,
|
|
487
475
|
).filter((guideline) => guideline.isFullWidth)[0];
|
|
488
476
|
|
|
489
|
-
const isFullWidthGuidelineActive =
|
|
477
|
+
const isFullWidthGuidelineActive =
|
|
478
|
+
closestSnap && closestSnap.keys.includes(fullWidthGuideline.key);
|
|
479
|
+
|
|
490
480
|
const tableMaxWidth = isCommentEditor
|
|
491
|
-
? containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR
|
|
481
|
+
? Math.floor(containerWidth - TABLE_OFFSET_IN_COMMENT_EDITOR)
|
|
492
482
|
: TABLE_MAX_WIDTH;
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
483
|
+
|
|
484
|
+
const shouldUpdateWidthToWidest = isCommentEditor
|
|
485
|
+
? tableMaxWidth <= newWidth
|
|
486
|
+
: !!isTableScalingEnabled && isFullWidthGuidelineActive;
|
|
487
|
+
|
|
488
|
+
const previewParentWidth =
|
|
489
|
+
isCommentEditor && shouldUpdateWidthToWidest ? tableMaxWidth : newWidth;
|
|
490
|
+
|
|
491
|
+
previewScaleTable(
|
|
492
|
+
tableRef,
|
|
493
|
+
{
|
|
494
|
+
node,
|
|
495
|
+
prevNode: node,
|
|
496
|
+
start: pos + 1,
|
|
497
|
+
parentWidth: previewParentWidth,
|
|
498
|
+
},
|
|
499
|
+
editorView.domAtPos.bind(editorView),
|
|
500
|
+
isTableScalingEnabled,
|
|
501
|
+
isTableWithFixedColumnWidthsOptionEnabled,
|
|
502
|
+
isCommentEditor,
|
|
503
|
+
);
|
|
496
504
|
|
|
497
505
|
chainCommands(
|
|
498
506
|
(state, dispatch) => {
|
package/src/ui/global-styles.tsx
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
import { Global, jsx } from '@emotion/react';
|
|
7
7
|
|
|
8
8
|
import type { FeatureFlags } from '@atlaskit/editor-common/types';
|
|
9
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
10
9
|
|
|
11
10
|
import { tableStyles } from './common-styles';
|
|
12
11
|
|
|
@@ -15,7 +14,5 @@ export const GlobalStylesWrapper = ({
|
|
|
15
14
|
}: {
|
|
16
15
|
featureFlags: FeatureFlags | undefined;
|
|
17
16
|
}) => {
|
|
18
|
-
return
|
|
19
|
-
<Global styles={tableStyles({ featureFlags })} />
|
|
20
|
-
) : null;
|
|
17
|
+
return <Global styles={tableStyles({ featureFlags })} />;
|
|
21
18
|
};
|