@atlaskit/editor-plugin-table 7.4.4 → 7.4.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 +7 -0
- package/dist/cjs/utils/merged-cells.js +3 -27
- package/dist/es2019/utils/merged-cells.js +1 -24
- package/dist/esm/utils/merged-cells.js +2 -26
- package/dist/types/utils/merged-cells.d.ts +0 -10
- package/dist/types-ts4.5/utils/merged-cells.d.ts +0 -10
- package/package.json +3 -3
- package/src/utils/merged-cells.ts +1 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#77616](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/77616) [`fbf65d3a22d9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/fbf65d3a22d9) - clean up work for merged cell.
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
|
|
3
10
|
## 7.4.4
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -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.hasMergedCellsWithRowNextToRowIndex = exports.hasMergedCellsWithColumnNextToColumnIndex = exports.hasMergedCellsInSelection = exports.hasMergedCellsInRow = exports.hasMergedCellsInColumn = exports.hasMergedCellsInBetween = exports.
|
|
7
|
+
exports.hasMergedCellsWithRowNextToRowIndex = exports.hasMergedCellsWithColumnNextToColumnIndex = exports.hasMergedCellsInSelection = exports.hasMergedCellsInRow = exports.hasMergedCellsInColumn = exports.hasMergedCellsInBetween = exports.findDuplicatePosition = exports.checkEdgeHasMergedCells = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _editorTables = require("@atlaskit/editor-tables");
|
|
10
10
|
var hasMergedCells = function hasMergedCells(indexes, normalizeRect) {
|
|
@@ -217,29 +217,6 @@ var hasMergedCellsInSelection = exports.hasMergedCellsInSelection = function has
|
|
|
217
217
|
};
|
|
218
218
|
};
|
|
219
219
|
|
|
220
|
-
/**
|
|
221
|
-
* handle table map by preprocess table's map row or column.
|
|
222
|
-
*
|
|
223
|
-
* @param map TableMap
|
|
224
|
-
* @returns object including mapByRow and mapByColumn
|
|
225
|
-
*/
|
|
226
|
-
var getTableMapByRowOrColumn = exports.getTableMapByRowOrColumn = function getTableMapByRowOrColumn(map) {
|
|
227
|
-
var mapByRow = Array(map.height);
|
|
228
|
-
var mapByColumn = Array(map.width);
|
|
229
|
-
var mapCopy = (0, _toConsumableArray2.default)(map.map);
|
|
230
|
-
for (var i = 0; i < mapCopy.length; i++) {
|
|
231
|
-
var _mapByColumn$columnIn, _mapByRow$rowIndex;
|
|
232
|
-
var columnIndex = i % map.width;
|
|
233
|
-
mapByColumn[columnIndex] = [].concat((0, _toConsumableArray2.default)((_mapByColumn$columnIn = mapByColumn[columnIndex]) !== null && _mapByColumn$columnIn !== void 0 ? _mapByColumn$columnIn : []), [mapCopy[i]]);
|
|
234
|
-
var rowIndex = Math.trunc(i / map.width);
|
|
235
|
-
mapByRow[rowIndex] = [].concat((0, _toConsumableArray2.default)((_mapByRow$rowIndex = mapByRow[rowIndex]) !== null && _mapByRow$rowIndex !== void 0 ? _mapByRow$rowIndex : []), [mapCopy[i]]);
|
|
236
|
-
}
|
|
237
|
-
return {
|
|
238
|
-
mapByRow: mapByRow,
|
|
239
|
-
mapByColumn: mapByColumn
|
|
240
|
-
};
|
|
241
|
-
};
|
|
242
|
-
|
|
243
220
|
/**
|
|
244
221
|
* this check the selection has merged cells with previous/next col or row.
|
|
245
222
|
*
|
|
@@ -249,9 +226,8 @@ var getTableMapByRowOrColumn = exports.getTableMapByRowOrColumn = function getTa
|
|
|
249
226
|
* @returns boolean
|
|
250
227
|
*/
|
|
251
228
|
var checkEdgeHasMergedCells = exports.checkEdgeHasMergedCells = function checkEdgeHasMergedCells(indexes, tableMap, direction) {
|
|
252
|
-
var
|
|
253
|
-
|
|
254
|
-
mapByColumn = _getTableMapByRowOrCo.mapByColumn;
|
|
229
|
+
var mapByRow = tableMap.mapByRow,
|
|
230
|
+
mapByColumn = tableMap.mapByColumn;
|
|
255
231
|
var map = 'row' === direction ? mapByRow : mapByColumn;
|
|
256
232
|
var lengthLimiter = direction === 'row' ? tableMap.width : tableMap.height;
|
|
257
233
|
var minIndex = Math.min.apply(Math, (0, _toConsumableArray2.default)(indexes));
|
|
@@ -193,29 +193,6 @@ export const hasMergedCellsInSelection = (indexes, type) => selection => {
|
|
|
193
193
|
return checkEdgeHasMergedCells(indexes, map, type);
|
|
194
194
|
};
|
|
195
195
|
|
|
196
|
-
/**
|
|
197
|
-
* handle table map by preprocess table's map row or column.
|
|
198
|
-
*
|
|
199
|
-
* @param map TableMap
|
|
200
|
-
* @returns object including mapByRow and mapByColumn
|
|
201
|
-
*/
|
|
202
|
-
export const getTableMapByRowOrColumn = map => {
|
|
203
|
-
let mapByRow = Array(map.height);
|
|
204
|
-
let mapByColumn = Array(map.width);
|
|
205
|
-
const mapCopy = [...map.map];
|
|
206
|
-
for (let i = 0; i < mapCopy.length; i++) {
|
|
207
|
-
var _mapByColumn$columnIn, _mapByRow$rowIndex;
|
|
208
|
-
const columnIndex = i % map.width;
|
|
209
|
-
mapByColumn[columnIndex] = [...((_mapByColumn$columnIn = mapByColumn[columnIndex]) !== null && _mapByColumn$columnIn !== void 0 ? _mapByColumn$columnIn : []), mapCopy[i]];
|
|
210
|
-
const rowIndex = Math.trunc(i / map.width);
|
|
211
|
-
mapByRow[rowIndex] = [...((_mapByRow$rowIndex = mapByRow[rowIndex]) !== null && _mapByRow$rowIndex !== void 0 ? _mapByRow$rowIndex : []), mapCopy[i]];
|
|
212
|
-
}
|
|
213
|
-
return {
|
|
214
|
-
mapByRow,
|
|
215
|
-
mapByColumn
|
|
216
|
-
};
|
|
217
|
-
};
|
|
218
|
-
|
|
219
196
|
/**
|
|
220
197
|
* this check the selection has merged cells with previous/next col or row.
|
|
221
198
|
*
|
|
@@ -228,7 +205,7 @@ export const checkEdgeHasMergedCells = (indexes, tableMap, direction) => {
|
|
|
228
205
|
const {
|
|
229
206
|
mapByRow,
|
|
230
207
|
mapByColumn
|
|
231
|
-
} =
|
|
208
|
+
} = tableMap;
|
|
232
209
|
const map = 'row' === direction ? mapByRow : mapByColumn;
|
|
233
210
|
const lengthLimiter = direction === 'row' ? tableMap.width : tableMap.height;
|
|
234
211
|
let minIndex = Math.min(...indexes);
|
|
@@ -210,29 +210,6 @@ export var hasMergedCellsInSelection = function hasMergedCellsInSelection(indexe
|
|
|
210
210
|
};
|
|
211
211
|
};
|
|
212
212
|
|
|
213
|
-
/**
|
|
214
|
-
* handle table map by preprocess table's map row or column.
|
|
215
|
-
*
|
|
216
|
-
* @param map TableMap
|
|
217
|
-
* @returns object including mapByRow and mapByColumn
|
|
218
|
-
*/
|
|
219
|
-
export var getTableMapByRowOrColumn = function getTableMapByRowOrColumn(map) {
|
|
220
|
-
var mapByRow = Array(map.height);
|
|
221
|
-
var mapByColumn = Array(map.width);
|
|
222
|
-
var mapCopy = _toConsumableArray(map.map);
|
|
223
|
-
for (var i = 0; i < mapCopy.length; i++) {
|
|
224
|
-
var _mapByColumn$columnIn, _mapByRow$rowIndex;
|
|
225
|
-
var columnIndex = i % map.width;
|
|
226
|
-
mapByColumn[columnIndex] = [].concat(_toConsumableArray((_mapByColumn$columnIn = mapByColumn[columnIndex]) !== null && _mapByColumn$columnIn !== void 0 ? _mapByColumn$columnIn : []), [mapCopy[i]]);
|
|
227
|
-
var rowIndex = Math.trunc(i / map.width);
|
|
228
|
-
mapByRow[rowIndex] = [].concat(_toConsumableArray((_mapByRow$rowIndex = mapByRow[rowIndex]) !== null && _mapByRow$rowIndex !== void 0 ? _mapByRow$rowIndex : []), [mapCopy[i]]);
|
|
229
|
-
}
|
|
230
|
-
return {
|
|
231
|
-
mapByRow: mapByRow,
|
|
232
|
-
mapByColumn: mapByColumn
|
|
233
|
-
};
|
|
234
|
-
};
|
|
235
|
-
|
|
236
213
|
/**
|
|
237
214
|
* this check the selection has merged cells with previous/next col or row.
|
|
238
215
|
*
|
|
@@ -242,9 +219,8 @@ export var getTableMapByRowOrColumn = function getTableMapByRowOrColumn(map) {
|
|
|
242
219
|
* @returns boolean
|
|
243
220
|
*/
|
|
244
221
|
export var checkEdgeHasMergedCells = function checkEdgeHasMergedCells(indexes, tableMap, direction) {
|
|
245
|
-
var
|
|
246
|
-
|
|
247
|
-
mapByColumn = _getTableMapByRowOrCo.mapByColumn;
|
|
222
|
+
var mapByRow = tableMap.mapByRow,
|
|
223
|
+
mapByColumn = tableMap.mapByColumn;
|
|
248
224
|
var map = 'row' === direction ? mapByRow : mapByColumn;
|
|
249
225
|
var lengthLimiter = direction === 'row' ? tableMap.width : tableMap.height;
|
|
250
226
|
var minIndex = Math.min.apply(Math, _toConsumableArray(indexes));
|
|
@@ -7,16 +7,6 @@ export declare const hasMergedCellsInBetween: (indexes: number[], type: MergeTyp
|
|
|
7
7
|
export declare const hasMergedCellsWithColumnNextToColumnIndex: (colIndex: number, selection: Selection) => boolean;
|
|
8
8
|
export declare const hasMergedCellsWithRowNextToRowIndex: (rowIndex: number, selection: Selection) => boolean;
|
|
9
9
|
export declare const hasMergedCellsInSelection: (indexes: number[], type: MergeType) => (selection: Selection) => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* handle table map by preprocess table's map row or column.
|
|
12
|
-
*
|
|
13
|
-
* @param map TableMap
|
|
14
|
-
* @returns object including mapByRow and mapByColumn
|
|
15
|
-
*/
|
|
16
|
-
export declare const getTableMapByRowOrColumn: (map: TableMap) => {
|
|
17
|
-
mapByRow: any[];
|
|
18
|
-
mapByColumn: any[];
|
|
19
|
-
};
|
|
20
10
|
/**
|
|
21
11
|
* this check the selection has merged cells with previous/next col or row.
|
|
22
12
|
*
|
|
@@ -7,16 +7,6 @@ export declare const hasMergedCellsInBetween: (indexes: number[], type: MergeTyp
|
|
|
7
7
|
export declare const hasMergedCellsWithColumnNextToColumnIndex: (colIndex: number, selection: Selection) => boolean;
|
|
8
8
|
export declare const hasMergedCellsWithRowNextToRowIndex: (rowIndex: number, selection: Selection) => boolean;
|
|
9
9
|
export declare const hasMergedCellsInSelection: (indexes: number[], type: MergeType) => (selection: Selection) => boolean;
|
|
10
|
-
/**
|
|
11
|
-
* handle table map by preprocess table's map row or column.
|
|
12
|
-
*
|
|
13
|
-
* @param map TableMap
|
|
14
|
-
* @returns object including mapByRow and mapByColumn
|
|
15
|
-
*/
|
|
16
|
-
export declare const getTableMapByRowOrColumn: (map: TableMap) => {
|
|
17
|
-
mapByRow: any[];
|
|
18
|
-
mapByColumn: any[];
|
|
19
|
-
};
|
|
20
10
|
/**
|
|
21
11
|
* this check the selection has merged cells with previous/next col or row.
|
|
22
12
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.5",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@atlaskit/adf-schema": "^35.5.1",
|
|
32
32
|
"@atlaskit/custom-steps": "^0.0.13",
|
|
33
|
-
"@atlaskit/editor-common": "^78.
|
|
33
|
+
"@atlaskit/editor-common": "^78.9.0",
|
|
34
34
|
"@atlaskit/editor-palette": "1.5.2",
|
|
35
35
|
"@atlaskit/editor-plugin-analytics": "^1.0.0",
|
|
36
36
|
"@atlaskit/editor-plugin-content-insertion": "^1.0.0",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"@atlaskit/pragmatic-drag-and-drop": "^1.0.0",
|
|
47
47
|
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^1.0.0",
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.0.0",
|
|
49
|
-
"@atlaskit/primitives": "^3.
|
|
49
|
+
"@atlaskit/primitives": "^3.2.0",
|
|
50
50
|
"@atlaskit/theme": "^12.6.0",
|
|
51
51
|
"@atlaskit/toggle": "^13.0.0",
|
|
52
52
|
"@atlaskit/tokens": "^1.38.0",
|
|
@@ -243,31 +243,6 @@ export const hasMergedCellsInSelection =
|
|
|
243
243
|
return checkEdgeHasMergedCells(indexes, map, type);
|
|
244
244
|
};
|
|
245
245
|
|
|
246
|
-
/**
|
|
247
|
-
* handle table map by preprocess table's map row or column.
|
|
248
|
-
*
|
|
249
|
-
* @param map TableMap
|
|
250
|
-
* @returns object including mapByRow and mapByColumn
|
|
251
|
-
*/
|
|
252
|
-
export const getTableMapByRowOrColumn = (map: TableMap) => {
|
|
253
|
-
let mapByRow = Array(map.height);
|
|
254
|
-
let mapByColumn = Array(map.width);
|
|
255
|
-
|
|
256
|
-
const mapCopy = [...map.map];
|
|
257
|
-
|
|
258
|
-
for (let i = 0; i < mapCopy.length; i++) {
|
|
259
|
-
const columnIndex = i % map.width;
|
|
260
|
-
mapByColumn[columnIndex] = [
|
|
261
|
-
...(mapByColumn[columnIndex] ?? []),
|
|
262
|
-
mapCopy[i],
|
|
263
|
-
];
|
|
264
|
-
const rowIndex = Math.trunc(i / map.width);
|
|
265
|
-
mapByRow[rowIndex] = [...(mapByRow[rowIndex] ?? []), mapCopy[i]];
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
return { mapByRow, mapByColumn };
|
|
269
|
-
};
|
|
270
|
-
|
|
271
246
|
/**
|
|
272
247
|
* this check the selection has merged cells with previous/next col or row.
|
|
273
248
|
*
|
|
@@ -281,7 +256,7 @@ export const checkEdgeHasMergedCells = (
|
|
|
281
256
|
tableMap: TableMap,
|
|
282
257
|
direction: 'row' | 'column',
|
|
283
258
|
): boolean => {
|
|
284
|
-
const { mapByRow, mapByColumn } =
|
|
259
|
+
const { mapByRow, mapByColumn } = tableMap;
|
|
285
260
|
const map = 'row' === direction ? mapByRow : mapByColumn;
|
|
286
261
|
const lengthLimiter = direction === 'row' ? tableMap.width : tableMap.height;
|
|
287
262
|
|