@atlaskit/editor-tables 2.6.0 → 2.6.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/pm-plugins/input.js +2 -2
- package/dist/cjs/utils/select-nodes.js +38 -43
- package/dist/es2019/pm-plugins/input.js +2 -2
- package/dist/es2019/utils/select-nodes.js +38 -43
- package/dist/esm/pm-plugins/input.js +2 -2
- package/dist/esm/utils/select-nodes.js +38 -43
- package/package.json +1 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-tables
|
|
2
2
|
|
|
3
|
+
## 2.6.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#88717](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/88717) [`d92770eae702`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d92770eae702) - Adding internal eslint opt outs for a new rule `@atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop`.
|
|
8
|
+
|
|
9
|
+
## 2.6.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#86621](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/86621) [`819e262c9b0b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/819e262c9b0b) - remove table-shift-click-selection-backward feature flag
|
|
14
|
+
|
|
3
15
|
## 2.6.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -143,8 +143,7 @@ function handleMouseDown(view, event, dragAndDropEnabled) {
|
|
|
143
143
|
if (startEvent.shiftKey && view.state.selection instanceof _cellSelection.CellSelection) {
|
|
144
144
|
var isDragHandleElement;
|
|
145
145
|
var targetElement = event.target instanceof HTMLElement || event.target instanceof SVGElement ? event.target : null;
|
|
146
|
-
isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container');
|
|
147
|
-
// Adding to an existing cell selection
|
|
146
|
+
isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container, button.pm-table-drag-handle-button-clickable-zone');
|
|
148
147
|
if (dragAndDropEnabled && isDragHandleElement) {
|
|
149
148
|
return false;
|
|
150
149
|
}
|
|
@@ -210,6 +209,7 @@ function handleMouseDown(view, event, dragAndDropEnabled) {
|
|
|
210
209
|
}
|
|
211
210
|
}
|
|
212
211
|
view.root.addEventListener('mouseup', stop);
|
|
212
|
+
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
213
213
|
view.root.addEventListener('dragstart', stop);
|
|
214
214
|
view.root.addEventListener('mousemove', move);
|
|
215
215
|
return false;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.selectTableClosestToPos = exports.selectTable = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
10
9
|
var _cellSelection = require("../cell-selection");
|
|
11
10
|
var _tableMap = require("../table-map");
|
|
12
11
|
var _cloneTr = require("./clone-tr");
|
|
@@ -37,52 +36,48 @@ var select = function select(type) {
|
|
|
37
36
|
if (isRowSelection) {
|
|
38
37
|
top = Math.min(top, selRect.top);
|
|
39
38
|
bottom = Math.max(bottom, selRect.bottom);
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return (0, _cloneTr.cloneTr)(tr.setSelection(new _cellSelection.CellSelection(_$anchor, _$head)));
|
|
60
|
-
}
|
|
39
|
+
cellsInFirstRow = map.cellsInRect({
|
|
40
|
+
left: left,
|
|
41
|
+
top: top,
|
|
42
|
+
right: right,
|
|
43
|
+
bottom: top + 1
|
|
44
|
+
});
|
|
45
|
+
var targetRowCells = map.cellsInRect({
|
|
46
|
+
left: left,
|
|
47
|
+
top: index,
|
|
48
|
+
right: right,
|
|
49
|
+
bottom: index + 1
|
|
50
|
+
});
|
|
51
|
+
var isBackwardSelection = targetRowCells[0] < prevSelection.$head.pos - table.start;
|
|
52
|
+
if (isBackwardSelection && isPrevRowSelection) {
|
|
53
|
+
var _head = table.start + cellsInFirstRow[0];
|
|
54
|
+
var _anchor = prevSelection.$anchorCell.pos;
|
|
55
|
+
var _$head = tr.doc.resolve(_head);
|
|
56
|
+
var _$anchor = tr.doc.resolve(_anchor);
|
|
57
|
+
return (0, _cloneTr.cloneTr)(tr.setSelection(new _cellSelection.CellSelection(_$anchor, _$head)));
|
|
61
58
|
}
|
|
62
59
|
} else {
|
|
63
60
|
left = Math.min(left, selRect.left);
|
|
64
61
|
right = Math.max(right, selRect.right);
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
return (0, _cloneTr.cloneTr)(tr.setSelection(new _cellSelection.CellSelection(_$anchor2, _$head2)));
|
|
85
|
-
}
|
|
62
|
+
cellsInFirstRow = map.cellsInRect({
|
|
63
|
+
left: left,
|
|
64
|
+
top: top,
|
|
65
|
+
right: left + 1,
|
|
66
|
+
bottom: bottom
|
|
67
|
+
});
|
|
68
|
+
var _targetRowCells = map.cellsInRect({
|
|
69
|
+
left: index,
|
|
70
|
+
top: top,
|
|
71
|
+
right: index + 1,
|
|
72
|
+
bottom: bottom
|
|
73
|
+
});
|
|
74
|
+
var _isBackwardSelection = _targetRowCells[0] < prevSelection.$head.pos - table.start;
|
|
75
|
+
if (_isBackwardSelection && isPrevRowSelection) {
|
|
76
|
+
var _head2 = table.start + cellsInFirstRow[0];
|
|
77
|
+
var _anchor2 = prevSelection.$anchorCell.pos;
|
|
78
|
+
var _$head2 = tr.doc.resolve(_head2);
|
|
79
|
+
var _$anchor2 = tr.doc.resolve(_anchor2);
|
|
80
|
+
return (0, _cloneTr.cloneTr)(tr.setSelection(new _cellSelection.CellSelection(_$anchor2, _$head2)));
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
83
|
}
|
|
@@ -142,8 +142,7 @@ export function handleMouseDown(view, event, dragAndDropEnabled) {
|
|
|
142
142
|
if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
|
|
143
143
|
let isDragHandleElement;
|
|
144
144
|
const targetElement = event.target instanceof HTMLElement || event.target instanceof SVGElement ? event.target : null;
|
|
145
|
-
isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container');
|
|
146
|
-
// Adding to an existing cell selection
|
|
145
|
+
isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container, button.pm-table-drag-handle-button-clickable-zone');
|
|
147
146
|
if (dragAndDropEnabled && isDragHandleElement) {
|
|
148
147
|
return false;
|
|
149
148
|
}
|
|
@@ -209,6 +208,7 @@ export function handleMouseDown(view, event, dragAndDropEnabled) {
|
|
|
209
208
|
}
|
|
210
209
|
}
|
|
211
210
|
view.root.addEventListener('mouseup', stop);
|
|
211
|
+
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
212
212
|
view.root.addEventListener('dragstart', stop);
|
|
213
213
|
view.root.addEventListener('mousemove', move);
|
|
214
214
|
return false;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
2
1
|
import { CellSelection } from '../cell-selection';
|
|
3
2
|
import { TableMap } from '../table-map';
|
|
4
3
|
import { cloneTr } from './clone-tr';
|
|
@@ -27,52 +26,48 @@ const select = type => (index, expand) => tr => {
|
|
|
27
26
|
if (isRowSelection) {
|
|
28
27
|
top = Math.min(top, selRect.top);
|
|
29
28
|
bottom = Math.max(bottom, selRect.bottom);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return cloneTr(tr.setSelection(new CellSelection($anchor, $head)));
|
|
50
|
-
}
|
|
29
|
+
cellsInFirstRow = map.cellsInRect({
|
|
30
|
+
left,
|
|
31
|
+
top,
|
|
32
|
+
right,
|
|
33
|
+
bottom: top + 1
|
|
34
|
+
});
|
|
35
|
+
const targetRowCells = map.cellsInRect({
|
|
36
|
+
left,
|
|
37
|
+
top: index,
|
|
38
|
+
right,
|
|
39
|
+
bottom: index + 1
|
|
40
|
+
});
|
|
41
|
+
const isBackwardSelection = targetRowCells[0] < prevSelection.$head.pos - table.start;
|
|
42
|
+
if (isBackwardSelection && isPrevRowSelection) {
|
|
43
|
+
const head = table.start + cellsInFirstRow[0];
|
|
44
|
+
const anchor = prevSelection.$anchorCell.pos;
|
|
45
|
+
const $head = tr.doc.resolve(head);
|
|
46
|
+
const $anchor = tr.doc.resolve(anchor);
|
|
47
|
+
return cloneTr(tr.setSelection(new CellSelection($anchor, $head)));
|
|
51
48
|
}
|
|
52
49
|
} else {
|
|
53
50
|
left = Math.min(left, selRect.left);
|
|
54
51
|
right = Math.max(right, selRect.right);
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
return cloneTr(tr.setSelection(new CellSelection($anchor, $head)));
|
|
75
|
-
}
|
|
52
|
+
cellsInFirstRow = map.cellsInRect({
|
|
53
|
+
left,
|
|
54
|
+
top,
|
|
55
|
+
right: left + 1,
|
|
56
|
+
bottom
|
|
57
|
+
});
|
|
58
|
+
const targetRowCells = map.cellsInRect({
|
|
59
|
+
left: index,
|
|
60
|
+
top,
|
|
61
|
+
right: index + 1,
|
|
62
|
+
bottom
|
|
63
|
+
});
|
|
64
|
+
const isBackwardSelection = targetRowCells[0] < prevSelection.$head.pos - table.start;
|
|
65
|
+
if (isBackwardSelection && isPrevRowSelection) {
|
|
66
|
+
const head = table.start + cellsInFirstRow[0];
|
|
67
|
+
const anchor = prevSelection.$anchorCell.pos;
|
|
68
|
+
const $head = tr.doc.resolve(head);
|
|
69
|
+
const $anchor = tr.doc.resolve(anchor);
|
|
70
|
+
return cloneTr(tr.setSelection(new CellSelection($anchor, $head)));
|
|
76
71
|
}
|
|
77
72
|
}
|
|
78
73
|
}
|
|
@@ -135,8 +135,7 @@ export function handleMouseDown(view, event, dragAndDropEnabled) {
|
|
|
135
135
|
if (startEvent.shiftKey && view.state.selection instanceof CellSelection) {
|
|
136
136
|
var isDragHandleElement;
|
|
137
137
|
var targetElement = event.target instanceof HTMLElement || event.target instanceof SVGElement ? event.target : null;
|
|
138
|
-
isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container');
|
|
139
|
-
// Adding to an existing cell selection
|
|
138
|
+
isDragHandleElement = !!targetElement && !!targetElement.closest('button.pm-table-drag-handle-button-container, button.pm-table-drag-handle-button-clickable-zone');
|
|
140
139
|
if (dragAndDropEnabled && isDragHandleElement) {
|
|
141
140
|
return false;
|
|
142
141
|
}
|
|
@@ -202,6 +201,7 @@ export function handleMouseDown(view, event, dragAndDropEnabled) {
|
|
|
202
201
|
}
|
|
203
202
|
}
|
|
204
203
|
view.root.addEventListener('mouseup', stop);
|
|
204
|
+
// eslint-disable-next-line @atlaskit/design-system/no-direct-use-of-web-platform-drag-and-drop
|
|
205
205
|
view.root.addEventListener('dragstart', stop);
|
|
206
206
|
view.root.addEventListener('mousemove', move);
|
|
207
207
|
return false;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
3
2
|
import { CellSelection } from '../cell-selection';
|
|
4
3
|
import { TableMap } from '../table-map';
|
|
5
4
|
import { cloneTr } from './clone-tr';
|
|
@@ -30,52 +29,48 @@ var select = function select(type) {
|
|
|
30
29
|
if (isRowSelection) {
|
|
31
30
|
top = Math.min(top, selRect.top);
|
|
32
31
|
bottom = Math.max(bottom, selRect.bottom);
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
return cloneTr(tr.setSelection(new CellSelection(_$anchor, _$head)));
|
|
53
|
-
}
|
|
32
|
+
cellsInFirstRow = map.cellsInRect({
|
|
33
|
+
left: left,
|
|
34
|
+
top: top,
|
|
35
|
+
right: right,
|
|
36
|
+
bottom: top + 1
|
|
37
|
+
});
|
|
38
|
+
var targetRowCells = map.cellsInRect({
|
|
39
|
+
left: left,
|
|
40
|
+
top: index,
|
|
41
|
+
right: right,
|
|
42
|
+
bottom: index + 1
|
|
43
|
+
});
|
|
44
|
+
var isBackwardSelection = targetRowCells[0] < prevSelection.$head.pos - table.start;
|
|
45
|
+
if (isBackwardSelection && isPrevRowSelection) {
|
|
46
|
+
var _head = table.start + cellsInFirstRow[0];
|
|
47
|
+
var _anchor = prevSelection.$anchorCell.pos;
|
|
48
|
+
var _$head = tr.doc.resolve(_head);
|
|
49
|
+
var _$anchor = tr.doc.resolve(_anchor);
|
|
50
|
+
return cloneTr(tr.setSelection(new CellSelection(_$anchor, _$head)));
|
|
54
51
|
}
|
|
55
52
|
} else {
|
|
56
53
|
left = Math.min(left, selRect.left);
|
|
57
54
|
right = Math.max(right, selRect.right);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
return cloneTr(tr.setSelection(new CellSelection(_$anchor2, _$head2)));
|
|
78
|
-
}
|
|
55
|
+
cellsInFirstRow = map.cellsInRect({
|
|
56
|
+
left: left,
|
|
57
|
+
top: top,
|
|
58
|
+
right: left + 1,
|
|
59
|
+
bottom: bottom
|
|
60
|
+
});
|
|
61
|
+
var _targetRowCells = map.cellsInRect({
|
|
62
|
+
left: index,
|
|
63
|
+
top: top,
|
|
64
|
+
right: index + 1,
|
|
65
|
+
bottom: bottom
|
|
66
|
+
});
|
|
67
|
+
var _isBackwardSelection = _targetRowCells[0] < prevSelection.$head.pos - table.start;
|
|
68
|
+
if (_isBackwardSelection && isPrevRowSelection) {
|
|
69
|
+
var _head2 = table.start + cellsInFirstRow[0];
|
|
70
|
+
var _anchor2 = prevSelection.$anchorCell.pos;
|
|
71
|
+
var _$head2 = tr.doc.resolve(_head2);
|
|
72
|
+
var _$anchor2 = tr.doc.resolve(_anchor2);
|
|
73
|
+
return cloneTr(tr.setSelection(new CellSelection(_$anchor2, _$head2)));
|
|
79
74
|
}
|
|
80
75
|
}
|
|
81
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-tables",
|
|
3
|
-
"version": "2.6.
|
|
3
|
+
"version": "2.6.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/"
|
|
@@ -57,9 +57,6 @@
|
|
|
57
57
|
"platform-feature-flags": {
|
|
58
58
|
"platform.editor.custom-table-width": {
|
|
59
59
|
"type": "boolean"
|
|
60
|
-
},
|
|
61
|
-
"platform.editor.table-shift-click-selection-backward": {
|
|
62
|
-
"type": "boolean"
|
|
63
60
|
}
|
|
64
61
|
},
|
|
65
62
|
"af:exports": {
|