@atlaskit/editor-plugin-table 7.6.3 → 7.6.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 +13 -0
- package/dist/cjs/commands/column-resize.js +62 -16
- package/dist/cjs/commands/go-to-next-cell.js +5 -2
- package/dist/cjs/commands/misc.js +3 -2
- package/dist/cjs/commands-with-analytics.js +8 -2
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/cjs/nodeviews/TableComponent.js +8 -6
- package/dist/cjs/nodeviews/TableContainer.js +32 -20
- package/dist/cjs/nodeviews/TableResizer.js +40 -28
- package/dist/cjs/plugin.js +60 -58
- package/dist/cjs/pm-plugins/keymap.js +26 -8
- package/dist/cjs/pm-plugins/main.js +15 -4
- package/dist/cjs/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/cjs/toolbar.js +5 -4
- package/dist/cjs/ui/DragHandle/index.js +2 -2
- package/dist/cjs/ui/DragPreview/index.js +2 -0
- package/dist/cjs/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/cjs/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/cjs/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/cjs/ui/FloatingDragMenu/DropdownMenu.js +21 -28
- package/dist/cjs/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/cjs/ui/LayoutButton/index.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/cjs/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/cjs/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/cjs/ui/common-styles.js +4 -0
- package/dist/cjs/ui/ui-styles.js +93 -37
- package/dist/cjs/utils/guidelines.js +1 -1
- package/dist/es2019/commands/column-resize.js +53 -4
- package/dist/es2019/commands/go-to-next-cell.js +5 -2
- package/dist/es2019/commands/misc.js +6 -2
- package/dist/es2019/commands-with-analytics.js +8 -2
- package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/es2019/nodeviews/TableComponent.js +9 -7
- package/dist/es2019/nodeviews/TableContainer.js +17 -3
- package/dist/es2019/nodeviews/TableResizer.js +27 -17
- package/dist/es2019/plugin.js +6 -3
- package/dist/es2019/pm-plugins/keymap.js +25 -9
- package/dist/es2019/pm-plugins/main.js +15 -4
- package/dist/es2019/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/es2019/toolbar.js +5 -4
- package/dist/es2019/ui/DragHandle/index.js +2 -2
- package/dist/es2019/ui/DragPreview/index.js +2 -0
- package/dist/es2019/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/es2019/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/es2019/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/es2019/ui/FloatingDragMenu/DropdownMenu.js +20 -27
- package/dist/es2019/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/es2019/ui/LayoutButton/index.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/es2019/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/es2019/ui/common-styles.js +4 -0
- package/dist/es2019/ui/ui-styles.js +66 -70
- package/dist/es2019/utils/guidelines.js +1 -1
- package/dist/esm/commands/column-resize.js +62 -16
- package/dist/esm/commands/go-to-next-cell.js +5 -2
- package/dist/esm/commands/misc.js +3 -2
- package/dist/esm/commands-with-analytics.js +8 -2
- package/dist/esm/nodeviews/ExternalDropTargets.js +2 -0
- package/dist/esm/nodeviews/TableComponent.js +9 -7
- package/dist/esm/nodeviews/TableContainer.js +32 -20
- package/dist/esm/nodeviews/TableResizer.js +41 -29
- package/dist/esm/plugin.js +60 -58
- package/dist/esm/pm-plugins/keymap.js +26 -8
- package/dist/esm/pm-plugins/main.js +15 -4
- package/dist/esm/pm-plugins/table-resizing/event-handlers.js +4 -2
- package/dist/esm/toolbar.js +5 -4
- package/dist/esm/ui/DragHandle/index.js +2 -2
- package/dist/esm/ui/DragPreview/index.js +2 -0
- package/dist/esm/ui/FloatingContextualButton/FixedButton.js +10 -6
- package/dist/esm/ui/FloatingContextualMenu/ContextualMenu.js +16 -16
- package/dist/esm/ui/FloatingDeleteButton/index.js +2 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +3 -3
- package/dist/esm/ui/FloatingDragMenu/DropdownMenu.js +21 -28
- package/dist/esm/ui/FloatingInsertButton/InsertButton.js +1 -0
- package/dist/esm/ui/LayoutButton/index.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -0
- package/dist/esm/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.js +3 -0
- package/dist/esm/ui/TableFloatingControls/CornerControls/ClassicCornerControls.js +1 -0
- package/dist/esm/ui/TableFloatingControls/NumberColumn/index.js +1 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/ClassicControls.js +4 -0
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +3 -1
- package/dist/esm/ui/common-styles.js +4 -0
- package/dist/esm/ui/ui-styles.js +93 -37
- package/dist/esm/utils/guidelines.js +1 -1
- package/dist/types/commands/column-resize.d.ts +23 -4
- package/dist/types/commands/go-to-next-cell.d.ts +2 -1
- package/dist/types/commands/misc.d.ts +2 -1
- package/dist/types/commands-with-analytics.d.ts +2 -1
- package/dist/types/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types/pm-plugins/keymap.d.ts +3 -1
- package/dist/types/types.d.ts +13 -3
- package/dist/types-ts4.5/commands/column-resize.d.ts +23 -4
- package/dist/types-ts4.5/commands/go-to-next-cell.d.ts +2 -1
- package/dist/types-ts4.5/commands/misc.d.ts +2 -1
- package/dist/types-ts4.5/commands-with-analytics.d.ts +2 -1
- package/dist/types-ts4.5/nodeviews/TableResizer.d.ts +3 -1
- package/dist/types-ts4.5/pm-plugins/keymap.d.ts +3 -1
- package/dist/types-ts4.5/types.d.ts +13 -3
- package/package.json +3 -6
- package/src/commands/column-resize.ts +105 -29
- package/src/commands/go-to-next-cell.ts +10 -2
- package/src/commands/misc.ts +6 -3
- package/src/commands-with-analytics.ts +11 -5
- package/src/nodeviews/ExternalDropTargets.tsx +2 -0
- package/src/nodeviews/TableComponent.tsx +14 -16
- package/src/nodeviews/TableContainer.tsx +18 -3
- package/src/nodeviews/TableResizer.tsx +35 -21
- package/src/plugin.tsx +4 -1
- package/src/pm-plugins/keymap.ts +44 -6
- package/src/pm-plugins/main.ts +18 -4
- package/src/pm-plugins/table-resizing/event-handlers.ts +6 -2
- package/src/toolbar.tsx +20 -19
- package/src/types.ts +14 -2
- package/src/ui/DragHandle/index.tsx +2 -2
- package/src/ui/DragPreview/index.tsx +2 -0
- package/src/ui/FloatingContextualButton/FixedButton.tsx +9 -6
- package/src/ui/FloatingContextualMenu/ContextualMenu.tsx +66 -112
- package/src/ui/FloatingDeleteButton/index.tsx +2 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +3 -12
- package/src/ui/FloatingDragMenu/DropdownMenu.tsx +19 -28
- package/src/ui/FloatingInsertButton/InsertButton.tsx +1 -0
- package/src/ui/LayoutButton/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +2 -0
- package/src/ui/TableFloatingColumnControls/ColumnDropTargets/ColumnDropTarget.tsx +3 -0
- package/src/ui/TableFloatingControls/CornerControls/ClassicCornerControls.tsx +1 -0
- package/src/ui/TableFloatingControls/NumberColumn/index.tsx +1 -0
- package/src/ui/TableFloatingControls/RowControls/ClassicControls.tsx +4 -0
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +5 -1
- package/src/ui/common-styles.ts +2 -0
- package/src/ui/ui-styles.ts +90 -79
- package/src/utils/guidelines.ts +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.6.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#85342](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/85342) [`9a6a1786bc65`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9a6a1786bc65) - [ux] Migrates table styles to space tokens
|
|
8
|
+
|
|
9
|
+
## 7.6.4
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#84595](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/84595) [`412b82018310`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/412b82018310) - ED-22555: Added isFullWidth to GuidelineConfig and use it as a signal
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
3
16
|
## 7.6.3
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.stopKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = exports.changeColumnWidthByStep = exports.activateNextResizeArea = void 0;
|
|
7
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
7
8
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
8
9
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
9
10
|
var _utils = require("@atlaskit/editor-tables/utils");
|
|
@@ -66,25 +67,35 @@ var updateResizeHandleAndStatePosition = function updateResizeHandleAndStatePosi
|
|
|
66
67
|
return false;
|
|
67
68
|
};
|
|
68
69
|
};
|
|
69
|
-
var initiateKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = function initiateKeyboardColumnResizing(
|
|
70
|
-
|
|
70
|
+
var initiateKeyboardColumnResizing = exports.initiateKeyboardColumnResizing = function initiateKeyboardColumnResizing(_ref) {
|
|
71
|
+
var ariaNotify = _ref.ariaNotify,
|
|
72
|
+
getIntl = _ref.getIntl;
|
|
73
|
+
return function (state, dispatch, view) {
|
|
74
|
+
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
var selection = state.selection;
|
|
78
|
+
var selectionRect = (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
|
|
79
|
+
var cell = (0, _utils.findCellClosestToPos)(selection.$from);
|
|
80
|
+
if (ariaNotify && getIntl) {
|
|
81
|
+
ariaNotify(getIntl().formatMessage(_messages.tableMessages.startedColumnResize));
|
|
82
|
+
}
|
|
83
|
+
if (selectionRect && cell && view) {
|
|
84
|
+
return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
85
|
+
}
|
|
71
86
|
return false;
|
|
72
|
-
}
|
|
73
|
-
var selection = state.selection;
|
|
74
|
-
var selectionRect = (0, _utils.isSelectionType)(selection, 'cell') ? (0, _utils.getSelectionRect)(selection) : (0, _utils.findCellRectClosestToPos)(selection.$from);
|
|
75
|
-
var cell = (0, _utils.findCellClosestToPos)(selection.$from);
|
|
76
|
-
if (selectionRect && cell && view) {
|
|
77
|
-
return updateResizeHandleAndStatePosition(selectionRect.top, selectionRect.right, cell.pos)(state, dispatch);
|
|
78
|
-
}
|
|
79
|
-
return false;
|
|
87
|
+
};
|
|
80
88
|
};
|
|
81
|
-
var activateNextResizeArea = exports.activateNextResizeArea = function activateNextResizeArea(
|
|
89
|
+
var activateNextResizeArea = exports.activateNextResizeArea = function activateNextResizeArea(_ref2) {
|
|
90
|
+
var direction = _ref2.direction,
|
|
91
|
+
ariaNotify = _ref2.ariaNotify,
|
|
92
|
+
getIntl = _ref2.getIntl;
|
|
82
93
|
return function (state, dispatch, view) {
|
|
83
94
|
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
84
95
|
return false;
|
|
85
96
|
}
|
|
86
|
-
var
|
|
87
|
-
resizeHandlePos =
|
|
97
|
+
var _ref3 = (0, _pluginFactory2.getPluginState)(state) || {},
|
|
98
|
+
resizeHandlePos = _ref3.resizeHandlePos;
|
|
88
99
|
// If No resizing has initiated, skip to regular handler
|
|
89
100
|
if (!resizeHandlePos) {
|
|
90
101
|
return false;
|
|
@@ -107,6 +118,18 @@ var activateNextResizeArea = exports.activateNextResizeArea = function activateN
|
|
|
107
118
|
}
|
|
108
119
|
var currentCellRect = tableMap.findCell($currentCell.pos - $currentCell.start(-1));
|
|
109
120
|
var $nextCell = (0, _utils.nextCell)($currentCell, 'horiz', direction);
|
|
121
|
+
if (ariaNotify && getIntl) {
|
|
122
|
+
var columnDirection = '';
|
|
123
|
+
if (direction === 1) {
|
|
124
|
+
columnDirection = getIntl().formatMessage(_messages.tableMessages.columnRightResize);
|
|
125
|
+
}
|
|
126
|
+
if (direction === -1) {
|
|
127
|
+
columnDirection = getIntl().formatMessage(_messages.tableMessages.columnLeftResize);
|
|
128
|
+
}
|
|
129
|
+
ariaNotify(getIntl().formatMessage(_messages.tableMessages.focusedOtherResize, {
|
|
130
|
+
direction: columnDirection
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
110
133
|
if ($nextCell) {
|
|
111
134
|
// we are somewhere in between the side columns of the table
|
|
112
135
|
var offset = $nextCell.pos - $nextCell.start(-1);
|
|
@@ -127,8 +150,12 @@ var activateNextResizeArea = exports.activateNextResizeArea = function activateN
|
|
|
127
150
|
return false;
|
|
128
151
|
};
|
|
129
152
|
};
|
|
130
|
-
var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeColumnWidthByStep(
|
|
131
|
-
var
|
|
153
|
+
var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeColumnWidthByStep(_ref4) {
|
|
154
|
+
var stepSize = _ref4.stepSize,
|
|
155
|
+
getEditorContainerWidth = _ref4.getEditorContainerWidth,
|
|
156
|
+
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
157
|
+
ariaNotify = _ref4.ariaNotify,
|
|
158
|
+
getIntl = _ref4.getIntl;
|
|
132
159
|
return function (state, dispatch, view) {
|
|
133
160
|
var customTr = state.tr;
|
|
134
161
|
var fakeDispatch = function fakeDispatch(tr) {
|
|
@@ -190,10 +217,26 @@ var changeColumnWidthByStep = exports.changeColumnWidthByStep = function changeC
|
|
|
190
217
|
if (dispatch) {
|
|
191
218
|
dispatch(customTr);
|
|
192
219
|
}
|
|
220
|
+
if (ariaNotify && getIntl) {
|
|
221
|
+
ariaNotify(getIntl().formatMessage(_messages.tableMessages.changedColumnWidth, {
|
|
222
|
+
width: Math.floor(newResizeState.cols[colIndex].width)
|
|
223
|
+
}));
|
|
224
|
+
if (newResizeState.cols.length === colIndex + 1) {
|
|
225
|
+
if (newResizeState.overflow === true) {
|
|
226
|
+
ariaNotify(getIntl().formatMessage(_messages.tableMessages.columnResizeLast));
|
|
227
|
+
}
|
|
228
|
+
if (newResizeState.overflow === false) {
|
|
229
|
+
ariaNotify(getIntl().formatMessage(_messages.tableMessages.columnResizeOverflow));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
193
233
|
return true;
|
|
194
234
|
};
|
|
195
235
|
};
|
|
196
|
-
var stopKeyboardColumnResizing = exports.stopKeyboardColumnResizing = function stopKeyboardColumnResizing(
|
|
236
|
+
var stopKeyboardColumnResizing = exports.stopKeyboardColumnResizing = function stopKeyboardColumnResizing(_ref5) {
|
|
237
|
+
var ariaNotify = _ref5.ariaNotify,
|
|
238
|
+
getIntl = _ref5.getIntl,
|
|
239
|
+
originalTr = _ref5.originalTr;
|
|
197
240
|
return function (state, dispatch) {
|
|
198
241
|
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-column-resizing_emcvz')) {
|
|
199
242
|
return false;
|
|
@@ -218,6 +261,9 @@ var stopKeyboardColumnResizing = exports.stopKeyboardColumnResizing = function s
|
|
|
218
261
|
}, function () {
|
|
219
262
|
return customTr.setMeta('scrollIntoView', false);
|
|
220
263
|
})(state, fakeDispatch);
|
|
264
|
+
if (ariaNotify && getIntl) {
|
|
265
|
+
ariaNotify(getIntl().formatMessage(_messages.tableMessages.columnResizeStop));
|
|
266
|
+
}
|
|
221
267
|
if (dispatch) {
|
|
222
268
|
dispatch(customTr);
|
|
223
269
|
return true;
|
|
@@ -16,7 +16,7 @@ var _columnResize = require("./column-resize");
|
|
|
16
16
|
|
|
17
17
|
var TAB_FORWARD_DIRECTION = 1;
|
|
18
18
|
var TAB_BACKWARD_DIRECTION = -1;
|
|
19
|
-
var goToNextCell = exports.goToNextCell = function goToNextCell(editorAnalyticsAPI) {
|
|
19
|
+
var goToNextCell = exports.goToNextCell = function goToNextCell(editorAnalyticsAPI, ariaNotify, getIntl) {
|
|
20
20
|
return function (direction) {
|
|
21
21
|
return function (state, dispatch, view) {
|
|
22
22
|
var table = (0, _utils2.findTable)(state.selection);
|
|
@@ -27,7 +27,10 @@ var goToNextCell = exports.goToNextCell = function goToNextCell(editorAnalyticsA
|
|
|
27
27
|
var _getPluginState;
|
|
28
28
|
var isColumnResizing = (_getPluginState = (0, _pluginFactory.getPluginState)(state)) === null || _getPluginState === void 0 ? void 0 : _getPluginState.isKeyboardResize;
|
|
29
29
|
if (isColumnResizing) {
|
|
30
|
-
(0, _columnResize.stopKeyboardColumnResizing)(
|
|
30
|
+
(0, _columnResize.stopKeyboardColumnResizing)({
|
|
31
|
+
ariaNotify: ariaNotify,
|
|
32
|
+
getIntl: getIntl
|
|
33
|
+
})(state, dispatch, view);
|
|
31
34
|
return true;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.updateWidthToWidest = exports.updateResizeHandleDecorations = exports.triggerUnlessTableHeader = exports.transformSliceToRemoveColumnsWidths = exports.transformSliceToAddTableHeaders = exports.transformSliceRemoveCellBackgroundColor = exports.showInsertRowButton = exports.showInsertColumnButton = exports.setTableRef = exports.setMultipleCellAttrs = exports.setEditorFocus = exports.setCellAttr = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = exports.removeResizeHandleDecorations = exports.moveCursorBackward = exports.isInsideFirstCellOfRowOrColumn = exports.hideInsertColumnOrRowButton = exports.getTableSelectionType = exports.getTableElementMoveTypeBySlice = exports.deleteTableIfSelected = exports.deleteTable = exports.countCellsInSlice = exports.convertFirstRowToHeader = exports.autoSizeTable = exports.addResizeHandleDecorations = exports.addBoldInEmptyHeaderCells = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
10
11
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
11
12
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
12
13
|
var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
|
|
@@ -566,13 +567,13 @@ var updateWidthToWidest = exports.updateWidthToWidest = function updateWidthToWi
|
|
|
566
567
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
567
568
|
var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
|
|
568
569
|
prevWidthToWidest = _getPluginState4.widthToWidest;
|
|
569
|
-
if (
|
|
570
|
+
if ((0, _isEqual.default)(widthToWidest, prevWidthToWidest)) {
|
|
570
571
|
return false;
|
|
571
572
|
}
|
|
572
573
|
return {
|
|
573
574
|
type: 'UPDATE_TABLE_WIDTH_TO_WIDEST',
|
|
574
575
|
data: {
|
|
575
|
-
widthToWidest: widthToWidest
|
|
576
|
+
widthToWidest: _objectSpread(_objectSpread({}, prevWidthToWidest), widthToWidest)
|
|
576
577
|
}
|
|
577
578
|
};
|
|
578
579
|
});
|
|
@@ -191,7 +191,7 @@ var insertRowWithAnalytics = exports.insertRowWithAnalytics = function insertRow
|
|
|
191
191
|
};
|
|
192
192
|
};
|
|
193
193
|
var changeColumnWidthByStepWithAnalytics = exports.changeColumnWidthByStepWithAnalytics = function changeColumnWidthByStepWithAnalytics(editorAnalyticsAPI) {
|
|
194
|
-
return function (stepSize, getEditorContainerWidth, isTableScalingEnabled, inputMethod) {
|
|
194
|
+
return function (stepSize, getEditorContainerWidth, isTableScalingEnabled, inputMethod, ariaNotify, getIntl) {
|
|
195
195
|
return (0, _analytics2.withEditorAnalyticsAPI)(function (state) {
|
|
196
196
|
var _getSelectedTableInfo2 = (0, _utils2.getSelectedTableInfo)(state.selection),
|
|
197
197
|
table = _getSelectedTableInfo2.table,
|
|
@@ -213,7 +213,13 @@ var changeColumnWidthByStepWithAnalytics = exports.changeColumnWidthByStepWithAn
|
|
|
213
213
|
totalColumnCount: totalColumnCount
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
|
-
})(editorAnalyticsAPI)((0, _columnResize.changeColumnWidthByStep)(
|
|
216
|
+
})(editorAnalyticsAPI)((0, _columnResize.changeColumnWidthByStep)({
|
|
217
|
+
stepSize: stepSize,
|
|
218
|
+
getEditorContainerWidth: getEditorContainerWidth,
|
|
219
|
+
isTableScalingEnabled: isTableScalingEnabled,
|
|
220
|
+
ariaNotify: ariaNotify,
|
|
221
|
+
getIntl: getIntl
|
|
222
|
+
}));
|
|
217
223
|
};
|
|
218
224
|
};
|
|
219
225
|
var insertColumnWithAnalytics = exports.insertColumnWithAnalytics = function insertColumnWithAnalytics(editorAnalyticsAPI) {
|
|
@@ -52,6 +52,7 @@ var ExternalDropTargets = exports.ExternalDropTargets = function ExternalDropTar
|
|
|
52
52
|
width: getTableWrapperWidth(),
|
|
53
53
|
overflow: 'hidden',
|
|
54
54
|
position: 'absolute',
|
|
55
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
55
56
|
top: "-".concat(_consts.dropTargetExtendedWidth - _styles.tableMarginTop, "px"),
|
|
56
57
|
pointerEvents: 'auto',
|
|
57
58
|
zIndex: "".concat(_consts.dropTargetsZIndex)
|
|
@@ -61,6 +62,7 @@ var ExternalDropTargets = exports.ExternalDropTargets = function ExternalDropTar
|
|
|
61
62
|
style: {
|
|
62
63
|
display: 'flex',
|
|
63
64
|
// move drop targets based on table wrapper scroll
|
|
65
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
64
66
|
marginLeft: "-".concat(getScrollOffset(), "px")
|
|
65
67
|
}
|
|
66
68
|
}, colWidths === null || colWidths === void 0 ? void 0 : colWidths.map(function (width, index) {
|
|
@@ -35,7 +35,6 @@ var _colgroup = require("../pm-plugins/table-resizing/utils/colgroup");
|
|
|
35
35
|
var _consts = require("../pm-plugins/table-resizing/utils/consts");
|
|
36
36
|
var _dom = require("../pm-plugins/table-resizing/utils/dom");
|
|
37
37
|
var _types = require("../types");
|
|
38
|
-
var _consts2 = require("../ui/consts");
|
|
39
38
|
var _TableFloatingColumnControls = _interopRequireDefault(require("../ui/TableFloatingColumnControls"));
|
|
40
39
|
var _TableFloatingControls = _interopRequireDefault(require("../ui/TableFloatingControls"));
|
|
41
40
|
var _utils5 = require("../utils");
|
|
@@ -748,7 +747,7 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
748
747
|
style: {
|
|
749
748
|
visibility: showBeforeShadow && hasHeaderRow ? 'visible' : 'hidden',
|
|
750
749
|
top: "".concat(topStickyShadowPosition, "px"),
|
|
751
|
-
paddingBottom: "".concat(isDragAndDropEnabled
|
|
750
|
+
paddingBottom: "".concat(isDragAndDropEnabled && "var(--ds-space-025, 2px)")
|
|
752
751
|
}
|
|
753
752
|
}), /*#__PURE__*/_react.default.createElement("div", {
|
|
754
753
|
className: (0, _classnames2.default)(_types.TableCssClassName.TABLE_NODE_WRAPPER),
|
|
@@ -767,10 +766,11 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
767
766
|
}, allowControls && colControls), stickyScrollbar && /*#__PURE__*/_react.default.createElement("div", {
|
|
768
767
|
className: _types.TableCssClassName.TABLE_STICKY_SCROLLBAR_CONTAINER,
|
|
769
768
|
style: {
|
|
770
|
-
height:
|
|
769
|
+
height: "var(--ds-space-250, 20px)",
|
|
770
|
+
// MAX_BROWSER_SCROLLBAR_HEIGHT
|
|
771
771
|
display: 'none',
|
|
772
772
|
// prevent unwanted scroll during table resize without removing scrollbar container from the dom
|
|
773
|
-
width: isResizing ?
|
|
773
|
+
width: isResizing ? "var(--ds-space-0, 0px)" : '100%'
|
|
774
774
|
}
|
|
775
775
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
776
776
|
style: {
|
|
@@ -784,14 +784,16 @@ var TableComponent = /*#__PURE__*/function (_React$Component) {
|
|
|
784
784
|
}), this.state.stickyHeader && /*#__PURE__*/_react.default.createElement("div", {
|
|
785
785
|
style: {
|
|
786
786
|
position: 'absolute',
|
|
787
|
-
right: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? "".concat((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.increase-shadow-visibility_lh89r') ?
|
|
787
|
+
right: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.custom-table-width') ? "".concat((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.increase-shadow-visibility_lh89r') ? "var(--ds-space-400, 32px)" // tableOverflowShadowWidthWide
|
|
788
|
+
: "var(--ds-space-100, 8px)" // tableOverflowShadowWidth
|
|
789
|
+
) : "var(--ds-space-negative-025, -2px)"
|
|
788
790
|
}
|
|
789
791
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
790
792
|
className: "".concat(_types.TableCssClassName.TABLE_RIGHT_SHADOW, " ").concat(_types.TableCssClassName.TABLE_STICKY_SHADOW),
|
|
791
793
|
style: {
|
|
792
794
|
visibility: showAfterShadow && hasHeaderRow ? 'visible' : 'hidden',
|
|
793
795
|
top: "".concat(topStickyShadowPosition, "px"),
|
|
794
|
-
paddingBottom: "".concat(isDragAndDropEnabled
|
|
796
|
+
paddingBottom: "".concat(isDragAndDropEnabled && "var(--ds-space-025, 2px)")
|
|
795
797
|
}
|
|
796
798
|
})), /*#__PURE__*/_react.default.createElement("div", {
|
|
797
799
|
className: _types.TableCssClassName.TABLE_STICKY_SENTINEL_BOTTOM,
|
|
@@ -10,6 +10,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _react = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
14
|
var _nodeWidth = require("@atlaskit/editor-common/node-width");
|
|
14
15
|
var _styles = require("@atlaskit/editor-common/styles");
|
|
15
16
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
@@ -42,10 +43,11 @@ var InnerContainer = exports.InnerContainer = /*#__PURE__*/(0, _react.forwardRef
|
|
|
42
43
|
className: className,
|
|
43
44
|
"data-number-column": node.attrs.isNumberColumnEnabled,
|
|
44
45
|
"data-layout": node.attrs.layout,
|
|
45
|
-
"data-
|
|
46
|
+
"data-testid": "table-container"
|
|
46
47
|
}, children);
|
|
47
48
|
});
|
|
48
49
|
var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_react.default.memo(function (_ref2) {
|
|
50
|
+
var _node$attrs$localId, _node$attrs;
|
|
49
51
|
var children = _ref2.children,
|
|
50
52
|
className = _ref2.className,
|
|
51
53
|
node = _ref2.node,
|
|
@@ -117,9 +119,18 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
117
119
|
return (_pluginInjectionApi$c = pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$c2 = pluginInjectionApi.core) === null || _pluginInjectionApi$c2 === void 0 ? void 0 : _pluginInjectionApi$c2.actions.execute(pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$s = pluginInjectionApi.selection) === null || _pluginInjectionApi$s === void 0 ? void 0 : _pluginInjectionApi$s.commands.displayGapCursor(toggle))) !== null && _pluginInjectionApi$c !== void 0 ? _pluginInjectionApi$c : false;
|
|
118
120
|
}, [pluginInjectionApi]);
|
|
119
121
|
var tableWidth = (0, _nodeWidth.getTableContainerWidth)(node);
|
|
122
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
|
|
123
|
+
tableState = _useSharedPluginState.tableState;
|
|
124
|
+
var _ref3 = tableState,
|
|
125
|
+
widthToWidest = _ref3.widthToWidest;
|
|
126
|
+
var currentTableNodeLocalId = (_node$attrs$localId = node === null || node === 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 : '';
|
|
127
|
+
|
|
120
128
|
// 76 is currently an accepted padding value considering the spacing for resizer handle
|
|
121
129
|
var responsiveContainerWidth = isTableScalingEnabled ? containerWidth - _editorSharedStyles.akEditorGutterPadding * 2 - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide / 2 : containerWidth - _editorSharedStyles.akEditorGutterPadding * 2 - _editorSharedStyles.akEditorMediaResizeHandlerPaddingWide;
|
|
122
130
|
var width = Math.min(tableWidth, responsiveContainerWidth);
|
|
131
|
+
if (isTableScalingEnabled && currentTableNodeLocalId && widthToWidest && widthToWidest[currentTableNodeLocalId]) {
|
|
132
|
+
width = _utils.TABLE_MAX_WIDTH;
|
|
133
|
+
}
|
|
123
134
|
if (!isResizing) {
|
|
124
135
|
tableWidthRef.current = width;
|
|
125
136
|
}
|
|
@@ -137,7 +148,8 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
137
148
|
attachAnalyticsEvent: attachAnalyticsEvent,
|
|
138
149
|
displayGapCursor: displayGapCursor,
|
|
139
150
|
isTableScalingEnabled: isTableScalingEnabled,
|
|
140
|
-
isWholeTableInDanger: isWholeTableInDanger
|
|
151
|
+
isWholeTableInDanger: isWholeTableInDanger,
|
|
152
|
+
pluginInjectionApi: pluginInjectionApi
|
|
141
153
|
};
|
|
142
154
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.resizing-table-height-improvement')) {
|
|
143
155
|
tableResizerProps = _objectSpread(_objectSpread({}, tableResizerProps), {}, {
|
|
@@ -162,24 +174,24 @@ var ResizableTableContainer = exports.ResizableTableContainer = /*#__PURE__*/_re
|
|
|
162
174
|
node: node
|
|
163
175
|
}, children))));
|
|
164
176
|
});
|
|
165
|
-
var TableContainer = exports.TableContainer = function TableContainer(
|
|
166
|
-
var children =
|
|
167
|
-
node =
|
|
168
|
-
className =
|
|
169
|
-
|
|
170
|
-
lineLength =
|
|
171
|
-
editorWidth =
|
|
172
|
-
isTableResizingEnabled =
|
|
173
|
-
isBreakoutEnabled =
|
|
174
|
-
editorView =
|
|
175
|
-
getPos =
|
|
176
|
-
tableRef =
|
|
177
|
-
isNested =
|
|
178
|
-
tableWrapperHeight =
|
|
179
|
-
isResizing =
|
|
180
|
-
pluginInjectionApi =
|
|
181
|
-
isTableScalingEnabled =
|
|
182
|
-
isWholeTableInDanger =
|
|
177
|
+
var TableContainer = exports.TableContainer = function TableContainer(_ref4) {
|
|
178
|
+
var children = _ref4.children,
|
|
179
|
+
node = _ref4.node,
|
|
180
|
+
className = _ref4.className,
|
|
181
|
+
_ref4$containerWidth = _ref4.containerWidth,
|
|
182
|
+
lineLength = _ref4$containerWidth.lineLength,
|
|
183
|
+
editorWidth = _ref4$containerWidth.width,
|
|
184
|
+
isTableResizingEnabled = _ref4.isTableResizingEnabled,
|
|
185
|
+
isBreakoutEnabled = _ref4.isBreakoutEnabled,
|
|
186
|
+
editorView = _ref4.editorView,
|
|
187
|
+
getPos = _ref4.getPos,
|
|
188
|
+
tableRef = _ref4.tableRef,
|
|
189
|
+
isNested = _ref4.isNested,
|
|
190
|
+
tableWrapperHeight = _ref4.tableWrapperHeight,
|
|
191
|
+
isResizing = _ref4.isResizing,
|
|
192
|
+
pluginInjectionApi = _ref4.pluginInjectionApi,
|
|
193
|
+
isTableScalingEnabled = _ref4.isTableScalingEnabled,
|
|
194
|
+
isWholeTableInDanger = _ref4.isWholeTableInDanger;
|
|
183
195
|
if (isTableResizingEnabled && !isNested) {
|
|
184
196
|
return /*#__PURE__*/_react.default.createElement(ResizableTableContainer, {
|
|
185
197
|
className: className,
|
|
@@ -14,15 +14,14 @@ var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
|
14
14
|
var _reactIntlNext = require("react-intl-next");
|
|
15
15
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
16
16
|
var _guideline = require("@atlaskit/editor-common/guideline");
|
|
17
|
+
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
17
18
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
18
19
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
19
20
|
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
20
21
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
|
-
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
22
22
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
23
23
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
24
|
var _misc = require("../commands/misc");
|
|
25
|
-
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
26
25
|
var _tableAnalytics = require("../pm-plugins/table-analytics");
|
|
27
26
|
var _utils3 = require("../pm-plugins/table-resizing/utils");
|
|
28
27
|
var _tableWidth = require("../pm-plugins/table-width");
|
|
@@ -41,7 +40,7 @@ var handles = {
|
|
|
41
40
|
};
|
|
42
41
|
var handleStyles = {
|
|
43
42
|
right: {
|
|
44
|
-
// eslint-disable-next-line
|
|
43
|
+
// eslint-disable-next-line @atlaskit/design-system/ensure-design-token-usage/preview
|
|
45
44
|
right: '-14px',
|
|
46
45
|
marginTop: "var(--ds-space-150, 12px)"
|
|
47
46
|
}
|
|
@@ -101,28 +100,37 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
101
100
|
attachAnalyticsEvent = _ref.attachAnalyticsEvent,
|
|
102
101
|
displayGapCursor = _ref.displayGapCursor,
|
|
103
102
|
isTableScalingEnabled = _ref.isTableScalingEnabled,
|
|
104
|
-
isWholeTableInDanger = _ref.isWholeTableInDanger
|
|
103
|
+
isWholeTableInDanger = _ref.isWholeTableInDanger,
|
|
104
|
+
pluginInjectionApi = _ref.pluginInjectionApi;
|
|
105
105
|
var currentGap = (0, _react.useRef)(0);
|
|
106
106
|
// track resizing state - use ref over state to avoid re-render
|
|
107
107
|
var isResizing = (0, _react.useRef)(false);
|
|
108
108
|
var areResizeMetaKeysPressed = (0, _react.useRef)(false);
|
|
109
|
+
var _useState = (0, _react.useState)(width),
|
|
110
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
111
|
+
localTableWidth = _useState2[0],
|
|
112
|
+
setLocalTableWidth = _useState2[1];
|
|
109
113
|
var resizerRef = (0, _react.useRef)(null);
|
|
114
|
+
var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['table']),
|
|
115
|
+
tableState = _useSharedPluginState.tableState;
|
|
116
|
+
var _ref2 = tableState,
|
|
117
|
+
widthToWidest = _ref2.widthToWidest;
|
|
110
118
|
|
|
111
119
|
// used to reposition tooltip when table is resizing via keyboard
|
|
112
120
|
var updateTooltip = _react.default.useRef();
|
|
113
|
-
var
|
|
114
|
-
|
|
115
|
-
snappingEnabled =
|
|
116
|
-
setSnappingEnabled =
|
|
121
|
+
var _useState3 = (0, _react.useState)(false),
|
|
122
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
123
|
+
snappingEnabled = _useState4[0],
|
|
124
|
+
setSnappingEnabled = _useState4[1];
|
|
117
125
|
|
|
118
126
|
// we don't want to update aria-live region on each width change, it might provide bad experience for screen reader users
|
|
119
|
-
var
|
|
127
|
+
var _useState5 = (0, _react.useState)({
|
|
120
128
|
type: 'none',
|
|
121
129
|
width: width
|
|
122
130
|
}),
|
|
123
|
-
|
|
124
|
-
screenReaderResizeInformation =
|
|
125
|
-
setScreenReaderResizeInformation =
|
|
131
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
132
|
+
screenReaderResizeInformation = _useState6[0],
|
|
133
|
+
setScreenReaderResizeInformation = _useState6[1];
|
|
126
134
|
var _useIntl = (0, _reactIntlNext.useIntl)(),
|
|
127
135
|
formatMessage = _useIntl.formatMessage;
|
|
128
136
|
var screenReaderResizeAnnouncerMessages = {
|
|
@@ -141,9 +149,9 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
141
149
|
startMeasure = _useMeasureFramerate.startMeasure,
|
|
142
150
|
endMeasure = _useMeasureFramerate.endMeasure,
|
|
143
151
|
countFrames = _useMeasureFramerate.countFrames;
|
|
144
|
-
var updateActiveGuidelines = (0, _react.useCallback)(function (
|
|
145
|
-
var gap =
|
|
146
|
-
keys =
|
|
152
|
+
var updateActiveGuidelines = (0, _react.useCallback)(function (_ref3) {
|
|
153
|
+
var gap = _ref3.gap,
|
|
154
|
+
keys = _ref3.keys;
|
|
147
155
|
if (gap !== currentGap.current) {
|
|
148
156
|
currentGap.current = gap;
|
|
149
157
|
var visibleGuidelines = getVisibleGuidelines(isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth) : _guidelines.defaultGuidelines, containerWidth);
|
|
@@ -191,7 +199,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
191
199
|
}
|
|
192
200
|
}, [startMeasure, editorView, displayGapCursor, isTableScalingEnabled, containerWidth, displayGuideline, onResizeStart]);
|
|
193
201
|
var handleResize = (0, _react.useCallback)(function (originalState, delta) {
|
|
194
|
-
var
|
|
202
|
+
var _node$attrs$localId, _node$attrs, _widestGuideline$posi;
|
|
195
203
|
countFrames();
|
|
196
204
|
var newWidth = originalState.width + delta.width;
|
|
197
205
|
var pos;
|
|
@@ -216,25 +224,29 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
216
224
|
// set the width of the table to 1800 pixels.
|
|
217
225
|
var state = editorView.state,
|
|
218
226
|
dispatch = editorView.dispatch;
|
|
219
|
-
var
|
|
220
|
-
var
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
227
|
+
var currentTableNodeLocalId = (_node$attrs$localId = node === null || node === 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 : '';
|
|
228
|
+
var widestGuideline = (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth).filter(function (guideline) {
|
|
229
|
+
return guideline.isFullWidth;
|
|
230
|
+
})[0];
|
|
231
|
+
var widestGuideLineWidth = widestGuideline ? (((_widestGuideline$posi = widestGuideline.position) === null || _widestGuideline$posi === void 0 ? void 0 : _widestGuideline$posi.x) || 0) * 2 : null;
|
|
232
|
+
var shouldUpdateWidthToWidest = !!(isTableScalingEnabled && widestGuideLineWidth && Math.abs(widestGuideLineWidth - newWidth) <= 1);
|
|
233
|
+
shouldUpdateWidthToWidest ? setLocalTableWidth(_utils3.TABLE_MAX_WIDTH) : setLocalTableWidth(newWidth);
|
|
234
|
+
(0, _misc.updateWidthToWidest)((0, _defineProperty2.default)({}, currentTableNodeLocalId, shouldUpdateWidthToWidest))(state, dispatch);
|
|
235
|
+
updateWidth(shouldUpdateWidthToWidest ? _utils3.TABLE_MAX_WIDTH : newWidth);
|
|
224
236
|
return newWidth;
|
|
225
237
|
}, [countFrames, isTableScalingEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
|
|
226
238
|
var scheduleResize = (0, _react.useMemo)(function () {
|
|
227
239
|
return (0, _rafSchd.default)(handleResize);
|
|
228
240
|
}, [handleResize]);
|
|
229
241
|
var handleResizeStop = (0, _react.useCallback)(function (originalState, delta) {
|
|
242
|
+
var _node$attrs$localId2, _node$attrs2;
|
|
230
243
|
isResizing.current = false;
|
|
231
244
|
var newWidth = originalState.width + delta.width;
|
|
232
245
|
var state = editorView.state,
|
|
233
246
|
dispatch = editorView.dispatch;
|
|
234
247
|
var pos = getPos();
|
|
235
|
-
var
|
|
236
|
-
|
|
237
|
-
newWidth = widthToWidest ? _editorSharedStyles.akEditorFullWidthLayoutWidth : newWidth;
|
|
248
|
+
var currentTableNodeLocalId = (_node$attrs$localId2 = node === null || node === void 0 || (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) !== null && _node$attrs$localId2 !== void 0 ? _node$attrs$localId2 : '';
|
|
249
|
+
newWidth = widthToWidest && currentTableNodeLocalId && widthToWidest[currentTableNodeLocalId] ? _utils3.TABLE_MAX_WIDTH : newWidth;
|
|
238
250
|
var tr = state.tr.setMeta(_tableWidth.pluginKey, {
|
|
239
251
|
resizing: false
|
|
240
252
|
});
|
|
@@ -279,7 +291,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
279
291
|
onResizeStop();
|
|
280
292
|
}
|
|
281
293
|
return newWidth;
|
|
282
|
-
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled]);
|
|
294
|
+
}, [displayGapCursor, updateWidth, editorView, getPos, node, tableRef, scheduleResize, displayGuideline, attachAnalyticsEvent, endMeasure, onResizeStop, isTableScalingEnabled, widthToWidest]);
|
|
283
295
|
var handleTableSizeChangeOnKeypress = (0, _react.useCallback)(function (step) {
|
|
284
296
|
var newWidth = width + step;
|
|
285
297
|
if (newWidth > maxWidth || newWidth < resizerMinWidth) {
|
|
@@ -384,7 +396,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
384
396
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_resizer.ResizerNext, {
|
|
385
397
|
ref: resizerRef,
|
|
386
398
|
enable: handles,
|
|
387
|
-
width:
|
|
399
|
+
width: localTableWidth,
|
|
388
400
|
handleAlignmentMethod: "sticky",
|
|
389
401
|
handleSize: handleSize,
|
|
390
402
|
handleStyles: handleStyles,
|
|
@@ -401,8 +413,8 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
401
413
|
needExtendedResizeZone: !isTableSelected,
|
|
402
414
|
appearance: isTableSelected && isWholeTableInDanger ? 'danger' : undefined,
|
|
403
415
|
handleHighlight: "shadow",
|
|
404
|
-
handleTooltipContent: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-resizing_uapcv') ? function (
|
|
405
|
-
var update =
|
|
416
|
+
handleTooltipContent: (0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-table-resizing_uapcv') ? function (_ref4) {
|
|
417
|
+
var update = _ref4.update;
|
|
406
418
|
updateTooltip.current = update;
|
|
407
419
|
return /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
408
420
|
description: formatMessage(_messages.tableMessages.resizeTable),
|