@atlaskit/editor-plugin-table 7.6.8 → 7.6.9
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
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-table
|
|
2
2
|
|
|
3
|
+
## 7.6.9
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#87069](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/87069) [`3c2cb323593e`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3c2cb323593e) - remove feature flag in-danger-hover-merged-cells-fix
|
|
8
|
+
|
|
3
9
|
## 7.6.8
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -13,7 +13,6 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
13
13
|
var _view = require("@atlaskit/editor-prosemirror/view");
|
|
14
14
|
var _tableMap = require("@atlaskit/editor-tables/table-map");
|
|
15
15
|
var _utils2 = require("@atlaskit/editor-tables/utils");
|
|
16
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
17
16
|
var _types = require("../types");
|
|
18
17
|
var _ColumnResizeWidget = require("../ui/ColumnResizeWidget");
|
|
19
18
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
@@ -71,51 +70,13 @@ var createControlsHoverDecoration = exports.createControlsHoverDecoration = func
|
|
|
71
70
|
// So If the table cells are in danger we want to create a "rectangle" selection
|
|
72
71
|
// to match the "clicked" selection
|
|
73
72
|
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
return x + _table.start;
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
if (danger) {
|
|
87
|
-
// Find the bounding rectangle of all the given cells, also considering
|
|
88
|
-
// merged cells.
|
|
89
|
-
var _cells$reduce3 = cells.reduce(function (acc, cell) {
|
|
90
|
-
var _map$findCell = map.findCell(cell.pos - table.start),
|
|
91
|
-
left = _map$findCell.left,
|
|
92
|
-
right = _map$findCell.right,
|
|
93
|
-
bottom = _map$findCell.bottom,
|
|
94
|
-
top = _map$findCell.top;
|
|
95
|
-
// Finding the bounding rect requires finding the min left and top positions,
|
|
96
|
-
// and the max right and bottom positions of the cells
|
|
97
|
-
return {
|
|
98
|
-
recLeft: Math.min(acc.recLeft, left),
|
|
99
|
-
recTop: Math.min(acc.recTop, top),
|
|
100
|
-
recRight: Math.max(acc.recRight, right),
|
|
101
|
-
recBottom: Math.max(acc.recBottom, bottom)
|
|
102
|
-
};
|
|
103
|
-
},
|
|
104
|
-
// +-Infinity as initialisation vars which will always be overwritten
|
|
105
|
-
// by smaller/larger values respectively
|
|
106
|
-
{
|
|
107
|
-
recLeft: Infinity,
|
|
108
|
-
recTop: Infinity,
|
|
109
|
-
recRight: -Infinity,
|
|
110
|
-
recBottom: -Infinity
|
|
111
|
-
}),
|
|
112
|
-
recLeft = _cells$reduce3.recLeft,
|
|
113
|
-
recTop = _cells$reduce3.recTop,
|
|
114
|
-
recRight = _cells$reduce3.recRight,
|
|
115
|
-
recBottom = _cells$reduce3.recBottom;
|
|
116
|
-
var _rect = new _tableMap.Rect(recLeft, recTop, recRight, recBottom);
|
|
117
|
-
updatedCells = map.cellsInRect(_rect).map(function (x) {
|
|
118
|
-
return x + table.start;
|
|
73
|
+
if (danger && type !== 'table') {
|
|
74
|
+
var selection = tr.selection;
|
|
75
|
+
var _table = (0, _utils2.findTable)(selection);
|
|
76
|
+
var rect = (0, _utils2.getSelectionRect)(selection);
|
|
77
|
+
if (_table && rect) {
|
|
78
|
+
updatedCells = map.cellsInRect(rect).map(function (x) {
|
|
79
|
+
return x + _table.start;
|
|
119
80
|
});
|
|
120
81
|
}
|
|
121
82
|
}
|
|
@@ -6,9 +6,8 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
|
6
6
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
7
7
|
|
|
8
8
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
9
|
-
import {
|
|
9
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
10
10
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
11
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
12
11
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
13
12
|
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
14
13
|
const filterDecorationByKey = (key, decorationSet) => decorationSet.find(undefined, undefined, spec => spec.key.indexOf(key) > -1);
|
|
@@ -44,51 +43,13 @@ export const createControlsHoverDecoration = (cells, type, tr, isDragAndDropEnab
|
|
|
44
43
|
// So If the table cells are in danger we want to create a "rectangle" selection
|
|
45
44
|
// to match the "clicked" selection
|
|
46
45
|
|
|
47
|
-
if (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (table && rect) {
|
|
55
|
-
updatedCells = map.cellsInRect(rect).map(x => x + table.start);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
} else {
|
|
59
|
-
if (danger) {
|
|
60
|
-
// Find the bounding rectangle of all the given cells, also considering
|
|
61
|
-
// merged cells.
|
|
62
|
-
const {
|
|
63
|
-
recLeft,
|
|
64
|
-
recTop,
|
|
65
|
-
recRight,
|
|
66
|
-
recBottom
|
|
67
|
-
} = cells.reduce((acc, cell) => {
|
|
68
|
-
const {
|
|
69
|
-
left,
|
|
70
|
-
right,
|
|
71
|
-
bottom,
|
|
72
|
-
top
|
|
73
|
-
} = map.findCell(cell.pos - table.start);
|
|
74
|
-
// Finding the bounding rect requires finding the min left and top positions,
|
|
75
|
-
// and the max right and bottom positions of the cells
|
|
76
|
-
return {
|
|
77
|
-
recLeft: Math.min(acc.recLeft, left),
|
|
78
|
-
recTop: Math.min(acc.recTop, top),
|
|
79
|
-
recRight: Math.max(acc.recRight, right),
|
|
80
|
-
recBottom: Math.max(acc.recBottom, bottom)
|
|
81
|
-
};
|
|
82
|
-
},
|
|
83
|
-
// +-Infinity as initialisation vars which will always be overwritten
|
|
84
|
-
// by smaller/larger values respectively
|
|
85
|
-
{
|
|
86
|
-
recLeft: Infinity,
|
|
87
|
-
recTop: Infinity,
|
|
88
|
-
recRight: -Infinity,
|
|
89
|
-
recBottom: -Infinity
|
|
90
|
-
});
|
|
91
|
-
const rect = new Rect(recLeft, recTop, recRight, recBottom);
|
|
46
|
+
if (danger && type !== 'table') {
|
|
47
|
+
const {
|
|
48
|
+
selection
|
|
49
|
+
} = tr;
|
|
50
|
+
const table = findTable(selection);
|
|
51
|
+
const rect = getSelectionRect(selection);
|
|
52
|
+
if (table && rect) {
|
|
92
53
|
updatedCells = map.cellsInRect(rect).map(x => x + table.start);
|
|
93
54
|
}
|
|
94
55
|
}
|
|
@@ -7,9 +7,8 @@ import { nonNullable } from '@atlaskit/editor-common/utils';
|
|
|
7
7
|
// @ts-ignore -- ReadonlyTransaction is a local declaration and will cause a TS2305 error in CCFE typecheck
|
|
8
8
|
|
|
9
9
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
10
|
-
import {
|
|
10
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
11
11
|
import { findTable, getCellsInRow, getSelectionRect } from '@atlaskit/editor-tables/utils';
|
|
12
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
13
12
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
14
13
|
import { ColumnResizeWidget } from '../ui/ColumnResizeWidget';
|
|
15
14
|
var filterDecorationByKey = function filterDecorationByKey(key, decorationSet) {
|
|
@@ -65,51 +64,13 @@ export var createControlsHoverDecoration = function createControlsHoverDecoratio
|
|
|
65
64
|
// So If the table cells are in danger we want to create a "rectangle" selection
|
|
66
65
|
// to match the "clicked" selection
|
|
67
66
|
|
|
68
|
-
if (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
return x + _table.start;
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
} else {
|
|
80
|
-
if (danger) {
|
|
81
|
-
// Find the bounding rectangle of all the given cells, also considering
|
|
82
|
-
// merged cells.
|
|
83
|
-
var _cells$reduce3 = cells.reduce(function (acc, cell) {
|
|
84
|
-
var _map$findCell = map.findCell(cell.pos - table.start),
|
|
85
|
-
left = _map$findCell.left,
|
|
86
|
-
right = _map$findCell.right,
|
|
87
|
-
bottom = _map$findCell.bottom,
|
|
88
|
-
top = _map$findCell.top;
|
|
89
|
-
// Finding the bounding rect requires finding the min left and top positions,
|
|
90
|
-
// and the max right and bottom positions of the cells
|
|
91
|
-
return {
|
|
92
|
-
recLeft: Math.min(acc.recLeft, left),
|
|
93
|
-
recTop: Math.min(acc.recTop, top),
|
|
94
|
-
recRight: Math.max(acc.recRight, right),
|
|
95
|
-
recBottom: Math.max(acc.recBottom, bottom)
|
|
96
|
-
};
|
|
97
|
-
},
|
|
98
|
-
// +-Infinity as initialisation vars which will always be overwritten
|
|
99
|
-
// by smaller/larger values respectively
|
|
100
|
-
{
|
|
101
|
-
recLeft: Infinity,
|
|
102
|
-
recTop: Infinity,
|
|
103
|
-
recRight: -Infinity,
|
|
104
|
-
recBottom: -Infinity
|
|
105
|
-
}),
|
|
106
|
-
recLeft = _cells$reduce3.recLeft,
|
|
107
|
-
recTop = _cells$reduce3.recTop,
|
|
108
|
-
recRight = _cells$reduce3.recRight,
|
|
109
|
-
recBottom = _cells$reduce3.recBottom;
|
|
110
|
-
var _rect = new Rect(recLeft, recTop, recRight, recBottom);
|
|
111
|
-
updatedCells = map.cellsInRect(_rect).map(function (x) {
|
|
112
|
-
return x + table.start;
|
|
67
|
+
if (danger && type !== 'table') {
|
|
68
|
+
var selection = tr.selection;
|
|
69
|
+
var _table = findTable(selection);
|
|
70
|
+
var rect = getSelectionRect(selection);
|
|
71
|
+
if (_table && rect) {
|
|
72
|
+
updatedCells = map.cellsInRect(rect).map(function (x) {
|
|
73
|
+
return x + _table.start;
|
|
113
74
|
});
|
|
114
75
|
}
|
|
115
76
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-table",
|
|
3
|
-
"version": "7.6.
|
|
3
|
+
"version": "7.6.9",
|
|
4
4
|
"description": "Table plugin for the @atlaskit/editor",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -129,9 +129,6 @@
|
|
|
129
129
|
"platform.editor.menu.group-items": {
|
|
130
130
|
"type": "boolean"
|
|
131
131
|
},
|
|
132
|
-
"platform.editor.table.in-danger-hover-merged-cells-fix": {
|
|
133
|
-
"type": "boolean"
|
|
134
|
-
},
|
|
135
132
|
"platform.editor.a11y-column-resizing_emcvz": {
|
|
136
133
|
"type": "boolean"
|
|
137
134
|
},
|
package/src/utils/decoration.ts
CHANGED
|
@@ -16,13 +16,12 @@ import type {
|
|
|
16
16
|
import type { ContentNodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
17
17
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
18
18
|
import { Decoration } from '@atlaskit/editor-prosemirror/view';
|
|
19
|
-
import {
|
|
19
|
+
import { TableMap } from '@atlaskit/editor-tables/table-map';
|
|
20
20
|
import {
|
|
21
21
|
findTable,
|
|
22
22
|
getCellsInRow,
|
|
23
23
|
getSelectionRect,
|
|
24
24
|
} from '@atlaskit/editor-tables/utils';
|
|
25
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
|
26
25
|
|
|
27
26
|
import type { Cell, CellColumnPositioning } from '../types';
|
|
28
27
|
import { TableCssClassName as ClassName, TableDecorations } from '../types';
|
|
@@ -102,44 +101,12 @@ export const createControlsHoverDecoration = (
|
|
|
102
101
|
// So If the table cells are in danger we want to create a "rectangle" selection
|
|
103
102
|
// to match the "clicked" selection
|
|
104
103
|
|
|
105
|
-
if (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
const rect = getSelectionRect(selection);
|
|
104
|
+
if (danger && type !== 'table') {
|
|
105
|
+
const { selection } = tr;
|
|
106
|
+
const table = findTable(selection);
|
|
107
|
+
const rect = getSelectionRect(selection);
|
|
110
108
|
|
|
111
|
-
|
|
112
|
-
updatedCells = map.cellsInRect(rect).map((x) => x + table.start);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
} else {
|
|
116
|
-
if (danger) {
|
|
117
|
-
// Find the bounding rectangle of all the given cells, also considering
|
|
118
|
-
// merged cells.
|
|
119
|
-
const { recLeft, recTop, recRight, recBottom } = cells.reduce(
|
|
120
|
-
(acc, cell) => {
|
|
121
|
-
const { left, right, bottom, top } = map.findCell(
|
|
122
|
-
cell.pos - table.start,
|
|
123
|
-
);
|
|
124
|
-
// Finding the bounding rect requires finding the min left and top positions,
|
|
125
|
-
// and the max right and bottom positions of the cells
|
|
126
|
-
return {
|
|
127
|
-
recLeft: Math.min(acc.recLeft, left),
|
|
128
|
-
recTop: Math.min(acc.recTop, top),
|
|
129
|
-
recRight: Math.max(acc.recRight, right),
|
|
130
|
-
recBottom: Math.max(acc.recBottom, bottom),
|
|
131
|
-
};
|
|
132
|
-
},
|
|
133
|
-
// +-Infinity as initialisation vars which will always be overwritten
|
|
134
|
-
// by smaller/larger values respectively
|
|
135
|
-
{
|
|
136
|
-
recLeft: Infinity,
|
|
137
|
-
recTop: Infinity,
|
|
138
|
-
recRight: -Infinity,
|
|
139
|
-
recBottom: -Infinity,
|
|
140
|
-
},
|
|
141
|
-
);
|
|
142
|
-
const rect = new Rect(recLeft, recTop, recRight, recBottom);
|
|
109
|
+
if (table && rect) {
|
|
143
110
|
updatedCells = map.cellsInRect(rect).map((x) => x + table.start);
|
|
144
111
|
}
|
|
145
112
|
}
|