@atlaskit/editor-plugin-table 7.5.11 → 7.5.13
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 +14 -0
- package/commands/package.json +1 -1
- package/dist/cjs/commands/index.js +6 -0
- package/dist/cjs/commands/misc.js +16 -1
- package/dist/cjs/nodeviews/TableResizer.js +17 -1
- package/dist/cjs/reducer.js +1 -0
- package/dist/cjs/ui/FloatingDragMenu/DragMenu.js +11 -3
- package/dist/cjs/utils/drag-menu.js +14 -7
- package/dist/es2019/commands/index.js +1 -1
- package/dist/es2019/commands/misc.js +15 -1
- package/dist/es2019/nodeviews/TableResizer.js +21 -2
- package/dist/es2019/reducer.js +1 -0
- package/dist/es2019/ui/FloatingDragMenu/DragMenu.js +11 -3
- package/dist/es2019/utils/drag-menu.js +15 -8
- package/dist/esm/commands/index.js +1 -1
- package/dist/esm/commands/misc.js +15 -0
- package/dist/esm/nodeviews/TableResizer.js +17 -1
- package/dist/esm/reducer.js +1 -0
- package/dist/esm/ui/FloatingDragMenu/DragMenu.js +11 -3
- package/dist/esm/utils/drag-menu.js +15 -8
- package/dist/types/commands/index.d.ts +1 -1
- package/dist/types/commands/misc.d.ts +1 -0
- package/dist/types/pm-plugins/analytics/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/drag-and-drop/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
- package/dist/types/pm-plugins/table-resizing/plugin-factory.d.ts +1 -1
- package/dist/types/types.d.ts +6 -0
- package/dist/types/ui/DragHandle/index.d.ts +2 -2
- package/dist/types/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -2
- package/dist/types/ui/FloatingDeleteButton/DeleteButton.d.ts +2 -2
- package/dist/types/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types/ui/FloatingInsertButton/InsertButton.d.ts +4 -4
- package/dist/types/ui/FloatingInsertButton/index.d.ts +2 -2
- package/dist/types/ui/LayoutButton/index.d.ts +2 -2
- package/dist/types/ui/TableFloatingControls/CornerControls/ClassicCornerControls.d.ts +2 -2
- package/dist/types/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +2 -2
- package/dist/types/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +2 -2
- package/dist/types/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -2
- package/dist/types-ts4.5/commands/index.d.ts +1 -1
- package/dist/types-ts4.5/commands/misc.d.ts +1 -0
- package/dist/types-ts4.5/pm-plugins/analytics/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/sticky-headers/plugin-state.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/table-resizing/plugin-factory.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +6 -0
- package/dist/types-ts4.5/ui/DragHandle/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingContextualMenu/ContextualMenu.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDeleteButton/DeleteButton.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingDragMenu/DragMenu.d.ts +2 -2
- package/dist/types-ts4.5/ui/FloatingInsertButton/InsertButton.d.ts +4 -4
- package/dist/types-ts4.5/ui/FloatingInsertButton/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/LayoutButton/index.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/ClassicCornerControls.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/CornerControls/DragCornerControls.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/ClassicControls.d.ts +2 -2
- package/dist/types-ts4.5/ui/TableFloatingControls/RowControls/DragControls.d.ts +2 -2
- package/package.json +10 -7
- package/plugin-key/package.json +1 -1
- package/src/commands/index.ts +1 -0
- package/src/commands/misc.ts +16 -0
- package/src/nodeviews/TableResizer.tsx +29 -2
- package/src/reducer.ts +1 -0
- package/src/types.ts +7 -0
- package/src/ui/FloatingDragMenu/DragMenu.tsx +15 -5
- package/src/utils/drag-menu.ts +25 -8
- package/types/package.json +1 -1
- package/ui/common-styles/package.json +1 -1
- package/ui/consts/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.5.13
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#83116](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83116) [`8d4e99057fe0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8d4e99057fe0) - Upgrade Typescript from `4.9.5` to `5.4.2`
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
10
|
+
## 7.5.12
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#82347](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/82347) [`1290405f274b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/1290405f274b) - [ux] Updates move util used by move shortcuts and drag menu to cater for new merged cells logic.
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 7.5.11
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/commands/package.json
CHANGED
|
@@ -249,6 +249,12 @@ Object.defineProperty(exports, "triggerUnlessTableHeader", {
|
|
|
249
249
|
return _misc.triggerUnlessTableHeader;
|
|
250
250
|
}
|
|
251
251
|
});
|
|
252
|
+
Object.defineProperty(exports, "updateWidthToWidest", {
|
|
253
|
+
enumerable: true,
|
|
254
|
+
get: function get() {
|
|
255
|
+
return _misc.updateWidthToWidest;
|
|
256
|
+
}
|
|
257
|
+
});
|
|
252
258
|
var _hover = require("./hover");
|
|
253
259
|
var _insert = require("./insert");
|
|
254
260
|
var _toggle = require("./toggle");
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
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;
|
|
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
10
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
@@ -561,4 +561,19 @@ var addBoldInEmptyHeaderCells = exports.addBoldInEmptyHeaderCells = function add
|
|
|
561
561
|
}
|
|
562
562
|
return false;
|
|
563
563
|
};
|
|
564
|
+
};
|
|
565
|
+
var updateWidthToWidest = exports.updateWidthToWidest = function updateWidthToWidest(widthToWidest) {
|
|
566
|
+
return (0, _pluginFactory.createCommand)(function (state) {
|
|
567
|
+
var _getPluginState4 = (0, _pluginFactory.getPluginState)(state),
|
|
568
|
+
prevWidthToWidest = _getPluginState4.widthToWidest;
|
|
569
|
+
if (prevWidthToWidest === widthToWidest) {
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
572
|
+
return {
|
|
573
|
+
type: 'UPDATE_TABLE_WIDTH_TO_WIDEST',
|
|
574
|
+
data: {
|
|
575
|
+
widthToWidest: widthToWidest
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
});
|
|
564
579
|
};
|
|
@@ -18,8 +18,10 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
|
18
18
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
19
19
|
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
20
20
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
21
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
21
22
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
22
23
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
24
|
+
var _misc = require("../commands/misc");
|
|
23
25
|
var _pluginFactory = require("../pm-plugins/plugin-factory");
|
|
24
26
|
var _tableAnalytics = require("../pm-plugins/table-analytics");
|
|
25
27
|
var _utils3 = require("../pm-plugins/table-resizing/utils");
|
|
@@ -190,6 +192,7 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
190
192
|
}
|
|
191
193
|
}, [startMeasure, editorView, displayGapCursor, isTableScalingEnabled, containerWidth, displayGuideline, onResizeStart]);
|
|
192
194
|
var handleResize = (0, _react.useCallback)(function (originalState, delta) {
|
|
195
|
+
var _defaultGuidelinesFor;
|
|
193
196
|
countFrames();
|
|
194
197
|
var newWidth = originalState.width + delta.width;
|
|
195
198
|
var pos;
|
|
@@ -208,7 +211,17 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
208
211
|
parentWidth: newWidth
|
|
209
212
|
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled);
|
|
210
213
|
updateActiveGuidelines((0, _snapping.findClosestSnap)(newWidth, isTableScalingEnabled ? (0, _snapping.defaultTablePreserveSnappingWidths)(containerWidth) : _snapping.defaultSnappingWidths, isTableScalingEnabled ? (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth) : _guidelines.defaultGuidelines, _consts.TABLE_HIGHLIGHT_GAP, _consts.TABLE_HIGHLIGHT_TOLERANCE));
|
|
211
|
-
|
|
214
|
+
|
|
215
|
+
// when isTableScalingEnabled true
|
|
216
|
+
// and a table is resized to fit the widest guideline when view port width is between 1011 and 1800
|
|
217
|
+
// set the width of the table to 1800 pixels.
|
|
218
|
+
var state = editorView.state,
|
|
219
|
+
dispatch = editorView.dispatch;
|
|
220
|
+
var widestGuideLineWidthString = (_defaultGuidelinesFor = (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth)[16].key) === null || _defaultGuidelinesFor === void 0 || (_defaultGuidelinesFor = _defaultGuidelinesFor.match(/[\d]*[.]{0,1}[\d]+/g)) === null || _defaultGuidelinesFor === void 0 ? void 0 : _defaultGuidelinesFor.join('');
|
|
221
|
+
var widestGuideLineWidth = parseInt(widestGuideLineWidthString || '', 10);
|
|
222
|
+
var shouldUpdateWidthToWidest = !!(isTableScalingEnabled && (0, _guidelines.defaultGuidelinesForPreserveTable)(containerWidth).length === 17 && widestGuideLineWidth - newWidth <= 1);
|
|
223
|
+
(0, _misc.updateWidthToWidest)(shouldUpdateWidthToWidest)(state, dispatch);
|
|
224
|
+
updateWidth(shouldUpdateWidthToWidest ? _editorSharedStyles.akEditorFullWidthLayoutWidth : newWidth);
|
|
212
225
|
return newWidth;
|
|
213
226
|
}, [countFrames, isTableScalingEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
|
|
214
227
|
var scheduleResize = (0, _react.useMemo)(function () {
|
|
@@ -220,6 +233,9 @@ var TableResizer = exports.TableResizer = function TableResizer(_ref) {
|
|
|
220
233
|
var state = editorView.state,
|
|
221
234
|
dispatch = editorView.dispatch;
|
|
222
235
|
var pos = getPos();
|
|
236
|
+
var _getPluginState2 = (0, _pluginFactory.getPluginState)(editorView.state),
|
|
237
|
+
widthToWidest = _getPluginState2.widthToWidest;
|
|
238
|
+
newWidth = widthToWidest ? _editorSharedStyles.akEditorFullWidthLayoutWidth : newWidth;
|
|
223
239
|
var tr = state.tr.setMeta(_tableWidth.pluginKey, {
|
|
224
240
|
resizing: false
|
|
225
241
|
});
|
package/dist/cjs/reducer.js
CHANGED
|
@@ -203,9 +203,17 @@ var DragMenu = exports.DragMenu = /*#__PURE__*/_react.default.memo(function (_re
|
|
|
203
203
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
204
204
|
isKeyboardModeActive = _getPluginState.isKeyboardModeActive;
|
|
205
205
|
var selectionRect = (0, _utils2.isSelectionType)(selection, 'cell') ? (0, _utils2.getSelectionRect)(selection) : (0, _utils2.findCellRectClosestToPos)(selection.$from);
|
|
206
|
-
var
|
|
207
|
-
var
|
|
208
|
-
|
|
206
|
+
var shouldMoveDisabled;
|
|
207
|
+
var hasMergedCellsInTable;
|
|
208
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
|
|
209
|
+
var _tableMap$hasMergedCe;
|
|
210
|
+
shouldMoveDisabled = false;
|
|
211
|
+
hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
212
|
+
} else {
|
|
213
|
+
var hasMergedCells = direction === 'row' ? _utils3.hasMergedCellsInRow : _utils3.hasMergedCellsInColumn;
|
|
214
|
+
shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
|
|
215
|
+
hasMergedCellsInTable = (0, _utils3.getMergedCellsPositions)(state.tr).length > 0;
|
|
216
|
+
}
|
|
209
217
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
210
218
|
var dragMenuConfig = (0, _dragMenu.getDragMenuConfig)(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled);
|
|
211
219
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
@@ -18,6 +18,7 @@ var _layoutThreeEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/edi
|
|
|
18
18
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
19
19
|
var _chevronDoubleDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-double-down"));
|
|
20
20
|
var _chevronDoubleUp = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-double-up"));
|
|
21
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
21
22
|
var _commandsWithAnalytics = require("../commands-with-analytics");
|
|
22
23
|
var _commandsWithAnalytics2 = require("../pm-plugins/drag-and-drop/commands-with-analytics");
|
|
23
24
|
var _resizeState = require("../pm-plugins/table-resizing/utils/resize-state");
|
|
@@ -40,17 +41,23 @@ var canMove = exports.canMove = function canMove(sourceType, direction, totalIte
|
|
|
40
41
|
return false;
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
// We can't move column when target has
|
|
44
|
-
// We can't move row when target has
|
|
44
|
+
// We can't move column when target has merged cells with other columns
|
|
45
|
+
// We can't move row when target has merged cells with other rows
|
|
45
46
|
var hasMergedCellsInTarget = isRow ? (0, _mergedCells.hasMergedCellsWithRowNextToRowIndex)(targetIndex, selection) : (0, _mergedCells.hasMergedCellsWithColumnNextToColumnIndex)(targetIndex, selection);
|
|
46
47
|
if (hasMergedCellsInTarget) {
|
|
47
48
|
return false;
|
|
48
49
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
|
|
51
|
+
// We can't move if selection in the source is not a rectangle
|
|
52
|
+
if ((0, _mergedCells.hasMergedCellsInSelection)(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
// Currently we can't move in any direction if there are merged cells in the source
|
|
57
|
+
var hasMergedCellsInSource = isRow ? (0, _mergedCells.hasMergedCellsInRow)(selectedIndexes)(selection) : (0, _mergedCells.hasMergedCellsInColumn)(selectedIndexes)(selection);
|
|
58
|
+
if (hasMergedCellsInSource) {
|
|
59
|
+
return false;
|
|
60
|
+
}
|
|
54
61
|
}
|
|
55
62
|
return true;
|
|
56
63
|
};
|
|
@@ -2,7 +2,7 @@ export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clear
|
|
|
2
2
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
|
|
4
4
|
export { clearMultipleCells } from './clear';
|
|
5
|
-
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations } from './misc';
|
|
5
|
+
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest } from './misc';
|
|
6
6
|
export { sortByColumn } from './sort';
|
|
7
7
|
export { goToNextCell } from './go-to-next-cell';
|
|
8
8
|
export { removeDescendantNodes } from './referentiality';
|
|
@@ -522,4 +522,18 @@ export const addBoldInEmptyHeaderCells = tableCellHeader => (state, dispatch) =>
|
|
|
522
522
|
return true;
|
|
523
523
|
}
|
|
524
524
|
return false;
|
|
525
|
-
};
|
|
525
|
+
};
|
|
526
|
+
export const updateWidthToWidest = widthToWidest => createCommand(state => {
|
|
527
|
+
let {
|
|
528
|
+
widthToWidest: prevWidthToWidest
|
|
529
|
+
} = getPluginState(state);
|
|
530
|
+
if (prevWidthToWidest === widthToWidest) {
|
|
531
|
+
return false;
|
|
532
|
+
}
|
|
533
|
+
return {
|
|
534
|
+
type: 'UPDATE_TABLE_WIDTH_TO_WIDEST',
|
|
535
|
+
data: {
|
|
536
|
+
widthToWidest
|
|
537
|
+
}
|
|
538
|
+
};
|
|
539
|
+
});
|
|
@@ -8,8 +8,10 @@ import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keyma
|
|
|
8
8
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
9
9
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
10
10
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
11
|
+
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
11
12
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
12
13
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
|
+
import { updateWidthToWidest } from '../commands/misc';
|
|
13
15
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
14
16
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
15
17
|
import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
|
|
@@ -181,6 +183,7 @@ export const TableResizer = ({
|
|
|
181
183
|
}
|
|
182
184
|
}, [startMeasure, editorView, displayGapCursor, isTableScalingEnabled, containerWidth, displayGuideline, onResizeStart]);
|
|
183
185
|
const handleResize = useCallback((originalState, delta) => {
|
|
186
|
+
var _defaultGuidelinesFor, _defaultGuidelinesFor2;
|
|
184
187
|
countFrames();
|
|
185
188
|
const newWidth = originalState.width + delta.width;
|
|
186
189
|
let pos;
|
|
@@ -199,18 +202,34 @@ export const TableResizer = ({
|
|
|
199
202
|
parentWidth: newWidth
|
|
200
203
|
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled);
|
|
201
204
|
updateActiveGuidelines(findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE));
|
|
202
|
-
|
|
205
|
+
|
|
206
|
+
// when isTableScalingEnabled true
|
|
207
|
+
// and a table is resized to fit the widest guideline when view port width is between 1011 and 1800
|
|
208
|
+
// set the width of the table to 1800 pixels.
|
|
209
|
+
const {
|
|
210
|
+
state,
|
|
211
|
+
dispatch
|
|
212
|
+
} = editorView;
|
|
213
|
+
const widestGuideLineWidthString = (_defaultGuidelinesFor = defaultGuidelinesForPreserveTable(containerWidth)[16].key) === null || _defaultGuidelinesFor === void 0 ? void 0 : (_defaultGuidelinesFor2 = _defaultGuidelinesFor.match(/[\d]*[.]{0,1}[\d]+/g)) === null || _defaultGuidelinesFor2 === void 0 ? void 0 : _defaultGuidelinesFor2.join('');
|
|
214
|
+
const widestGuideLineWidth = parseInt(widestGuideLineWidthString || '', 10);
|
|
215
|
+
const shouldUpdateWidthToWidest = !!(isTableScalingEnabled && defaultGuidelinesForPreserveTable(containerWidth).length === 17 && widestGuideLineWidth - newWidth <= 1);
|
|
216
|
+
updateWidthToWidest(shouldUpdateWidthToWidest)(state, dispatch);
|
|
217
|
+
updateWidth(shouldUpdateWidthToWidest ? akEditorFullWidthLayoutWidth : newWidth);
|
|
203
218
|
return newWidth;
|
|
204
219
|
}, [countFrames, isTableScalingEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
|
|
205
220
|
const scheduleResize = useMemo(() => rafSchd(handleResize), [handleResize]);
|
|
206
221
|
const handleResizeStop = useCallback((originalState, delta) => {
|
|
207
222
|
isResizing.current = false;
|
|
208
|
-
|
|
223
|
+
let newWidth = originalState.width + delta.width;
|
|
209
224
|
const {
|
|
210
225
|
state,
|
|
211
226
|
dispatch
|
|
212
227
|
} = editorView;
|
|
213
228
|
const pos = getPos();
|
|
229
|
+
const {
|
|
230
|
+
widthToWidest
|
|
231
|
+
} = getPluginState(editorView.state);
|
|
232
|
+
newWidth = widthToWidest ? akEditorFullWidthLayoutWidth : newWidth;
|
|
214
233
|
let tr = state.tr.setMeta(tableWidthPluginKey, {
|
|
215
234
|
resizing: false
|
|
216
235
|
});
|
package/dist/es2019/reducer.js
CHANGED
|
@@ -192,9 +192,17 @@ export const DragMenu = /*#__PURE__*/React.memo(({
|
|
|
192
192
|
isKeyboardModeActive
|
|
193
193
|
} = getPluginState(state);
|
|
194
194
|
const selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
195
|
+
let shouldMoveDisabled;
|
|
196
|
+
let hasMergedCellsInTable;
|
|
197
|
+
if (getBooleanFF('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
|
|
198
|
+
var _tableMap$hasMergedCe;
|
|
199
|
+
shouldMoveDisabled = false;
|
|
200
|
+
hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
201
|
+
} else {
|
|
202
|
+
const hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
|
|
203
|
+
shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
|
|
204
|
+
hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
205
|
+
}
|
|
198
206
|
const allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
199
207
|
const dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled);
|
|
200
208
|
const {
|
|
@@ -10,12 +10,13 @@ import EditorLayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three
|
|
|
10
10
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
11
11
|
import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-down';
|
|
12
12
|
import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
|
|
13
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
14
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands-with-analytics';
|
|
14
15
|
import { moveSourceWithAnalytics } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
15
16
|
import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
16
17
|
import { getClosestSelectionRect } from '../toolbar';
|
|
17
18
|
import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
|
|
18
|
-
import { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
|
|
19
|
+
import { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsInSelection, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
|
|
19
20
|
import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
|
|
20
21
|
export const getTargetIndex = (selectedIndexes, direction) => Math[direction < 0 ? 'min' : 'max'](...selectedIndexes) + direction;
|
|
21
22
|
export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, selection, selectionRect) => {
|
|
@@ -30,17 +31,23 @@ export const canMove = (sourceType, direction, totalItemsOfSourceTypeCount, sele
|
|
|
30
31
|
return false;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
// We can't move column when target has
|
|
34
|
-
// We can't move row when target has
|
|
34
|
+
// We can't move column when target has merged cells with other columns
|
|
35
|
+
// We can't move row when target has merged cells with other rows
|
|
35
36
|
const hasMergedCellsInTarget = isRow ? hasMergedCellsWithRowNextToRowIndex(targetIndex, selection) : hasMergedCellsWithColumnNextToColumnIndex(targetIndex, selection);
|
|
36
37
|
if (hasMergedCellsInTarget) {
|
|
37
38
|
return false;
|
|
38
39
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
40
|
+
if (getBooleanFF('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
|
|
41
|
+
// We can't move if selection in the source is not a rectangle
|
|
42
|
+
if (hasMergedCellsInSelection(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
// Currently we can't move in any direction if there are merged cells in the source
|
|
47
|
+
const hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
|
|
48
|
+
if (hasMergedCellsInSource) {
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
44
51
|
}
|
|
45
52
|
return true;
|
|
46
53
|
};
|
|
@@ -2,7 +2,7 @@ export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clear
|
|
|
2
2
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout } from './toggle';
|
|
4
4
|
export { clearMultipleCells } from './clear';
|
|
5
|
-
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations } from './misc';
|
|
5
|
+
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest } from './misc';
|
|
6
6
|
export { sortByColumn } from './sort';
|
|
7
7
|
export { goToNextCell } from './go-to-next-cell';
|
|
8
8
|
export { removeDescendantNodes } from './referentiality';
|
|
@@ -554,4 +554,19 @@ export var addBoldInEmptyHeaderCells = function addBoldInEmptyHeaderCells(tableC
|
|
|
554
554
|
}
|
|
555
555
|
return false;
|
|
556
556
|
};
|
|
557
|
+
};
|
|
558
|
+
export var updateWidthToWidest = function updateWidthToWidest(widthToWidest) {
|
|
559
|
+
return createCommand(function (state) {
|
|
560
|
+
var _getPluginState4 = getPluginState(state),
|
|
561
|
+
prevWidthToWidest = _getPluginState4.widthToWidest;
|
|
562
|
+
if (prevWidthToWidest === widthToWidest) {
|
|
563
|
+
return false;
|
|
564
|
+
}
|
|
565
|
+
return {
|
|
566
|
+
type: 'UPDATE_TABLE_WIDTH_TO_WIDEST',
|
|
567
|
+
data: {
|
|
568
|
+
widthToWidest: widthToWidest
|
|
569
|
+
}
|
|
570
|
+
};
|
|
571
|
+
});
|
|
557
572
|
};
|
|
@@ -12,8 +12,10 @@ import { focusTableResizer, ToolTipContent } from '@atlaskit/editor-common/keyma
|
|
|
12
12
|
import { tableMessages as messages } from '@atlaskit/editor-common/messages';
|
|
13
13
|
import { ResizerNext } from '@atlaskit/editor-common/resizer';
|
|
14
14
|
import { browser } from '@atlaskit/editor-common/utils';
|
|
15
|
+
import { akEditorFullWidthLayoutWidth } from '@atlaskit/editor-shared-styles';
|
|
15
16
|
import { findTable } from '@atlaskit/editor-tables/utils';
|
|
16
17
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
18
|
+
import { updateWidthToWidest } from '../commands/misc';
|
|
17
19
|
import { getPluginState } from '../pm-plugins/plugin-factory';
|
|
18
20
|
import { META_KEYS } from '../pm-plugins/table-analytics';
|
|
19
21
|
import { COLUMN_MIN_WIDTH, getColgroupChildrenLength, previewScaleTable, scaleTable } from '../pm-plugins/table-resizing/utils';
|
|
@@ -180,6 +182,7 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
180
182
|
}
|
|
181
183
|
}, [startMeasure, editorView, displayGapCursor, isTableScalingEnabled, containerWidth, displayGuideline, onResizeStart]);
|
|
182
184
|
var handleResize = useCallback(function (originalState, delta) {
|
|
185
|
+
var _defaultGuidelinesFor;
|
|
183
186
|
countFrames();
|
|
184
187
|
var newWidth = originalState.width + delta.width;
|
|
185
188
|
var pos;
|
|
@@ -198,7 +201,17 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
198
201
|
parentWidth: newWidth
|
|
199
202
|
}, editorView.domAtPos.bind(editorView), isTableScalingEnabled);
|
|
200
203
|
updateActiveGuidelines(findClosestSnap(newWidth, isTableScalingEnabled ? defaultTablePreserveSnappingWidths(containerWidth) : defaultSnappingWidths, isTableScalingEnabled ? defaultGuidelinesForPreserveTable(containerWidth) : defaultGuidelines, TABLE_HIGHLIGHT_GAP, TABLE_HIGHLIGHT_TOLERANCE));
|
|
201
|
-
|
|
204
|
+
|
|
205
|
+
// when isTableScalingEnabled true
|
|
206
|
+
// and a table is resized to fit the widest guideline when view port width is between 1011 and 1800
|
|
207
|
+
// set the width of the table to 1800 pixels.
|
|
208
|
+
var state = editorView.state,
|
|
209
|
+
dispatch = editorView.dispatch;
|
|
210
|
+
var widestGuideLineWidthString = (_defaultGuidelinesFor = defaultGuidelinesForPreserveTable(containerWidth)[16].key) === null || _defaultGuidelinesFor === void 0 || (_defaultGuidelinesFor = _defaultGuidelinesFor.match(/[\d]*[.]{0,1}[\d]+/g)) === null || _defaultGuidelinesFor === void 0 ? void 0 : _defaultGuidelinesFor.join('');
|
|
211
|
+
var widestGuideLineWidth = parseInt(widestGuideLineWidthString || '', 10);
|
|
212
|
+
var shouldUpdateWidthToWidest = !!(isTableScalingEnabled && defaultGuidelinesForPreserveTable(containerWidth).length === 17 && widestGuideLineWidth - newWidth <= 1);
|
|
213
|
+
updateWidthToWidest(shouldUpdateWidthToWidest)(state, dispatch);
|
|
214
|
+
updateWidth(shouldUpdateWidthToWidest ? akEditorFullWidthLayoutWidth : newWidth);
|
|
202
215
|
return newWidth;
|
|
203
216
|
}, [countFrames, isTableScalingEnabled, tableRef, node, editorView, updateActiveGuidelines, containerWidth, updateWidth, getPos]);
|
|
204
217
|
var scheduleResize = useMemo(function () {
|
|
@@ -210,6 +223,9 @@ export var TableResizer = function TableResizer(_ref) {
|
|
|
210
223
|
var state = editorView.state,
|
|
211
224
|
dispatch = editorView.dispatch;
|
|
212
225
|
var pos = getPos();
|
|
226
|
+
var _getPluginState2 = getPluginState(editorView.state),
|
|
227
|
+
widthToWidest = _getPluginState2.widthToWidest;
|
|
228
|
+
newWidth = widthToWidest ? akEditorFullWidthLayoutWidth : newWidth;
|
|
213
229
|
var tr = state.tr.setMeta(tableWidthPluginKey, {
|
|
214
230
|
resizing: false
|
|
215
231
|
});
|
package/dist/esm/reducer.js
CHANGED
|
@@ -192,9 +192,17 @@ export var DragMenu = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
192
192
|
var _getPluginState = getPluginState(state),
|
|
193
193
|
isKeyboardModeActive = _getPluginState.isKeyboardModeActive;
|
|
194
194
|
var selectionRect = isSelectionType(selection, 'cell') ? getSelectionRect(selection) : findCellRectClosestToPos(selection.$from);
|
|
195
|
-
var
|
|
196
|
-
var
|
|
197
|
-
|
|
195
|
+
var shouldMoveDisabled;
|
|
196
|
+
var hasMergedCellsInTable;
|
|
197
|
+
if (getBooleanFF('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
|
|
198
|
+
var _tableMap$hasMergedCe;
|
|
199
|
+
shouldMoveDisabled = false;
|
|
200
|
+
hasMergedCellsInTable = (_tableMap$hasMergedCe = tableMap === null || tableMap === void 0 ? void 0 : tableMap.hasMergedCells()) !== null && _tableMap$hasMergedCe !== void 0 ? _tableMap$hasMergedCe : false;
|
|
201
|
+
} else {
|
|
202
|
+
var hasMergedCells = direction === 'row' ? hasMergedCellsInRow : hasMergedCellsInColumn;
|
|
203
|
+
shouldMoveDisabled = index !== undefined && hasMergedCells(index)(selection);
|
|
204
|
+
hasMergedCellsInTable = getMergedCellsPositions(state.tr).length > 0;
|
|
205
|
+
}
|
|
198
206
|
var allowBackgroundColor = (_pluginConfig$allowBa = pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.allowBackgroundColor) !== null && _pluginConfig$allowBa !== void 0 ? _pluginConfig$allowBa : false;
|
|
199
207
|
var dragMenuConfig = getDragMenuConfig(direction, getEditorContainerWidth, !shouldMoveDisabled, hasMergedCellsInTable, editorView, tableMap, index, targetCellPosition, selectionRect, editorAnalyticsAPI, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.isHeaderRowRequired, isTableScalingEnabled);
|
|
200
208
|
var _convertToDropdownIte = convertToDropdownItems(dragMenuConfig, formatMessage, selectionRect),
|
|
@@ -11,12 +11,13 @@ import EditorLayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three
|
|
|
11
11
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
12
12
|
import HipchatChevronDoubleDownIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-down';
|
|
13
13
|
import HipchatChevronDoubleUpIcon from '@atlaskit/icon/glyph/hipchat/chevron-double-up';
|
|
14
|
+
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { deleteColumnsWithAnalytics, deleteRowsWithAnalytics, distributeColumnsWidthsWithAnalytics, emptyMultipleCellsWithAnalytics, insertColumnWithAnalytics, insertRowWithAnalytics, sortColumnWithAnalytics } from '../commands-with-analytics';
|
|
15
16
|
import { moveSourceWithAnalytics } from '../pm-plugins/drag-and-drop/commands-with-analytics';
|
|
16
17
|
import { getNewResizeStateFromSelectedColumns } from '../pm-plugins/table-resizing/utils/resize-state';
|
|
17
18
|
import { getClosestSelectionRect } from '../toolbar';
|
|
18
19
|
import { AddColLeftIcon, AddColRightIcon, AddRowAboveIcon, AddRowBelowIcon } from '../ui/icons';
|
|
19
|
-
import { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
|
|
20
|
+
import { hasMergedCellsInColumn, hasMergedCellsInRow, hasMergedCellsInSelection, hasMergedCellsWithColumnNextToColumnIndex, hasMergedCellsWithRowNextToRowIndex } from './merged-cells';
|
|
20
21
|
import { getSelectedColumnIndexes, getSelectedRowIndexes } from './selection';
|
|
21
22
|
export var getTargetIndex = function getTargetIndex(selectedIndexes, direction) {
|
|
22
23
|
return Math[direction < 0 ? 'min' : 'max'].apply(Math, _toConsumableArray(selectedIndexes)) + direction;
|
|
@@ -33,17 +34,23 @@ export var canMove = function canMove(sourceType, direction, totalItemsOfSourceT
|
|
|
33
34
|
return false;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
// We can't move column when target has
|
|
37
|
-
// We can't move row when target has
|
|
37
|
+
// We can't move column when target has merged cells with other columns
|
|
38
|
+
// We can't move row when target has merged cells with other rows
|
|
38
39
|
var hasMergedCellsInTarget = isRow ? hasMergedCellsWithRowNextToRowIndex(targetIndex, selection) : hasMergedCellsWithColumnNextToColumnIndex(targetIndex, selection);
|
|
39
40
|
if (hasMergedCellsInTarget) {
|
|
40
41
|
return false;
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
if (getBooleanFF('platform.editor.table.drag-move-options-logic-update_fp7xw')) {
|
|
44
|
+
// We can't move if selection in the source is not a rectangle
|
|
45
|
+
if (hasMergedCellsInSelection(selectedIndexes, isRow ? 'row' : 'column')(selection)) {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
// Currently we can't move in any direction if there are merged cells in the source
|
|
50
|
+
var hasMergedCellsInSource = isRow ? hasMergedCellsInRow(selectedIndexes)(selection) : hasMergedCellsInColumn(selectedIndexes)(selection);
|
|
51
|
+
if (hasMergedCellsInSource) {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
47
54
|
}
|
|
48
55
|
return true;
|
|
49
56
|
};
|
|
@@ -2,7 +2,7 @@ export { hoverColumns, hoverRows, hoverTable, hoverCell, hoverMergedCells, clear
|
|
|
2
2
|
export { insertColumn, insertRow, createTable } from './insert';
|
|
3
3
|
export { getNextLayout, toggleContextualMenu, toggleHeaderColumn, toggleHeaderRow, toggleNumberColumn, toggleTableLayout, } from './toggle';
|
|
4
4
|
export { clearMultipleCells } from './clear';
|
|
5
|
-
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, } from './misc';
|
|
5
|
+
export { autoSizeTable, convertFirstRowToHeader, deleteTable, hideInsertColumnOrRowButton, moveCursorBackward, selectColumn, selectColumns, selectRow, selectRows, setCellAttr, setEditorFocus, setMultipleCellAttrs, setTableRef, showInsertColumnButton, showInsertRowButton, transformSliceToAddTableHeaders, triggerUnlessTableHeader, addBoldInEmptyHeaderCells, addResizeHandleDecorations, updateWidthToWidest, } from './misc';
|
|
6
6
|
export { sortByColumn } from './sort';
|
|
7
7
|
export { goToNextCell } from './go-to-next-cell';
|
|
8
8
|
export { removeDescendantNodes } from './referentiality';
|
|
@@ -33,3 +33,4 @@ export declare const autoSizeTable: (view: EditorView, node: PMNode, table: HTML
|
|
|
33
33
|
containerWidth: number;
|
|
34
34
|
}) => boolean;
|
|
35
35
|
export declare const addBoldInEmptyHeaderCells: (tableCellHeader: ContentNodeWithPos) => Command;
|
|
36
|
+
export declare const updateWidthToWidest: (widthToWidest: boolean) => Command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch
|
|
1
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("./types").AnalyticPluginState | ((state: import("prosemirror-state").EditorState) => import("./types").AnalyticPluginState)) => import("prosemirror-state").SafeStateField<import("./types").AnalyticPluginState>, createCommand: <A = import("./actions").AnalyticPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("./types").AnalyticPluginState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch
|
|
1
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("./types").DragAndDropPluginState | ((state: import("prosemirror-state").EditorState) => import("./types").DragAndDropPluginState)) => import("prosemirror-state").SafeStateField<import("./types").DragAndDropPluginState>, createCommand: <A = import("./actions").DragAndDropPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("./types").DragAndDropPluginState;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch
|
|
1
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: import("../types").TablePluginState | ((state: import("prosemirror-state").EditorState) => import("../types").TablePluginState)) => import("prosemirror-state").SafeStateField<import("../types").TablePluginState>, createCommand: <A = import("../types").TablePluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => import("../types").TablePluginState;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { StickyPluginAction, StickyPluginState } from './types';
|
|
2
|
-
declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch
|
|
2
|
+
declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: StickyPluginState | ((state: import("prosemirror-state").EditorState) => StickyPluginState)) => import("prosemirror-state").SafeStateField<StickyPluginState>, createCommand: <A = StickyPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
3
3
|
export { createPluginState, createCommand };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { ColumnResizingPluginState } from '../../types';
|
|
2
2
|
export declare const createCommand: <A = import("../../types").ColumnResizingPluginAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
3
|
-
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch
|
|
3
|
+
export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: ColumnResizingPluginState | ((state: import("prosemirror-state").EditorState) => ColumnResizingPluginState)) => import("prosemirror-state").SafeStateField<ColumnResizingPluginState>;
|
|
4
4
|
export declare const getPluginState: (state: import("prosemirror-state").EditorState) => ColumnResizingPluginState;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -83,6 +83,7 @@ export interface TablePluginState {
|
|
|
83
83
|
isKeyboardResize?: boolean;
|
|
84
84
|
isTableCollapsed?: boolean;
|
|
85
85
|
canCollapseTable?: boolean;
|
|
86
|
+
widthToWidest?: boolean;
|
|
86
87
|
getIntl: () => IntlShape;
|
|
87
88
|
isBreakoutEnabled?: boolean;
|
|
88
89
|
wasFullWidthModeEnabled?: boolean;
|
|
@@ -168,6 +169,11 @@ export type TablePluginAction = {
|
|
|
168
169
|
resizeHandleColumnIndex: number | undefined;
|
|
169
170
|
resizeHandleIncludeTooltip: boolean | undefined;
|
|
170
171
|
};
|
|
172
|
+
} | {
|
|
173
|
+
type: 'UPDATE_TABLE_WIDTH_TO_WIDEST';
|
|
174
|
+
data: {
|
|
175
|
+
widthToWidest: boolean | undefined;
|
|
176
|
+
};
|
|
171
177
|
} | {
|
|
172
178
|
type: 'REMOVE_RESIZE_HANDLE_DECORATIONS';
|
|
173
179
|
data: {
|
|
@@ -21,7 +21,7 @@ type DragHandleProps = {
|
|
|
21
21
|
editorView: EditorView;
|
|
22
22
|
isDragMenuTarget: boolean;
|
|
23
23
|
};
|
|
24
|
-
export declare const DragHandle: React.FC<import("react-intl-next").WithIntlProps<DragHandleProps & WrappedComponentProps
|
|
25
|
-
WrappedComponent: React.ComponentType<DragHandleProps & WrappedComponentProps
|
|
24
|
+
export declare const DragHandle: React.FC<import("react-intl-next").WithIntlProps<DragHandleProps & WrappedComponentProps>> & {
|
|
25
|
+
WrappedComponent: React.ComponentType<DragHandleProps & WrappedComponentProps>;
|
|
26
26
|
};
|
|
27
27
|
export {};
|