@atlaskit/editor-tables 2.5.0 → 2.5.2
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 +12 -0
- package/dist/cjs/utils/move-column.js +10 -1
- package/dist/cjs/utils/move-row.js +13 -1
- package/dist/cjs/utils/normalize-direction.js +4 -7
- package/dist/cjs/utils.js +6 -0
- package/dist/es2019/utils/move-column.js +10 -1
- package/dist/es2019/utils/move-row.js +13 -1
- package/dist/es2019/utils/normalize-direction.js +4 -6
- package/dist/es2019/utils.js +1 -1
- package/dist/esm/utils/move-column.js +10 -1
- package/dist/esm/utils/move-row.js +13 -1
- package/dist/esm/utils/normalize-direction.js +4 -7
- package/dist/esm/utils.js +1 -1
- package/dist/types/types.d.ts +8 -3
- package/dist/types/utils/move-column.d.ts +2 -4
- package/dist/types/utils/move-row.d.ts +2 -4
- package/dist/types/utils/normalize-direction.d.ts +2 -4
- package/dist/types/utils.d.ts +1 -1
- package/dist/types-ts4.5/types.d.ts +8 -3
- package/dist/types-ts4.5/utils/move-column.d.ts +2 -4
- package/dist/types-ts4.5/utils/move-row.d.ts +2 -4
- package/dist/types-ts4.5/utils/normalize-direction.d.ts +2 -4
- package/dist/types-ts4.5/utils.d.ts +1 -1
- package/package.json +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-tables
|
|
2
2
|
|
|
3
|
+
## 2.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#69650](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69650) [`91a5b96796cb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/91a5b96796cb) - Migrate @atlaskit/editor-tables to use declarative entry points
|
|
8
|
+
|
|
9
|
+
## 2.5.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#69625](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/69625) [`67d7971c6ddf`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/67d7971c6ddf) - [ux] Tables DnD now supports dragging multiple rows/columns in a single drag using multi-select
|
|
14
|
+
|
|
3
15
|
## 2.5.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.moveColumn = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _cellSelection = require("../cell-selection");
|
|
9
10
|
var _tableMap = require("../table-map");
|
|
10
11
|
var _analyseTable = require("./analyse-table");
|
|
11
12
|
var _cloneTr = require("./clone-tr");
|
|
@@ -145,7 +146,8 @@ var _tableNodeTypes = require("./table-node-types");
|
|
|
145
146
|
var moveColumn = exports.moveColumn = function moveColumn(state, originColumnIndex, targetColumnIndex) {
|
|
146
147
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
147
148
|
tryToFit: false,
|
|
148
|
-
direction: 0
|
|
149
|
+
direction: 0,
|
|
150
|
+
selectAfterMove: false
|
|
149
151
|
};
|
|
150
152
|
return function (tr) {
|
|
151
153
|
var _originalColumnRanges, _targetColumnRanges$i;
|
|
@@ -227,6 +229,13 @@ var moveColumn = exports.moveColumn = function moveColumn(state, originColumnInd
|
|
|
227
229
|
var last = row[row.length - 1];
|
|
228
230
|
return newTr.delete(newTr.mapping.map(first.pos, 1), newTr.mapping.map(last.pos + last.node.nodeSize, -1));
|
|
229
231
|
});
|
|
232
|
+
if (options.selectAfterMove) {
|
|
233
|
+
var n = indexesOriginColumn.length - 1;
|
|
234
|
+
var selectionRange = (0, _getSelectionRangeInColumn.getSelectionRangeInColumn)(actualTargetIndex - (direction === 'end' ? n : 0), actualTargetIndex + (direction === 'start' ? n : 0))(newTr);
|
|
235
|
+
if (selectionRange) {
|
|
236
|
+
newTr.setSelection(new _cellSelection.CellSelection(selectionRange.$anchor, selectionRange.$head));
|
|
237
|
+
}
|
|
238
|
+
}
|
|
230
239
|
return newTr;
|
|
231
240
|
};
|
|
232
241
|
};
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.moveRow = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
|
+
var _cellSelection = require("../cell-selection");
|
|
10
11
|
var _tableMap = require("../table-map");
|
|
11
12
|
var _analyseTable = require("./analyse-table");
|
|
12
13
|
var _cloneTr = require("./clone-tr");
|
|
@@ -161,7 +162,8 @@ var _tableNodeTypes = require("./table-node-types");
|
|
|
161
162
|
var moveRow = exports.moveRow = function moveRow(state, originRowIndex, targetRowIndex) {
|
|
162
163
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
163
164
|
tryToFit: false,
|
|
164
|
-
direction: 0
|
|
165
|
+
direction: 0,
|
|
166
|
+
selectAfterMove: false
|
|
165
167
|
};
|
|
166
168
|
return function (tr) {
|
|
167
169
|
var table = (0, _find.findTable)(tr.selection);
|
|
@@ -241,6 +243,16 @@ var moveRow = exports.moveRow = function moveRow(state, originRowIndex, targetRo
|
|
|
241
243
|
var node = _ref3.node;
|
|
242
244
|
return normalizeRowNode(node, rowHeaderEnabled && actualTargetIndex === 0 && index === 0, columnHeaderEnabled, types);
|
|
243
245
|
}));
|
|
246
|
+
|
|
247
|
+
// IMPORTANT: We need to perform the selection between the insert/delete. This is because the delete could cause
|
|
248
|
+
// the current selection to be pushed out of the table resulting in an invalid selection range outside of the table
|
|
249
|
+
if (options.selectAfterMove) {
|
|
250
|
+
var offset = direction === 'end' ? 1 : 0;
|
|
251
|
+
var selectionRange = (0, _getSelectionRangeInRow.getSelectionRangeInRow)(actualTargetIndex + offset, actualTargetIndex + offset + originNodes.length - 1)(newTr);
|
|
252
|
+
if (selectionRange) {
|
|
253
|
+
newTr.setSelection(new _cellSelection.CellSelection(selectionRange.$anchor, selectionRange.$head));
|
|
254
|
+
}
|
|
255
|
+
}
|
|
244
256
|
originNodes.forEach(function (_ref4) {
|
|
245
257
|
var pos = _ref4.pos,
|
|
246
258
|
node = _ref4.node;
|
|
@@ -4,12 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.normalizeDirection = normalizeDirection;
|
|
7
|
-
function normalizeDirection(origin, target) {
|
|
8
|
-
var
|
|
9
|
-
tryToFit: false,
|
|
10
|
-
direction: 0
|
|
11
|
-
};
|
|
7
|
+
function normalizeDirection(origin, target, options) {
|
|
8
|
+
var _options$direction;
|
|
12
9
|
var dir = origin < target ? 'end' : 'start';
|
|
13
|
-
var override = options.direction < 0 ? 'start' : 'end';
|
|
14
|
-
return options.tryToFit && !!options.direction ? override : dir;
|
|
10
|
+
var override = ((_options$direction = options === null || options === void 0 ? void 0 : options.direction) !== null && _options$direction !== void 0 ? _options$direction : 0) < 0 ? 'start' : 'end';
|
|
11
|
+
return options !== null && options !== void 0 && options.tryToFit && !!(options !== null && options !== void 0 && options.direction) ? override : dir;
|
|
15
12
|
}
|
package/dist/cjs/utils.js
CHANGED
|
@@ -357,6 +357,12 @@ Object.defineProperty(exports, "selectTable", {
|
|
|
357
357
|
return _selectNodes.selectTable;
|
|
358
358
|
}
|
|
359
359
|
});
|
|
360
|
+
Object.defineProperty(exports, "selectTableClosestToPos", {
|
|
361
|
+
enumerable: true,
|
|
362
|
+
get: function get() {
|
|
363
|
+
return _selectNodes.selectTableClosestToPos;
|
|
364
|
+
}
|
|
365
|
+
});
|
|
360
366
|
Object.defineProperty(exports, "selectedRect", {
|
|
361
367
|
enumerable: true,
|
|
362
368
|
get: function get() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CellSelection } from '../cell-selection';
|
|
1
2
|
import { TableMap } from '../table-map';
|
|
2
3
|
import { determineTableHeaderStateFromTableNode } from './analyse-table';
|
|
3
4
|
import { cloneTr } from './clone-tr';
|
|
@@ -136,7 +137,8 @@ import { tableNodeTypes } from './table-node-types';
|
|
|
136
137
|
// ```
|
|
137
138
|
export const moveColumn = (state, originColumnIndex, targetColumnIndex, options = {
|
|
138
139
|
tryToFit: false,
|
|
139
|
-
direction: 0
|
|
140
|
+
direction: 0,
|
|
141
|
+
selectAfterMove: false
|
|
140
142
|
}) => tr => {
|
|
141
143
|
var _originalColumnRanges, _targetColumnRanges$i;
|
|
142
144
|
const table = findTable(tr.selection);
|
|
@@ -218,6 +220,13 @@ export const moveColumn = (state, originColumnIndex, targetColumnIndex, options
|
|
|
218
220
|
const last = row[row.length - 1];
|
|
219
221
|
return newTr.delete(newTr.mapping.map(first.pos, 1), newTr.mapping.map(last.pos + last.node.nodeSize, -1));
|
|
220
222
|
});
|
|
223
|
+
if (options.selectAfterMove) {
|
|
224
|
+
const n = indexesOriginColumn.length - 1;
|
|
225
|
+
const selectionRange = getSelectionRangeInColumn(actualTargetIndex - (direction === 'end' ? n : 0), actualTargetIndex + (direction === 'start' ? n : 0))(newTr);
|
|
226
|
+
if (selectionRange) {
|
|
227
|
+
newTr.setSelection(new CellSelection(selectionRange.$anchor, selectionRange.$head));
|
|
228
|
+
}
|
|
229
|
+
}
|
|
221
230
|
return newTr;
|
|
222
231
|
};
|
|
223
232
|
function normalizeCellNode(cellNode, rowHeaderEnabled, columnHeaderEnabled, types) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CellSelection } from '../cell-selection';
|
|
1
2
|
import { TableMap } from '../table-map';
|
|
2
3
|
import { determineTableHeaderStateFromTableNode } from './analyse-table';
|
|
3
4
|
import { cloneTr } from './clone-tr';
|
|
@@ -152,7 +153,8 @@ import { tableNodeTypes } from './table-node-types';
|
|
|
152
153
|
// ```
|
|
153
154
|
export const moveRow = (state, originRowIndex, targetRowIndex, options = {
|
|
154
155
|
tryToFit: false,
|
|
155
|
-
direction: 0
|
|
156
|
+
direction: 0,
|
|
157
|
+
selectAfterMove: false
|
|
156
158
|
}) => tr => {
|
|
157
159
|
const table = findTable(tr.selection);
|
|
158
160
|
if (!table) {
|
|
@@ -221,6 +223,16 @@ export const moveRow = (state, originRowIndex, targetRowIndex, options = {
|
|
|
221
223
|
newTr.insert(insertPos, originNodes.map(({
|
|
222
224
|
node
|
|
223
225
|
}, index) => normalizeRowNode(node, rowHeaderEnabled && actualTargetIndex === 0 && index === 0, columnHeaderEnabled, types)));
|
|
226
|
+
|
|
227
|
+
// IMPORTANT: We need to perform the selection between the insert/delete. This is because the delete could cause
|
|
228
|
+
// the current selection to be pushed out of the table resulting in an invalid selection range outside of the table
|
|
229
|
+
if (options.selectAfterMove) {
|
|
230
|
+
const offset = direction === 'end' ? 1 : 0;
|
|
231
|
+
const selectionRange = getSelectionRangeInRow(actualTargetIndex + offset, actualTargetIndex + offset + originNodes.length - 1)(newTr);
|
|
232
|
+
if (selectionRange) {
|
|
233
|
+
newTr.setSelection(new CellSelection(selectionRange.$anchor, selectionRange.$head));
|
|
234
|
+
}
|
|
235
|
+
}
|
|
224
236
|
originNodes.forEach(({
|
|
225
237
|
pos,
|
|
226
238
|
node
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
export function normalizeDirection(origin, target, options
|
|
2
|
-
|
|
3
|
-
direction: 0
|
|
4
|
-
}) {
|
|
1
|
+
export function normalizeDirection(origin, target, options) {
|
|
2
|
+
var _options$direction;
|
|
5
3
|
const dir = origin < target ? 'end' : 'start';
|
|
6
|
-
const override = options.direction < 0 ? 'start' : 'end';
|
|
7
|
-
return options.tryToFit && !!options.direction ? override : dir;
|
|
4
|
+
const override = ((_options$direction = options === null || options === void 0 ? void 0 : options.direction) !== null && _options$direction !== void 0 ? _options$direction : 0) < 0 ? 'start' : 'end';
|
|
5
|
+
return options !== null && options !== void 0 && options.tryToFit && !!(options !== null && options !== void 0 && options.direction) ? override : dir;
|
|
8
6
|
}
|
package/dist/es2019/utils.js
CHANGED
|
@@ -27,7 +27,7 @@ export { normalizeSelection } from './utils/normalize-selection';
|
|
|
27
27
|
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos } from './utils/remove-column';
|
|
28
28
|
export { removeRowAt, removeSelectedRows, removeRowClosestToPos } from './utils/remove-row';
|
|
29
29
|
export { removeTable } from './utils/remove-table';
|
|
30
|
-
export { selectColumn, selectColumns, selectRow, selectRows, selectTable } from './utils/select-nodes';
|
|
30
|
+
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos } from './utils/select-nodes';
|
|
31
31
|
export { selectionCell } from './utils/selection-cell';
|
|
32
32
|
export { selectedRect } from './utils/selection-rect';
|
|
33
33
|
export { setCellAttrs } from './utils/set-cell-attrs';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { CellSelection } from '../cell-selection';
|
|
2
3
|
import { TableMap } from '../table-map';
|
|
3
4
|
import { determineTableHeaderStateFromTableNode } from './analyse-table';
|
|
4
5
|
import { cloneTr } from './clone-tr';
|
|
@@ -138,7 +139,8 @@ import { tableNodeTypes } from './table-node-types';
|
|
|
138
139
|
export var moveColumn = function moveColumn(state, originColumnIndex, targetColumnIndex) {
|
|
139
140
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
140
141
|
tryToFit: false,
|
|
141
|
-
direction: 0
|
|
142
|
+
direction: 0,
|
|
143
|
+
selectAfterMove: false
|
|
142
144
|
};
|
|
143
145
|
return function (tr) {
|
|
144
146
|
var _originalColumnRanges, _targetColumnRanges$i;
|
|
@@ -220,6 +222,13 @@ export var moveColumn = function moveColumn(state, originColumnIndex, targetColu
|
|
|
220
222
|
var last = row[row.length - 1];
|
|
221
223
|
return newTr.delete(newTr.mapping.map(first.pos, 1), newTr.mapping.map(last.pos + last.node.nodeSize, -1));
|
|
222
224
|
});
|
|
225
|
+
if (options.selectAfterMove) {
|
|
226
|
+
var n = indexesOriginColumn.length - 1;
|
|
227
|
+
var selectionRange = getSelectionRangeInColumn(actualTargetIndex - (direction === 'end' ? n : 0), actualTargetIndex + (direction === 'start' ? n : 0))(newTr);
|
|
228
|
+
if (selectionRange) {
|
|
229
|
+
newTr.setSelection(new CellSelection(selectionRange.$anchor, selectionRange.$head));
|
|
230
|
+
}
|
|
231
|
+
}
|
|
223
232
|
return newTr;
|
|
224
233
|
};
|
|
225
234
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
2
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
3
|
+
import { CellSelection } from '../cell-selection';
|
|
3
4
|
import { TableMap } from '../table-map';
|
|
4
5
|
import { determineTableHeaderStateFromTableNode } from './analyse-table';
|
|
5
6
|
import { cloneTr } from './clone-tr';
|
|
@@ -155,7 +156,8 @@ import { tableNodeTypes } from './table-node-types';
|
|
|
155
156
|
export var moveRow = function moveRow(state, originRowIndex, targetRowIndex) {
|
|
156
157
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {
|
|
157
158
|
tryToFit: false,
|
|
158
|
-
direction: 0
|
|
159
|
+
direction: 0,
|
|
160
|
+
selectAfterMove: false
|
|
159
161
|
};
|
|
160
162
|
return function (tr) {
|
|
161
163
|
var table = findTable(tr.selection);
|
|
@@ -235,6 +237,16 @@ export var moveRow = function moveRow(state, originRowIndex, targetRowIndex) {
|
|
|
235
237
|
var node = _ref3.node;
|
|
236
238
|
return normalizeRowNode(node, rowHeaderEnabled && actualTargetIndex === 0 && index === 0, columnHeaderEnabled, types);
|
|
237
239
|
}));
|
|
240
|
+
|
|
241
|
+
// IMPORTANT: We need to perform the selection between the insert/delete. This is because the delete could cause
|
|
242
|
+
// the current selection to be pushed out of the table resulting in an invalid selection range outside of the table
|
|
243
|
+
if (options.selectAfterMove) {
|
|
244
|
+
var offset = direction === 'end' ? 1 : 0;
|
|
245
|
+
var selectionRange = getSelectionRangeInRow(actualTargetIndex + offset, actualTargetIndex + offset + originNodes.length - 1)(newTr);
|
|
246
|
+
if (selectionRange) {
|
|
247
|
+
newTr.setSelection(new CellSelection(selectionRange.$anchor, selectionRange.$head));
|
|
248
|
+
}
|
|
249
|
+
}
|
|
238
250
|
originNodes.forEach(function (_ref4) {
|
|
239
251
|
var pos = _ref4.pos,
|
|
240
252
|
node = _ref4.node;
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
export function normalizeDirection(origin, target) {
|
|
2
|
-
var
|
|
3
|
-
tryToFit: false,
|
|
4
|
-
direction: 0
|
|
5
|
-
};
|
|
1
|
+
export function normalizeDirection(origin, target, options) {
|
|
2
|
+
var _options$direction;
|
|
6
3
|
var dir = origin < target ? 'end' : 'start';
|
|
7
|
-
var override = options.direction < 0 ? 'start' : 'end';
|
|
8
|
-
return options.tryToFit && !!options.direction ? override : dir;
|
|
4
|
+
var override = ((_options$direction = options === null || options === void 0 ? void 0 : options.direction) !== null && _options$direction !== void 0 ? _options$direction : 0) < 0 ? 'start' : 'end';
|
|
5
|
+
return options !== null && options !== void 0 && options.tryToFit && !!(options !== null && options !== void 0 && options.direction) ? override : dir;
|
|
9
6
|
}
|
package/dist/esm/utils.js
CHANGED
|
@@ -27,7 +27,7 @@ export { normalizeSelection } from './utils/normalize-selection';
|
|
|
27
27
|
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos } from './utils/remove-column';
|
|
28
28
|
export { removeRowAt, removeSelectedRows, removeRowClosestToPos } from './utils/remove-row';
|
|
29
29
|
export { removeTable } from './utils/remove-table';
|
|
30
|
-
export { selectColumn, selectColumns, selectRow, selectRows, selectTable } from './utils/select-nodes';
|
|
30
|
+
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos } from './utils/select-nodes';
|
|
31
31
|
export { selectionCell } from './utils/selection-cell';
|
|
32
32
|
export { selectedRect } from './utils/selection-rect';
|
|
33
33
|
export { setCellAttrs } from './utils/set-cell-attrs';
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fragment, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
1
|
+
import type { Fragment, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
export interface CellAttributes {
|
|
5
5
|
colspan?: number;
|
|
6
6
|
rowspan?: number;
|
|
@@ -37,3 +37,8 @@ export type CellAttributesWithColSpan = CellAttributes & {
|
|
|
37
37
|
export type Writeable<T> = {
|
|
38
38
|
-readonly [P in keyof T]: T[P];
|
|
39
39
|
};
|
|
40
|
+
export interface MoveOptions {
|
|
41
|
+
tryToFit?: boolean;
|
|
42
|
+
direction?: number;
|
|
43
|
+
selectAfterMove?: boolean;
|
|
44
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
direction: number;
|
|
5
|
-
}) => (tr: Transaction) => Transaction;
|
|
2
|
+
import type { MoveOptions } from '../types';
|
|
3
|
+
export declare const moveColumn: (state: EditorState, originColumnIndex: number | number[], targetColumnIndex: number, options?: MoveOptions) => (tr: Transaction) => Transaction;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
direction: number;
|
|
5
|
-
}) => (tr: Transaction) => Transaction;
|
|
2
|
+
import type { MoveOptions } from '../types';
|
|
3
|
+
export declare const moveRow: (state: EditorState, originRowIndex: number | number[], targetRowIndex: number, options?: MoveOptions) => (tr: Transaction) => Transaction;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
direction: number;
|
|
4
|
-
}): 'start' | 'end';
|
|
1
|
+
import type { MoveOptions } from '../types';
|
|
2
|
+
export declare function normalizeDirection(origin: number, target: number, options?: MoveOptions): 'start' | 'end';
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export { normalizeSelection } from './utils/normalize-selection';
|
|
|
27
27
|
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos, } from './utils/remove-column';
|
|
28
28
|
export { removeRowAt, removeSelectedRows, removeRowClosestToPos, } from './utils/remove-row';
|
|
29
29
|
export { removeTable } from './utils/remove-table';
|
|
30
|
-
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, } from './utils/select-nodes';
|
|
30
|
+
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos, } from './utils/select-nodes';
|
|
31
31
|
export { selectionCell } from './utils/selection-cell';
|
|
32
32
|
export { selectedRect } from './utils/selection-rect';
|
|
33
33
|
export type { SelectionRect } from './utils/selection-rect';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fragment, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
1
|
+
import type { Fragment, ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
export interface CellAttributes {
|
|
5
5
|
colspan?: number;
|
|
6
6
|
rowspan?: number;
|
|
@@ -37,3 +37,8 @@ export type CellAttributesWithColSpan = CellAttributes & {
|
|
|
37
37
|
export type Writeable<T> = {
|
|
38
38
|
-readonly [P in keyof T]: T[P];
|
|
39
39
|
};
|
|
40
|
+
export interface MoveOptions {
|
|
41
|
+
tryToFit?: boolean;
|
|
42
|
+
direction?: number;
|
|
43
|
+
selectAfterMove?: boolean;
|
|
44
|
+
}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
direction: number;
|
|
5
|
-
}) => (tr: Transaction) => Transaction;
|
|
2
|
+
import type { MoveOptions } from '../types';
|
|
3
|
+
export declare const moveColumn: (state: EditorState, originColumnIndex: number | number[], targetColumnIndex: number, options?: MoveOptions) => (tr: Transaction) => Transaction;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
direction: number;
|
|
5
|
-
}) => (tr: Transaction) => Transaction;
|
|
2
|
+
import type { MoveOptions } from '../types';
|
|
3
|
+
export declare const moveRow: (state: EditorState, originRowIndex: number | number[], targetRowIndex: number, options?: MoveOptions) => (tr: Transaction) => Transaction;
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
direction: number;
|
|
4
|
-
}): 'start' | 'end';
|
|
1
|
+
import type { MoveOptions } from '../types';
|
|
2
|
+
export declare function normalizeDirection(origin: number, target: number, options?: MoveOptions): 'start' | 'end';
|
|
@@ -27,7 +27,7 @@ export { normalizeSelection } from './utils/normalize-selection';
|
|
|
27
27
|
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos, } from './utils/remove-column';
|
|
28
28
|
export { removeRowAt, removeSelectedRows, removeRowClosestToPos, } from './utils/remove-row';
|
|
29
29
|
export { removeTable } from './utils/remove-table';
|
|
30
|
-
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, } from './utils/select-nodes';
|
|
30
|
+
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos, } from './utils/select-nodes';
|
|
31
31
|
export { selectionCell } from './utils/selection-cell';
|
|
32
32
|
export { selectedRect } from './utils/selection-rect';
|
|
33
33
|
export type { SelectionRect } from './utils/selection-rect';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-tables",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"description": "A package that contains common classes and utility functions for editor tables",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
"atlaskit:src": "src/index.ts",
|
|
25
25
|
"atlassian": {
|
|
26
26
|
"team": "Editor: Jenga",
|
|
27
|
-
"deprecatedAutoEntryPoints": true,
|
|
28
27
|
"singleton": true,
|
|
29
28
|
"releaseModel": "continuous"
|
|
30
29
|
},
|
|
@@ -62,5 +61,14 @@
|
|
|
62
61
|
"platform.editor.table-shift-click-selection-backward": {
|
|
63
62
|
"type": "boolean"
|
|
64
63
|
}
|
|
64
|
+
},
|
|
65
|
+
"af:exports": {
|
|
66
|
+
".": "./src/index.ts",
|
|
67
|
+
"./cell-bookmark": "./src/cell-bookmark.ts",
|
|
68
|
+
"./cell-selection": "./src/cell-selection.ts",
|
|
69
|
+
"./pm-plugins": "./src/pm-plugins.ts",
|
|
70
|
+
"./table-map": "./src/table-map.ts",
|
|
71
|
+
"./types": "./src/types.ts",
|
|
72
|
+
"./utils": "./src/utils.ts"
|
|
65
73
|
}
|
|
66
74
|
}
|