@atlaskit/editor-plugin-table 5.7.9 → 5.7.10
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 +8 -0
- package/dist/cjs/nodeviews/ExternalDropTargets.js +2 -1
- package/dist/cjs/pm-plugins/drag-and-drop/commands.js +3 -3
- package/dist/cjs/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/cjs/types.js +6 -1
- package/dist/cjs/ui/DragHandle/index.js +1 -1
- package/dist/cjs/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
- package/dist/cjs/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/cjs/ui/ui-styles.js +6 -2
- package/dist/cjs/utils/decoration.js +14 -4
- package/dist/es2019/nodeviews/ExternalDropTargets.js +2 -1
- package/dist/es2019/pm-plugins/drag-and-drop/commands.js +3 -3
- package/dist/es2019/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/es2019/types.js +6 -1
- package/dist/es2019/ui/DragHandle/index.js +1 -1
- package/dist/es2019/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
- package/dist/es2019/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/es2019/ui/ui-styles.js +108 -65
- package/dist/es2019/utils/decoration.js +14 -4
- package/dist/esm/nodeviews/ExternalDropTargets.js +2 -1
- package/dist/esm/pm-plugins/drag-and-drop/commands.js +3 -3
- package/dist/esm/pm-plugins/drag-and-drop/plugin.js +2 -1
- package/dist/esm/types.js +6 -1
- package/dist/esm/ui/DragHandle/index.js +1 -1
- package/dist/esm/ui/TableFloatingColumnControls/ColumnControls/index.js +2 -2
- package/dist/esm/ui/TableFloatingControls/RowControls/DragControls.js +2 -2
- package/dist/esm/ui/ui-styles.js +7 -3
- package/dist/esm/utils/decoration.js +14 -4
- package/dist/types/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types/types.d.ts +5 -0
- package/dist/types/utils/decoration.d.ts +2 -2
- package/dist/types-ts4.5/pm-plugins/drag-and-drop/commands.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +5 -0
- package/dist/types-ts4.5/utils/decoration.d.ts +2 -2
- package/package.json +4 -4
- package/src/__tests__/unit/analytics.ts +5 -1
- package/src/__tests__/unit/ui/RowDragControls.tsx +5 -4
- package/src/nodeviews/ExternalDropTargets.tsx +1 -0
- package/src/pm-plugins/drag-and-drop/commands.ts +3 -2
- package/src/pm-plugins/drag-and-drop/plugin.ts +10 -4
- package/src/types.ts +6 -0
- package/src/ui/DragHandle/index.tsx +1 -1
- package/src/ui/TableFloatingColumnControls/ColumnControls/index.tsx +35 -37
- package/src/ui/TableFloatingControls/RowControls/DragControls.tsx +33 -33
- package/src/ui/ui-styles.ts +115 -64
- package/src/utils/decoration.ts +27 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 5.7.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#66128](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66128) [`a276b9ce0b8f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a276b9ce0b8f) - Add data test ids to elements, introduce table tests
|
|
8
|
+
- [#66453](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/66453) [`a43a37f6b703`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/a43a37f6b703) - [ux] Updates color of insert line when drop target has merged cells.
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 5.7.9
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -55,7 +55,8 @@ var ExternalDropTargets = exports.ExternalDropTargets = function ExternalDropTar
|
|
|
55
55
|
top: "-".concat(_consts.dropTargetExtendedWidth - _styles.tableMarginTop, "px"),
|
|
56
56
|
pointerEvents: 'auto',
|
|
57
57
|
zIndex: "".concat(_consts.dropTargetsZIndex)
|
|
58
|
-
}
|
|
58
|
+
},
|
|
59
|
+
"data-testid": "table-floating-column-extended-drop-targets"
|
|
59
60
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
60
61
|
style: {
|
|
61
62
|
display: 'flex',
|
|
@@ -22,7 +22,7 @@ var getDecorations = exports.getDecorations = function getDecorations(state) {
|
|
|
22
22
|
var updatePluginStateDecorations = exports.updatePluginStateDecorations = function updatePluginStateDecorations(state, decorations, key) {
|
|
23
23
|
return (0, _utils2.updateDecorations)(state.doc, getDecorations(state), decorations, key);
|
|
24
24
|
};
|
|
25
|
-
var setDropTarget = exports.setDropTarget = function setDropTarget(type, index, tr) {
|
|
25
|
+
var setDropTarget = exports.setDropTarget = function setDropTarget(type, index, hasMergedCells, tr) {
|
|
26
26
|
return (0, _pluginFactory.createCommand)(function (state) {
|
|
27
27
|
var _getPluginState = (0, _pluginFactory.getPluginState)(state),
|
|
28
28
|
dropTargetType = _getPluginState.dropTargetType,
|
|
@@ -32,9 +32,9 @@ var setDropTarget = exports.setDropTarget = function setDropTarget(type, index,
|
|
|
32
32
|
}
|
|
33
33
|
var decorationSet = _view.DecorationSet.empty;
|
|
34
34
|
if (type === 'column') {
|
|
35
|
-
decorationSet = updatePluginStateDecorations(state, (0, _utils2.createColumnInsertLine)(index, state.selection), _types.TableDecorations.COLUMN_INSERT_LINE);
|
|
35
|
+
decorationSet = updatePluginStateDecorations(state, (0, _utils2.createColumnInsertLine)(index, state.selection, hasMergedCells), _types.TableDecorations.COLUMN_INSERT_LINE);
|
|
36
36
|
} else if (type === 'row') {
|
|
37
|
-
decorationSet = updatePluginStateDecorations(state, (0, _utils2.createRowInsertLine)(index, state.selection), _types.TableDecorations.ROW_INSERT_LINE);
|
|
37
|
+
decorationSet = updatePluginStateDecorations(state, (0, _utils2.createRowInsertLine)(index, state.selection, hasMergedCells), _types.TableDecorations.ROW_INSERT_LINE);
|
|
38
38
|
}
|
|
39
39
|
return {
|
|
40
40
|
type: _actions.DragAndDropActionType.SET_DROP_TARGET,
|
|
@@ -138,7 +138,8 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, eventD
|
|
|
138
138
|
var sourceType = data.sourceType,
|
|
139
139
|
targetAdjustedIndex = data.targetAdjustedIndex;
|
|
140
140
|
var dropTargetType = sourceType === 'table-row' ? _consts.DropTargetType.ROW : _consts.DropTargetType.COLUMN;
|
|
141
|
-
(0,
|
|
141
|
+
var hasMergedCells = (0, _utils2.hasMergedCellsInBetween)([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
|
|
142
|
+
(0, _commands.setDropTarget)(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
|
|
142
143
|
},
|
|
143
144
|
onDrop: function onDrop(event) {
|
|
144
145
|
var _cell$row, _cell$col;
|
package/dist/cjs/types.js
CHANGED
|
@@ -140,12 +140,17 @@ var TableCssClassName = exports.TableCssClassName = _objectSpread(_objectSpread(
|
|
|
140
140
|
TOP_LEFT_CELL: 'table > tbody > tr:nth-child(2) > td:nth-child(1)',
|
|
141
141
|
LAST_ITEM_IN_CELL: "".concat(_adfSchema.tablePrefixSelector, "-last-item-in-cell"),
|
|
142
142
|
WITH_COLUMN_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-column-insert-line"),
|
|
143
|
+
WITH_COLUMN_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-column-insert-line__inactive"),
|
|
143
144
|
WITH_FIRST_COLUMN_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-first-column-insert-line"),
|
|
145
|
+
WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-first-column-insert-line__inactive"),
|
|
144
146
|
WITH_LAST_COLUMN_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-last-column-insert-line"),
|
|
147
|
+
WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-last-column-insert-line__inactive"),
|
|
145
148
|
WITH_RESIZE_LINE: "".concat(_adfSchema.tablePrefixSelector, "-column-resize-line"),
|
|
146
149
|
WITH_RESIZE_LINE_LAST_COLUMN: "".concat(_adfSchema.tablePrefixSelector, "-column-resize-line-last-column"),
|
|
147
150
|
WITH_ROW_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-row-insert-line"),
|
|
148
|
-
|
|
151
|
+
WITH_ROW_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-row-insert-line__inactive"),
|
|
152
|
+
WITH_LAST_ROW_INSERT_LINE: "".concat(_adfSchema.tablePrefixSelector, "-last-row-insert-line"),
|
|
153
|
+
WITH_LAST_ROW_INSERT_LINE_INACTIVE: "".concat(_adfSchema.tablePrefixSelector, "-last-row-insert-line__inactive")
|
|
149
154
|
});
|
|
150
155
|
var ShadowEvent = exports.ShadowEvent = /*#__PURE__*/function (ShadowEvent) {
|
|
151
156
|
ShadowEvent["SHOW_BEFORE_SHADOW"] = "showBeforeShadow";
|
|
@@ -123,7 +123,7 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
123
123
|
style: {
|
|
124
124
|
transform: direction === 'column' ? 'none' : 'rotate(90deg)'
|
|
125
125
|
},
|
|
126
|
-
"data-testid": "table-
|
|
126
|
+
"data-testid": "table-drag-handle-button",
|
|
127
127
|
onMouseOver: onMouseOver,
|
|
128
128
|
onMouseOut: onMouseOut,
|
|
129
129
|
onMouseUp: function onMouseUp(e) {
|
|
@@ -153,7 +153,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
153
153
|
|
|
154
154
|
// this indexes are used to calculate the drag and drop source
|
|
155
155
|
var indexes = isColumnsSelected ? isHover ? colIndexes : selectedColIndexes : colIndexes;
|
|
156
|
-
return
|
|
156
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
157
157
|
key: type,
|
|
158
158
|
style: {
|
|
159
159
|
gridColumn: isSelecting ? selectedColumnPosition : gridColumnPosition,
|
|
@@ -165,7 +165,7 @@ var ColumnControls = exports.ColumnControls = function ColumnControls(_ref) {
|
|
|
165
165
|
zIndex: 99
|
|
166
166
|
},
|
|
167
167
|
"data-column-control-index": hoveredCell.colIndex,
|
|
168
|
-
"data-testid":
|
|
168
|
+
"data-testid": "table-floating-column-".concat(isSelecting ? selectedColIndexes[0] : colIndex, "-drag-handle")
|
|
169
169
|
}, /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandle, {
|
|
170
170
|
isDragMenuTarget: !isHover,
|
|
171
171
|
direction: "column",
|
|
@@ -140,7 +140,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
140
140
|
var currentSelectionAppearance = isRowsSelected ? isInDanger ? 'danger' : 'selected' : hoveredAppearance;
|
|
141
141
|
var isSelecting = isRowsSelected && !isHover;
|
|
142
142
|
var indexes = isRowsSelected ? isHover ? rowIndexes : selectedRowIndexes : rowIndexes;
|
|
143
|
-
return
|
|
143
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
144
144
|
key: type,
|
|
145
145
|
style: {
|
|
146
146
|
gridRow: isSelecting ? selectedRowPosition : gridRowPosition,
|
|
@@ -150,7 +150,7 @@ var DragControlsComponent = function DragControlsComponent(_ref) {
|
|
|
150
150
|
position: 'relative',
|
|
151
151
|
right: '-0.5px'
|
|
152
152
|
},
|
|
153
|
-
"data-testid":
|
|
153
|
+
"data-testid": "table-floating-row-".concat(isSelecting ? selectedRowIndexes[0] : rowIndex, "-drag-handle")
|
|
154
154
|
}, /*#__PURE__*/_react.default.createElement(_DragHandle.DragHandle, {
|
|
155
155
|
isDragMenuTarget: !isHover,
|
|
156
156
|
direction: "row",
|
package/dist/cjs/ui/ui-styles.js
CHANGED
|
@@ -13,7 +13,7 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
13
13
|
var _colors = require("@atlaskit/theme/colors");
|
|
14
14
|
var _types = require("../types");
|
|
15
15
|
var _consts = require("./consts");
|
|
16
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33;
|
|
16
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17, _templateObject18, _templateObject19, _templateObject20, _templateObject21, _templateObject22, _templateObject23, _templateObject24, _templateObject25, _templateObject26, _templateObject27, _templateObject28, _templateObject29, _templateObject30, _templateObject31, _templateObject32, _templateObject33, _templateObject34, _templateObject35, _templateObject36, _templateObject37;
|
|
17
17
|
var InsertLine = function InsertLine(cssString) {
|
|
18
18
|
return (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n background: ", ";\n display: none;\n position: absolute;\n z-index: ", ";\n ", "\n }\n"])), _types.TableCssClassName.CONTROLS_INSERT_LINE, _consts.tableBorderSelectedColor, _editorSharedStyles.akEditorUnitZIndex, cssString);
|
|
19
19
|
};
|
|
@@ -119,6 +119,10 @@ var resizeHandle = exports.resizeHandle = function resizeHandle() {
|
|
|
119
119
|
};
|
|
120
120
|
|
|
121
121
|
// Drag and Drop: drop target insert line
|
|
122
|
+
var tableCellColumnInsertLineStyles = (0, _react.css)(_templateObject33 || (_templateObject33 = (0, _taggedTemplateLiteral2.default)(["\n content: ' ';\n position: absolute;\n height: calc(100% + ", "px);\n width: ", "px;\n z-index: ", ";\n"])), _styles.tableCellBorderWidth * 2, _consts.insertLineWidth, _consts.columnControlsZIndex * 2);
|
|
123
|
+
var tableCellRowInsertLineStyles = (0, _react.css)(_templateObject34 || (_templateObject34 = (0, _taggedTemplateLiteral2.default)(["\n content: ' ';\n position: absolute;\n left: ", ";\n height: ", "px;\n width: calc(100% + ", "px);\n z-index: ", ";\n"])), "var(--ds-space-negative-025, -2px)", _consts.insertLineWidth, _styles.tableCellBorderWidth * 2, _consts.columnControlsZIndex * 2);
|
|
124
|
+
var insertLineActiveColor = (0, _react.css)(_templateObject35 || (_templateObject35 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n"])), _consts.tableBorderSelectedColor);
|
|
125
|
+
var insertLineInactiveColor = (0, _react.css)(_templateObject36 || (_templateObject36 = (0, _taggedTemplateLiteral2.default)(["\n background-color: ", ";\n"])), "var(--ds-background-accent-gray-subtler, ".concat(_editorSharedStyles.akEditorTableBorder, ")"));
|
|
122
126
|
var insertLine = exports.insertLine = function insertLine() {
|
|
123
|
-
return (0, _react.css)(
|
|
127
|
+
return (0, _react.css)(_templateObject37 || (_templateObject37 = (0, _taggedTemplateLiteral2.default)(["\n .", " {\n td.", "::before {\n ", "\n left: -1px;\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: -1px;\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: -1px;\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: -1px;\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: ", ";\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n left: ", ";\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: ", ";\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n left: ", ";\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n right: -1px;\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n right: -1px;\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n right: -1px;\n top: -", "px;\n ", "\n }\n\n th.", "::before {\n ", "\n right: -1px;\n top: -", "px;\n ", "\n }\n\n td.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n th.", "::before {\n ", "\n top: -1px;\n ", "\n }\n\n td.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n td.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n th.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n\n th.", "::before {\n ", "\n bottom: 0;\n ", "\n }\n }\n"])), _types.TableCssClassName.TABLE_CONTAINER, _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, insertLineActiveColor, _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, insertLineInactiveColor, _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, _styles.tableCellBorderWidth, insertLineActiveColor, _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, _styles.tableCellBorderWidth, insertLineInactiveColor, _types.TableCssClassName.WITH_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", insertLineActiveColor, _types.TableCssClassName.WITH_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", insertLineInactiveColor, _types.TableCssClassName.WITH_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", _styles.tableCellBorderWidth, insertLineActiveColor, _types.TableCssClassName.WITH_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, "var(--ds-space-negative-025, -2px)", _styles.tableCellBorderWidth, insertLineInactiveColor, _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, insertLineActiveColor, _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, insertLineInactiveColor, _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE, tableCellColumnInsertLineStyles, _styles.tableCellBorderWidth, insertLineActiveColor, _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE, tableCellColumnInsertLineStyles, _styles.tableCellBorderWidth, insertLineInactiveColor, _types.TableCssClassName.WITH_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, _types.TableCssClassName.WITH_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, _types.TableCssClassName.WITH_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, _types.TableCssClassName.WITH_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor, _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE, tableCellRowInsertLineStyles, insertLineActiveColor, _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE, tableCellRowInsertLineStyles, insertLineInactiveColor);
|
|
124
128
|
};
|
|
@@ -459,7 +459,7 @@ var createColumnLineResize = exports.createColumnLineResize = function createCol
|
|
|
459
459
|
});
|
|
460
460
|
}).filter(_utils.nonNullable);
|
|
461
461
|
};
|
|
462
|
-
var createColumnInsertLine = exports.createColumnInsertLine = function createColumnInsertLine(columnIndex, selection) {
|
|
462
|
+
var createColumnInsertLine = exports.createColumnInsertLine = function createColumnInsertLine(columnIndex, selection, hasMergedCells) {
|
|
463
463
|
var table = (0, _utils2.findTable)(selection);
|
|
464
464
|
if (!table) {
|
|
465
465
|
return [];
|
|
@@ -470,7 +470,12 @@ var createColumnInsertLine = exports.createColumnInsertLine = function createCol
|
|
|
470
470
|
if (isLastColumn) {
|
|
471
471
|
columnIndex -= 1;
|
|
472
472
|
}
|
|
473
|
-
var decorationClassName
|
|
473
|
+
var decorationClassName;
|
|
474
|
+
if (hasMergedCells) {
|
|
475
|
+
decorationClassName = isFirstColumn ? _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE : isLastColumn ? _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE : _types.TableCssClassName.WITH_COLUMN_INSERT_LINE_INACTIVE;
|
|
476
|
+
} else {
|
|
477
|
+
decorationClassName = isFirstColumn ? _types.TableCssClassName.WITH_FIRST_COLUMN_INSERT_LINE : isLastColumn ? _types.TableCssClassName.WITH_LAST_COLUMN_INSERT_LINE : _types.TableCssClassName.WITH_COLUMN_INSERT_LINE;
|
|
478
|
+
}
|
|
474
479
|
var cellPositions = makeArray(map.height).map(function (rowIndex) {
|
|
475
480
|
return map.map[map.width * rowIndex + columnIndex];
|
|
476
481
|
}).filter(function (cellPosition, rowIndex) {
|
|
@@ -499,7 +504,7 @@ var createColumnInsertLine = exports.createColumnInsertLine = function createCol
|
|
|
499
504
|
});
|
|
500
505
|
}).filter(_utils.nonNullable);
|
|
501
506
|
};
|
|
502
|
-
var createRowInsertLine = exports.createRowInsertLine = function createRowInsertLine(rowIndex, selection) {
|
|
507
|
+
var createRowInsertLine = exports.createRowInsertLine = function createRowInsertLine(rowIndex, selection, hasMergedCells) {
|
|
503
508
|
var table = (0, _utils2.findTable)(selection);
|
|
504
509
|
if (!table) {
|
|
505
510
|
return [];
|
|
@@ -513,7 +518,12 @@ var createRowInsertLine = exports.createRowInsertLine = function createRowInsert
|
|
|
513
518
|
if (!cells) {
|
|
514
519
|
return [];
|
|
515
520
|
}
|
|
516
|
-
var decorationClassName
|
|
521
|
+
var decorationClassName;
|
|
522
|
+
if (hasMergedCells) {
|
|
523
|
+
decorationClassName = isLastRow ? _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE : _types.TableCssClassName.WITH_ROW_INSERT_LINE_INACTIVE;
|
|
524
|
+
} else {
|
|
525
|
+
decorationClassName = isLastRow ? _types.TableCssClassName.WITH_LAST_ROW_INSERT_LINE : _types.TableCssClassName.WITH_ROW_INSERT_LINE;
|
|
526
|
+
}
|
|
517
527
|
return cells.map(function (cell, index) {
|
|
518
528
|
if (!cell || !cell.node) {
|
|
519
529
|
return;
|
|
@@ -44,7 +44,8 @@ export const ExternalDropTargets = ({
|
|
|
44
44
|
top: `-${dropTargetExtendedWidth - tableMarginTop}px`,
|
|
45
45
|
pointerEvents: 'auto',
|
|
46
46
|
zIndex: `${dropTargetsZIndex}`
|
|
47
|
-
}
|
|
47
|
+
},
|
|
48
|
+
"data-testid": "table-floating-column-extended-drop-targets"
|
|
48
49
|
}, /*#__PURE__*/React.createElement("div", {
|
|
49
50
|
style: {
|
|
50
51
|
display: 'flex',
|
|
@@ -15,7 +15,7 @@ export const getDecorations = state => {
|
|
|
15
15
|
return ((_pluginKey$getState = pluginKey.getState(state)) === null || _pluginKey$getState === void 0 ? void 0 : _pluginKey$getState.decorationSet) || DecorationSet.empty;
|
|
16
16
|
};
|
|
17
17
|
export const updatePluginStateDecorations = (state, decorations, key) => updateDecorations(state.doc, getDecorations(state), decorations, key);
|
|
18
|
-
export const setDropTarget = (type, index, tr) => createCommand(state => {
|
|
18
|
+
export const setDropTarget = (type, index, hasMergedCells, tr) => createCommand(state => {
|
|
19
19
|
const {
|
|
20
20
|
dropTargetType,
|
|
21
21
|
dropTargetIndex
|
|
@@ -25,9 +25,9 @@ export const setDropTarget = (type, index, tr) => createCommand(state => {
|
|
|
25
25
|
}
|
|
26
26
|
let decorationSet = DecorationSet.empty;
|
|
27
27
|
if (type === 'column') {
|
|
28
|
-
decorationSet = updatePluginStateDecorations(state, createColumnInsertLine(index, state.selection), TableDecorations.COLUMN_INSERT_LINE);
|
|
28
|
+
decorationSet = updatePluginStateDecorations(state, createColumnInsertLine(index, state.selection, hasMergedCells), TableDecorations.COLUMN_INSERT_LINE);
|
|
29
29
|
} else if (type === 'row') {
|
|
30
|
-
decorationSet = updatePluginStateDecorations(state, createRowInsertLine(index, state.selection), TableDecorations.ROW_INSERT_LINE);
|
|
30
|
+
decorationSet = updatePluginStateDecorations(state, createRowInsertLine(index, state.selection, hasMergedCells), TableDecorations.ROW_INSERT_LINE);
|
|
31
31
|
}
|
|
32
32
|
return {
|
|
33
33
|
type: DragAndDropActionType.SET_DROP_TARGET,
|
|
@@ -137,7 +137,8 @@ export const createPlugin = (dispatch, eventDispatcher, editorAnalyticsAPI) => {
|
|
|
137
137
|
targetAdjustedIndex
|
|
138
138
|
} = data;
|
|
139
139
|
const dropTargetType = sourceType === 'table-row' ? DropTargetType.ROW : DropTargetType.COLUMN;
|
|
140
|
-
|
|
140
|
+
const hasMergedCells = hasMergedCellsInBetween([targetAdjustedIndex - 1, targetAdjustedIndex], dropTargetType)(editorView.state.selection);
|
|
141
|
+
setDropTarget(dropTargetType, targetAdjustedIndex, hasMergedCells)(editorView.state, editorView.dispatch);
|
|
141
142
|
},
|
|
142
143
|
onDrop(event) {
|
|
143
144
|
var _cell$row, _cell$col;
|
package/dist/es2019/types.js
CHANGED
|
@@ -132,12 +132,17 @@ export const TableCssClassName = {
|
|
|
132
132
|
TOP_LEFT_CELL: 'table > tbody > tr:nth-child(2) > td:nth-child(1)',
|
|
133
133
|
LAST_ITEM_IN_CELL: `${tablePrefixSelector}-last-item-in-cell`,
|
|
134
134
|
WITH_COLUMN_INSERT_LINE: `${tablePrefixSelector}-column-insert-line`,
|
|
135
|
+
WITH_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-column-insert-line__inactive`,
|
|
135
136
|
WITH_FIRST_COLUMN_INSERT_LINE: `${tablePrefixSelector}-first-column-insert-line`,
|
|
137
|
+
WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-first-column-insert-line__inactive`,
|
|
136
138
|
WITH_LAST_COLUMN_INSERT_LINE: `${tablePrefixSelector}-last-column-insert-line`,
|
|
139
|
+
WITH_LAST_COLUMN_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-last-column-insert-line__inactive`,
|
|
137
140
|
WITH_RESIZE_LINE: `${tablePrefixSelector}-column-resize-line`,
|
|
138
141
|
WITH_RESIZE_LINE_LAST_COLUMN: `${tablePrefixSelector}-column-resize-line-last-column`,
|
|
139
142
|
WITH_ROW_INSERT_LINE: `${tablePrefixSelector}-row-insert-line`,
|
|
140
|
-
|
|
143
|
+
WITH_ROW_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-row-insert-line__inactive`,
|
|
144
|
+
WITH_LAST_ROW_INSERT_LINE: `${tablePrefixSelector}-last-row-insert-line`,
|
|
145
|
+
WITH_LAST_ROW_INSERT_LINE_INACTIVE: `${tablePrefixSelector}-last-row-insert-line__inactive`
|
|
141
146
|
};
|
|
142
147
|
export let ShadowEvent = /*#__PURE__*/function (ShadowEvent) {
|
|
143
148
|
ShadowEvent["SHOW_BEFORE_SHADOW"] = "showBeforeShadow";
|
|
@@ -109,7 +109,7 @@ export const DragHandle = ({
|
|
|
109
109
|
style: {
|
|
110
110
|
transform: direction === 'column' ? 'none' : 'rotate(90deg)'
|
|
111
111
|
},
|
|
112
|
-
"data-testid": "table-
|
|
112
|
+
"data-testid": "table-drag-handle-button",
|
|
113
113
|
onMouseOver: onMouseOver,
|
|
114
114
|
onMouseOut: onMouseOut,
|
|
115
115
|
onMouseUp: e => {
|
|
@@ -150,7 +150,7 @@ export const ColumnControls = ({
|
|
|
150
150
|
|
|
151
151
|
// this indexes are used to calculate the drag and drop source
|
|
152
152
|
const indexes = isColumnsSelected ? isHover ? colIndexes : selectedColIndexes : colIndexes;
|
|
153
|
-
return
|
|
153
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
154
154
|
key: type,
|
|
155
155
|
style: {
|
|
156
156
|
gridColumn: isSelecting ? selectedColumnPosition : gridColumnPosition,
|
|
@@ -162,7 +162,7 @@ export const ColumnControls = ({
|
|
|
162
162
|
zIndex: 99
|
|
163
163
|
},
|
|
164
164
|
"data-column-control-index": hoveredCell.colIndex,
|
|
165
|
-
"data-testid":
|
|
165
|
+
"data-testid": `table-floating-column-${isSelecting ? selectedColIndexes[0] : colIndex}-drag-handle`
|
|
166
166
|
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
167
167
|
isDragMenuTarget: !isHover,
|
|
168
168
|
direction: "column",
|
|
@@ -130,7 +130,7 @@ const DragControlsComponent = ({
|
|
|
130
130
|
const currentSelectionAppearance = isRowsSelected ? isInDanger ? 'danger' : 'selected' : hoveredAppearance;
|
|
131
131
|
const isSelecting = isRowsSelected && !isHover;
|
|
132
132
|
const indexes = isRowsSelected ? isHover ? rowIndexes : selectedRowIndexes : rowIndexes;
|
|
133
|
-
return
|
|
133
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
134
134
|
key: type,
|
|
135
135
|
style: {
|
|
136
136
|
gridRow: isSelecting ? selectedRowPosition : gridRowPosition,
|
|
@@ -140,7 +140,7 @@ const DragControlsComponent = ({
|
|
|
140
140
|
position: 'relative',
|
|
141
141
|
right: '-0.5px'
|
|
142
142
|
},
|
|
143
|
-
"data-testid":
|
|
143
|
+
"data-testid": `table-floating-row-${isSelecting ? selectedRowIndexes[0] : rowIndex}-drag-handle`
|
|
144
144
|
}, /*#__PURE__*/React.createElement(DragHandle, {
|
|
145
145
|
isDragMenuTarget: !isHover,
|
|
146
146
|
direction: "row",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { css } from '@emotion/react';
|
|
2
2
|
import { tableCellBorderWidth, tableMarginTop, tableMarginTopWithControl } from '@atlaskit/editor-common/styles';
|
|
3
|
-
import { akEditorShadowZIndex, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
3
|
+
import { akEditorShadowZIndex, akEditorTableBorder, akEditorTableNumberColumnWidth, akEditorUnitZIndex } from '@atlaskit/editor-shared-styles';
|
|
4
4
|
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
5
5
|
import { B300, N0, N300, N40A, N60A, Y200, Y50 } from '@atlaskit/theme/colors';
|
|
6
6
|
import { TableCssClassName as ClassName } from '../types';
|
|
@@ -786,116 +786,159 @@ export const resizeHandle = () => css`
|
|
|
786
786
|
`;
|
|
787
787
|
|
|
788
788
|
// Drag and Drop: drop target insert line
|
|
789
|
+
const tableCellColumnInsertLineStyles = css`
|
|
790
|
+
content: ' ';
|
|
791
|
+
position: absolute;
|
|
792
|
+
height: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
793
|
+
width: ${insertLineWidth}px;
|
|
794
|
+
z-index: ${columnControlsZIndex * 2};
|
|
795
|
+
`;
|
|
796
|
+
const tableCellRowInsertLineStyles = css`
|
|
797
|
+
content: ' ';
|
|
798
|
+
position: absolute;
|
|
799
|
+
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
800
|
+
height: ${insertLineWidth}px;
|
|
801
|
+
width: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
802
|
+
z-index: ${columnControlsZIndex * 2};
|
|
803
|
+
`;
|
|
804
|
+
const insertLineActiveColor = css`
|
|
805
|
+
background-color: ${tableBorderSelectedColor};
|
|
806
|
+
`;
|
|
807
|
+
const insertLineInactiveColor = css`
|
|
808
|
+
background-color: ${`var(--ds-background-accent-gray-subtler, ${akEditorTableBorder})`};
|
|
809
|
+
`;
|
|
789
810
|
export const insertLine = () => css`
|
|
790
811
|
.${ClassName.TABLE_CONTAINER} {
|
|
791
812
|
td.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
|
|
792
|
-
|
|
793
|
-
position: absolute;
|
|
813
|
+
${tableCellColumnInsertLineStyles}
|
|
794
814
|
left: -1px;
|
|
795
815
|
top: -1px;
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
816
|
+
${insertLineActiveColor}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
td.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
820
|
+
${tableCellColumnInsertLineStyles}
|
|
821
|
+
left: -1px;
|
|
822
|
+
top: -1px;
|
|
823
|
+
${insertLineInactiveColor}
|
|
800
824
|
}
|
|
801
825
|
|
|
802
826
|
th.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE}::before {
|
|
803
|
-
|
|
827
|
+
${tableCellColumnInsertLineStyles}
|
|
828
|
+
left: -1px;
|
|
829
|
+
top: -${tableCellBorderWidth}px;
|
|
830
|
+
${insertLineActiveColor}
|
|
831
|
+
}
|
|
832
|
+
|
|
833
|
+
th.${ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
834
|
+
${tableCellColumnInsertLineStyles}
|
|
804
835
|
left: -1px;
|
|
805
|
-
position: absolute;
|
|
806
|
-
width: ${insertLineWidth}px;
|
|
807
|
-
height: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
808
|
-
background-color: ${tableBorderSelectedColor};
|
|
809
|
-
z-index: ${columnControlsZIndex * 2};
|
|
810
836
|
top: -${tableCellBorderWidth}px;
|
|
837
|
+
${insertLineInactiveColor}
|
|
811
838
|
}
|
|
812
839
|
|
|
813
840
|
td.${ClassName.WITH_COLUMN_INSERT_LINE}::before {
|
|
814
|
-
|
|
815
|
-
position: absolute;
|
|
841
|
+
${tableCellColumnInsertLineStyles}
|
|
816
842
|
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
817
843
|
top: -1px;
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
844
|
+
${insertLineActiveColor}
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
td.${ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
848
|
+
${tableCellColumnInsertLineStyles}
|
|
849
|
+
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
850
|
+
top: -1px;
|
|
851
|
+
${insertLineInactiveColor}
|
|
822
852
|
}
|
|
823
853
|
|
|
824
854
|
th.${ClassName.WITH_COLUMN_INSERT_LINE}::before {
|
|
825
|
-
|
|
855
|
+
${tableCellColumnInsertLineStyles}
|
|
856
|
+
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
857
|
+
top: -${tableCellBorderWidth}px;
|
|
858
|
+
${insertLineActiveColor}
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
th.${ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
862
|
+
${tableCellColumnInsertLineStyles}
|
|
826
863
|
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
827
|
-
position: absolute;
|
|
828
|
-
width: ${insertLineWidth}px;
|
|
829
|
-
height: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
830
|
-
background-color: ${tableBorderSelectedColor};
|
|
831
|
-
z-index: ${columnControlsZIndex * 2};
|
|
832
864
|
top: -${tableCellBorderWidth}px;
|
|
865
|
+
${insertLineInactiveColor}
|
|
833
866
|
}
|
|
834
867
|
|
|
835
868
|
td.${ClassName.WITH_LAST_COLUMN_INSERT_LINE}::before {
|
|
836
|
-
|
|
837
|
-
position: absolute;
|
|
869
|
+
${tableCellColumnInsertLineStyles}
|
|
838
870
|
right: -1px;
|
|
839
871
|
top: -1px;
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
872
|
+
${insertLineActiveColor}
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
td.${ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
876
|
+
${tableCellColumnInsertLineStyles}
|
|
877
|
+
right: -1px;
|
|
878
|
+
top: -1px;
|
|
879
|
+
${insertLineInactiveColor}
|
|
844
880
|
}
|
|
845
881
|
|
|
846
882
|
th.${ClassName.WITH_LAST_COLUMN_INSERT_LINE}::before {
|
|
847
|
-
|
|
883
|
+
${tableCellColumnInsertLineStyles}
|
|
884
|
+
right: -1px;
|
|
885
|
+
top: -${tableCellBorderWidth}px;
|
|
886
|
+
${insertLineActiveColor}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
th.${ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE}::before {
|
|
890
|
+
${tableCellColumnInsertLineStyles}
|
|
848
891
|
right: -1px;
|
|
849
|
-
position: absolute;
|
|
850
|
-
width: ${insertLineWidth}px;
|
|
851
|
-
height: calc(100% + ${tableCellBorderWidth * 2}px);
|
|
852
|
-
background-color: ${tableBorderSelectedColor};
|
|
853
|
-
z-index: ${columnControlsZIndex * 2};
|
|
854
892
|
top: -${tableCellBorderWidth}px;
|
|
893
|
+
${insertLineInactiveColor}
|
|
855
894
|
}
|
|
856
895
|
|
|
857
896
|
td.${ClassName.WITH_ROW_INSERT_LINE}::before {
|
|
858
|
-
|
|
859
|
-
position: absolute;
|
|
860
|
-
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
897
|
+
${tableCellRowInsertLineStyles}
|
|
861
898
|
top: -1px;
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
899
|
+
${insertLineActiveColor}
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
td.${ClassName.WITH_ROW_INSERT_LINE_INACTIVE}::before {
|
|
903
|
+
${tableCellRowInsertLineStyles}
|
|
904
|
+
top: -1px;
|
|
905
|
+
${insertLineInactiveColor}
|
|
866
906
|
}
|
|
867
907
|
|
|
868
908
|
th.${ClassName.WITH_ROW_INSERT_LINE}::before {
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
909
|
+
${tableCellRowInsertLineStyles}
|
|
910
|
+
top: -1px;
|
|
911
|
+
${insertLineActiveColor}
|
|
912
|
+
}
|
|
913
|
+
|
|
914
|
+
th.${ClassName.WITH_ROW_INSERT_LINE_INACTIVE}::before {
|
|
915
|
+
${tableCellRowInsertLineStyles}
|
|
876
916
|
top: -1px;
|
|
917
|
+
${insertLineInactiveColor}
|
|
877
918
|
}
|
|
878
919
|
|
|
879
920
|
td.${ClassName.WITH_LAST_ROW_INSERT_LINE}::before {
|
|
880
|
-
|
|
881
|
-
position: absolute;
|
|
882
|
-
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
921
|
+
${tableCellRowInsertLineStyles}
|
|
883
922
|
bottom: 0;
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
923
|
+
${insertLineActiveColor}
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
td.${ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE}::before {
|
|
927
|
+
${tableCellRowInsertLineStyles}
|
|
928
|
+
bottom: 0;
|
|
929
|
+
${insertLineInactiveColor}
|
|
888
930
|
}
|
|
889
931
|
|
|
890
932
|
th.${ClassName.WITH_LAST_ROW_INSERT_LINE}::before {
|
|
891
|
-
|
|
892
|
-
left: ${"var(--ds-space-negative-025, -2px)"};
|
|
933
|
+
${tableCellRowInsertLineStyles}
|
|
893
934
|
bottom: 0;
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
935
|
+
${insertLineActiveColor}
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
th.${ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE}::before {
|
|
939
|
+
${tableCellRowInsertLineStyles}
|
|
940
|
+
bottom: 0;
|
|
941
|
+
${insertLineInactiveColor}
|
|
899
942
|
}
|
|
900
943
|
}
|
|
901
944
|
`;
|
|
@@ -426,7 +426,7 @@ export const createColumnLineResize = (selection, cellColumnPositioning) => {
|
|
|
426
426
|
});
|
|
427
427
|
}).filter(nonNullable);
|
|
428
428
|
};
|
|
429
|
-
export const createColumnInsertLine = (columnIndex, selection) => {
|
|
429
|
+
export const createColumnInsertLine = (columnIndex, selection, hasMergedCells) => {
|
|
430
430
|
const table = findTable(selection);
|
|
431
431
|
if (!table) {
|
|
432
432
|
return [];
|
|
@@ -437,7 +437,12 @@ export const createColumnInsertLine = (columnIndex, selection) => {
|
|
|
437
437
|
if (isLastColumn) {
|
|
438
438
|
columnIndex -= 1;
|
|
439
439
|
}
|
|
440
|
-
|
|
440
|
+
let decorationClassName;
|
|
441
|
+
if (hasMergedCells) {
|
|
442
|
+
decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE_INACTIVE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE_INACTIVE : ClassName.WITH_COLUMN_INSERT_LINE_INACTIVE;
|
|
443
|
+
} else {
|
|
444
|
+
decorationClassName = isFirstColumn ? ClassName.WITH_FIRST_COLUMN_INSERT_LINE : isLastColumn ? ClassName.WITH_LAST_COLUMN_INSERT_LINE : ClassName.WITH_COLUMN_INSERT_LINE;
|
|
445
|
+
}
|
|
441
446
|
const cellPositions = makeArray(map.height).map(rowIndex => map.map[map.width * rowIndex + columnIndex]).filter((cellPosition, rowIndex) => {
|
|
442
447
|
if (isLastColumn) {
|
|
443
448
|
return true; // If is the last column no filter applied
|
|
@@ -462,7 +467,7 @@ export const createColumnInsertLine = (columnIndex, selection) => {
|
|
|
462
467
|
});
|
|
463
468
|
}).filter(nonNullable);
|
|
464
469
|
};
|
|
465
|
-
export const createRowInsertLine = (rowIndex, selection) => {
|
|
470
|
+
export const createRowInsertLine = (rowIndex, selection, hasMergedCells) => {
|
|
466
471
|
const table = findTable(selection);
|
|
467
472
|
if (!table) {
|
|
468
473
|
return [];
|
|
@@ -476,7 +481,12 @@ export const createRowInsertLine = (rowIndex, selection) => {
|
|
|
476
481
|
if (!cells) {
|
|
477
482
|
return [];
|
|
478
483
|
}
|
|
479
|
-
|
|
484
|
+
let decorationClassName;
|
|
485
|
+
if (hasMergedCells) {
|
|
486
|
+
decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE_INACTIVE : ClassName.WITH_ROW_INSERT_LINE_INACTIVE;
|
|
487
|
+
} else {
|
|
488
|
+
decorationClassName = isLastRow ? ClassName.WITH_LAST_ROW_INSERT_LINE : ClassName.WITH_ROW_INSERT_LINE;
|
|
489
|
+
}
|
|
480
490
|
return cells.map((cell, index) => {
|
|
481
491
|
if (!cell || !cell.node) {
|
|
482
492
|
return;
|
|
@@ -45,7 +45,8 @@ export var ExternalDropTargets = function ExternalDropTargets(_ref) {
|
|
|
45
45
|
top: "-".concat(dropTargetExtendedWidth - tableMarginTop, "px"),
|
|
46
46
|
pointerEvents: 'auto',
|
|
47
47
|
zIndex: "".concat(dropTargetsZIndex)
|
|
48
|
-
}
|
|
48
|
+
},
|
|
49
|
+
"data-testid": "table-floating-column-extended-drop-targets"
|
|
49
50
|
}, /*#__PURE__*/React.createElement("div", {
|
|
50
51
|
style: {
|
|
51
52
|
display: 'flex',
|