@atlaskit/editor-tables 2.8.0 → 2.8.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 +17 -0
- package/afm-cc/tsconfig.json +1 -2
- package/afm-jira/tsconfig.json +19 -19
- package/afm-post-office/tsconfig.json +19 -19
- package/dist/cjs/cell-selection.js +8 -8
- package/dist/cjs/utils/add-column-at.js +2 -2
- package/dist/cjs/utils/add-column.js +2 -2
- package/dist/cjs/utils/add-row-at.js +2 -2
- package/dist/cjs/utils/add-row.js +2 -2
- package/dist/cjs/utils/fix-tables.js +8 -8
- package/dist/cjs/utils/handle-paste.js +3 -3
- package/dist/es2019/utils/add-column-at.js +2 -2
- package/dist/es2019/utils/add-column.js +2 -2
- package/dist/es2019/utils/add-row-at.js +2 -2
- package/dist/es2019/utils/add-row.js +2 -2
- package/dist/esm/cell-selection.js +8 -8
- package/dist/esm/utils/add-column-at.js +2 -2
- package/dist/esm/utils/add-column.js +2 -2
- package/dist/esm/utils/add-row-at.js +2 -2
- package/dist/esm/utils/add-row.js +2 -2
- package/dist/esm/utils/fix-tables.js +8 -8
- package/dist/esm/utils/handle-paste.js +3 -3
- package/dist/types/utils/add-column-at.d.ts +1 -1
- package/dist/types/utils/add-column.d.ts +1 -1
- package/dist/types/utils/add-row-at.d.ts +1 -1
- package/dist/types/utils/add-row.d.ts +1 -1
- package/dist/types-ts4.5/utils/add-column-at.d.ts +1 -1
- package/dist/types-ts4.5/utils/add-column.d.ts +1 -1
- package/dist/types-ts4.5/utils/add-row-at.d.ts +1 -1
- package/dist/types-ts4.5/utils/add-row.d.ts +1 -1
- package/package.json +3 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-tables
|
|
2
2
|
|
|
3
|
+
## 2.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#165001](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165001)
|
|
8
|
+
[`d77bdbfe892ed`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d77bdbfe892ed) -
|
|
9
|
+
tidy table duplicate cell color experiment
|
|
10
|
+
|
|
11
|
+
## 2.8.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#139334](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/139334)
|
|
16
|
+
[`30793649657c0`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/30793649657c0) -
|
|
17
|
+
[HOT-111629] We had an incident where the last character disappears when hitting the enter key on
|
|
18
|
+
windows OS for Korean characters. Bumping to prosemirror-view@1.34.2 for the fix.
|
|
19
|
+
|
|
3
20
|
## 2.8.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.jira.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../tsDist/@atlaskit__editor-tables/app",
|
|
7
|
+
"rootDir": "../",
|
|
8
|
+
"composite": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*"
|
|
18
|
+
],
|
|
19
|
+
"references": []
|
|
20
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
2
|
+
"extends": "../../../../tsconfig.entry-points.post-office.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"declaration": true,
|
|
5
|
+
"target": "es5",
|
|
6
|
+
"outDir": "../../../../../post-office/tsDist/@atlaskit__editor-tables/app",
|
|
7
|
+
"rootDir": "../",
|
|
8
|
+
"composite": true
|
|
9
|
+
},
|
|
10
|
+
"include": [
|
|
11
|
+
"../src/**/*.ts",
|
|
12
|
+
"../src/**/*.tsx"
|
|
13
|
+
],
|
|
14
|
+
"exclude": [
|
|
15
|
+
"../src/**/__tests__/*",
|
|
16
|
+
"../src/**/*.test.*",
|
|
17
|
+
"../src/**/test.*"
|
|
18
|
+
],
|
|
19
|
+
"references": []
|
|
20
|
+
}
|
|
@@ -21,7 +21,7 @@ var _getCellSelectionRanges = require("./utils/get-cell-selection-ranges");
|
|
|
21
21
|
var _tables = require("./utils/tables");
|
|
22
22
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
23
23
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
24
|
-
function _createSuper(
|
|
24
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
|
|
25
25
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } // Was copied from https://github.com/ProseMirror/prosemirror-tables/blob/master/src/cellselection.js
|
|
26
26
|
// This file defines a ProseMirror selection subclass that models
|
|
27
27
|
// table cell selections. The table plugin needs to be active to wire
|
|
@@ -91,13 +91,13 @@ var CellSelection = exports.CellSelection = /*#__PURE__*/function (_Selection) {
|
|
|
91
91
|
for (var row = rect.top; row < rect.bottom; row++) {
|
|
92
92
|
var rowContent = [];
|
|
93
93
|
for (var index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {
|
|
94
|
-
var
|
|
95
|
-
if (!seen[
|
|
96
|
-
seen[
|
|
97
|
-
var cellRect = map.findCell(
|
|
98
|
-
var cell = table.nodeAt(
|
|
94
|
+
var pos = map.map[index];
|
|
95
|
+
if (!seen[pos]) {
|
|
96
|
+
seen[pos] = true;
|
|
97
|
+
var cellRect = map.findCell(pos);
|
|
98
|
+
var cell = table.nodeAt(pos);
|
|
99
99
|
if (cell === null || cell === undefined) {
|
|
100
|
-
throw new Error("No cell at position ".concat(
|
|
100
|
+
throw new Error("No cell at position ".concat(pos));
|
|
101
101
|
}
|
|
102
102
|
var extraLeft = rect.left - cellRect.left;
|
|
103
103
|
var extraRight = cellRect.right - rect.right;
|
|
@@ -105,7 +105,7 @@ var CellSelection = exports.CellSelection = /*#__PURE__*/function (_Selection) {
|
|
|
105
105
|
var _cell = cell,
|
|
106
106
|
attrs = _cell.attrs;
|
|
107
107
|
if (!attrs) {
|
|
108
|
-
throw new Error("No cell at position ".concat(
|
|
108
|
+
throw new Error("No cell at position ".concat(pos));
|
|
109
109
|
}
|
|
110
110
|
if (extraLeft > 0) {
|
|
111
111
|
attrs = (0, _colspan.removeColSpan)(attrs, 0, extraLeft);
|
|
@@ -9,7 +9,7 @@ var _addColumn = require("./add-column");
|
|
|
9
9
|
var _cloneTr = require("./clone-tr");
|
|
10
10
|
var _find = require("./find");
|
|
11
11
|
// Returns a new transaction that adds a new column at index `columnIndex`.
|
|
12
|
-
var addColumnAt = exports.addColumnAt = function addColumnAt(columnIndex
|
|
12
|
+
var addColumnAt = exports.addColumnAt = function addColumnAt(columnIndex) {
|
|
13
13
|
return function (tr) {
|
|
14
14
|
var table = (0, _find.findTable)(tr.selection);
|
|
15
15
|
if (table) {
|
|
@@ -19,7 +19,7 @@ var addColumnAt = exports.addColumnAt = function addColumnAt(columnIndex, isCell
|
|
|
19
19
|
map: map,
|
|
20
20
|
tableStart: table.start,
|
|
21
21
|
table: table.node
|
|
22
|
-
}, columnIndex
|
|
22
|
+
}, columnIndex));
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
return tr;
|
|
@@ -19,7 +19,7 @@ function columnIsHeader(map, table, col) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
// Add a column at the given position in a table.
|
|
22
|
-
function addColumn(tr, _ref, col
|
|
22
|
+
function addColumn(tr, _ref, col) {
|
|
23
23
|
var map = _ref.map,
|
|
24
24
|
tableStart = _ref.tableStart,
|
|
25
25
|
table = _ref.table;
|
|
@@ -54,7 +54,7 @@ function addColumn(tr, _ref, col, isCellBackgroundDuplicated) {
|
|
|
54
54
|
throw new Error("addColumn: invalid node at mapped pos ".concat(mappedPos));
|
|
55
55
|
}
|
|
56
56
|
type = _cell.type;
|
|
57
|
-
if (_cell.attrs.background
|
|
57
|
+
if (_cell.attrs.background) {
|
|
58
58
|
attrs = {
|
|
59
59
|
background: _cell.attrs.background
|
|
60
60
|
};
|
|
@@ -88,7 +88,7 @@ var cloneRowAt = exports.cloneRowAt = function cloneRowAt(rowIndex) {
|
|
|
88
88
|
};
|
|
89
89
|
|
|
90
90
|
// Returns a new transaction that adds a new row at index `rowIndex`. Optionally clone the previous row.
|
|
91
|
-
var addRowAt = exports.addRowAt = function addRowAt(rowIndex, clonePreviousRow
|
|
91
|
+
var addRowAt = exports.addRowAt = function addRowAt(rowIndex, clonePreviousRow) {
|
|
92
92
|
return function (tr) {
|
|
93
93
|
var table = (0, _find.findTable)(tr.selection);
|
|
94
94
|
if (table) {
|
|
@@ -102,7 +102,7 @@ var addRowAt = exports.addRowAt = function addRowAt(rowIndex, clonePreviousRow,
|
|
|
102
102
|
map: map,
|
|
103
103
|
tableStart: table.start,
|
|
104
104
|
table: table.node
|
|
105
|
-
}, rowIndex
|
|
105
|
+
}, rowIndex));
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
return tr;
|
|
@@ -19,7 +19,7 @@ function rowIsHeader(map, table, row) {
|
|
|
19
19
|
}
|
|
20
20
|
return true;
|
|
21
21
|
}
|
|
22
|
-
function addRow(tr, _ref, row
|
|
22
|
+
function addRow(tr, _ref, row) {
|
|
23
23
|
var map = _ref.map,
|
|
24
24
|
tableStart = _ref.tableStart,
|
|
25
25
|
table = _ref.table;
|
|
@@ -57,7 +57,7 @@ function addRow(tr, _ref, row, isCellBackgroundDuplicated) {
|
|
|
57
57
|
throw new Error("addRow: invalid node at mapped pos ".concat(mappedPos));
|
|
58
58
|
}
|
|
59
59
|
type = cell.type;
|
|
60
|
-
if (cell.attrs.background
|
|
60
|
+
if (cell.attrs.background) {
|
|
61
61
|
_attrs = {
|
|
62
62
|
background: cell.attrs.background
|
|
63
63
|
};
|
|
@@ -21,22 +21,22 @@ function changedDescendants(old, cur, offsetStart, f) {
|
|
|
21
21
|
var oldSize = old.childCount;
|
|
22
22
|
var curSize = cur.childCount;
|
|
23
23
|
outer: for (var i = 0, j = 0; i < curSize; i++) {
|
|
24
|
-
var
|
|
24
|
+
var child = cur.child(i);
|
|
25
25
|
for (var scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {
|
|
26
|
-
if (old.child(scan) ===
|
|
26
|
+
if (old.child(scan) === child) {
|
|
27
27
|
j = scan + 1;
|
|
28
|
-
offset +=
|
|
28
|
+
offset += child.nodeSize;
|
|
29
29
|
// eslint-disable-next-line no-continue
|
|
30
30
|
continue outer;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
|
-
f(
|
|
34
|
-
if (j < oldSize && old.child(j).sameMarkup(
|
|
35
|
-
changedDescendants(old.child(j),
|
|
33
|
+
f(child, offset);
|
|
34
|
+
if (j < oldSize && old.child(j).sameMarkup(child)) {
|
|
35
|
+
changedDescendants(old.child(j), child, offset + 1, f);
|
|
36
36
|
} else {
|
|
37
|
-
|
|
37
|
+
child.nodesBetween(0, child.content.size, f, offset + 1);
|
|
38
38
|
}
|
|
39
|
-
offset +=
|
|
39
|
+
offset += child.nodeSize;
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -11,9 +11,9 @@ var _selectionCell = require("../utils/selection-cell");
|
|
|
11
11
|
var _tableNodeTypes = require("../utils/table-node-types");
|
|
12
12
|
var _tables = require("../utils/tables");
|
|
13
13
|
var _copyPaste = require("./copy-paste");
|
|
14
|
-
function _createForOfIteratorHelper(
|
|
15
|
-
function _unsupportedIterableToArray(
|
|
16
|
-
function _arrayLikeToArray(
|
|
14
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
15
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
16
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
17
17
|
function handlePaste(view, event, slice) {
|
|
18
18
|
if (!(0, _tables.isInTable)(view.state)) {
|
|
19
19
|
return false;
|
|
@@ -4,7 +4,7 @@ import { cloneTr } from './clone-tr';
|
|
|
4
4
|
import { findTable } from './find';
|
|
5
5
|
|
|
6
6
|
// Returns a new transaction that adds a new column at index `columnIndex`.
|
|
7
|
-
export const addColumnAt =
|
|
7
|
+
export const addColumnAt = columnIndex => tr => {
|
|
8
8
|
const table = findTable(tr.selection);
|
|
9
9
|
if (table) {
|
|
10
10
|
const map = TableMap.get(table.node);
|
|
@@ -13,7 +13,7 @@ export const addColumnAt = (columnIndex, isCellBackgroundDuplicated) => tr => {
|
|
|
13
13
|
map,
|
|
14
14
|
tableStart: table.start,
|
|
15
15
|
table: table.node
|
|
16
|
-
}, columnIndex
|
|
16
|
+
}, columnIndex));
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
return tr;
|
|
@@ -16,7 +16,7 @@ export function addColumn(tr, {
|
|
|
16
16
|
map,
|
|
17
17
|
tableStart,
|
|
18
18
|
table
|
|
19
|
-
}, col
|
|
19
|
+
}, col) {
|
|
20
20
|
let refColumn = col > 0 ? -1 : 0;
|
|
21
21
|
if (columnIsHeader(map, table, col + refColumn)) {
|
|
22
22
|
refColumn = col === 0 || col === map.width ? null : 0;
|
|
@@ -48,7 +48,7 @@ export function addColumn(tr, {
|
|
|
48
48
|
throw new Error(`addColumn: invalid node at mapped pos ${mappedPos}`);
|
|
49
49
|
}
|
|
50
50
|
type = cell.type;
|
|
51
|
-
if (cell.attrs.background
|
|
51
|
+
if (cell.attrs.background) {
|
|
52
52
|
attrs = {
|
|
53
53
|
background: cell.attrs.background
|
|
54
54
|
};
|
|
@@ -73,7 +73,7 @@ export const cloneRowAt = rowIndex => tr => {
|
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
// Returns a new transaction that adds a new row at index `rowIndex`. Optionally clone the previous row.
|
|
76
|
-
export const addRowAt = (rowIndex, clonePreviousRow
|
|
76
|
+
export const addRowAt = (rowIndex, clonePreviousRow) => tr => {
|
|
77
77
|
const table = findTable(tr.selection);
|
|
78
78
|
if (table) {
|
|
79
79
|
const map = TableMap.get(table.node);
|
|
@@ -86,7 +86,7 @@ export const addRowAt = (rowIndex, clonePreviousRow, isCellBackgroundDuplicated)
|
|
|
86
86
|
map,
|
|
87
87
|
tableStart: table.start,
|
|
88
88
|
table: table.node
|
|
89
|
-
}, rowIndex
|
|
89
|
+
}, rowIndex));
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
return tr;
|
|
@@ -13,7 +13,7 @@ export function addRow(tr, {
|
|
|
13
13
|
map,
|
|
14
14
|
tableStart,
|
|
15
15
|
table
|
|
16
|
-
}, row
|
|
16
|
+
}, row) {
|
|
17
17
|
let rowPos = tableStart;
|
|
18
18
|
for (let i = 0; i < row; i++) {
|
|
19
19
|
rowPos += table.child(i).nodeSize;
|
|
@@ -51,7 +51,7 @@ export function addRow(tr, {
|
|
|
51
51
|
throw new Error(`addRow: invalid node at mapped pos ${mappedPos}`);
|
|
52
52
|
}
|
|
53
53
|
type = cell.type;
|
|
54
|
-
if (cell.attrs.background
|
|
54
|
+
if (cell.attrs.background) {
|
|
55
55
|
attrs = {
|
|
56
56
|
background: cell.attrs.background
|
|
57
57
|
};
|
|
@@ -6,7 +6,7 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstruct
|
|
|
6
6
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
7
7
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
8
8
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
9
|
-
function _createSuper(
|
|
9
|
+
function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
|
|
10
10
|
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
11
|
// Was copied from https://github.com/ProseMirror/prosemirror-tables/blob/master/src/cellselection.js
|
|
12
12
|
|
|
@@ -88,13 +88,13 @@ export var CellSelection = /*#__PURE__*/function (_Selection) {
|
|
|
88
88
|
for (var row = rect.top; row < rect.bottom; row++) {
|
|
89
89
|
var rowContent = [];
|
|
90
90
|
for (var index = row * map.width + rect.left, col = rect.left; col < rect.right; col++, index++) {
|
|
91
|
-
var
|
|
92
|
-
if (!seen[
|
|
93
|
-
seen[
|
|
94
|
-
var cellRect = map.findCell(
|
|
95
|
-
var cell = table.nodeAt(
|
|
91
|
+
var pos = map.map[index];
|
|
92
|
+
if (!seen[pos]) {
|
|
93
|
+
seen[pos] = true;
|
|
94
|
+
var cellRect = map.findCell(pos);
|
|
95
|
+
var cell = table.nodeAt(pos);
|
|
96
96
|
if (cell === null || cell === undefined) {
|
|
97
|
-
throw new Error("No cell at position ".concat(
|
|
97
|
+
throw new Error("No cell at position ".concat(pos));
|
|
98
98
|
}
|
|
99
99
|
var extraLeft = rect.left - cellRect.left;
|
|
100
100
|
var extraRight = cellRect.right - rect.right;
|
|
@@ -102,7 +102,7 @@ export var CellSelection = /*#__PURE__*/function (_Selection) {
|
|
|
102
102
|
var _cell = cell,
|
|
103
103
|
attrs = _cell.attrs;
|
|
104
104
|
if (!attrs) {
|
|
105
|
-
throw new Error("No cell at position ".concat(
|
|
105
|
+
throw new Error("No cell at position ".concat(pos));
|
|
106
106
|
}
|
|
107
107
|
if (extraLeft > 0) {
|
|
108
108
|
attrs = removeColSpan(attrs, 0, extraLeft);
|
|
@@ -4,7 +4,7 @@ import { cloneTr } from './clone-tr';
|
|
|
4
4
|
import { findTable } from './find';
|
|
5
5
|
|
|
6
6
|
// Returns a new transaction that adds a new column at index `columnIndex`.
|
|
7
|
-
export var addColumnAt = function addColumnAt(columnIndex
|
|
7
|
+
export var addColumnAt = function addColumnAt(columnIndex) {
|
|
8
8
|
return function (tr) {
|
|
9
9
|
var table = findTable(tr.selection);
|
|
10
10
|
if (table) {
|
|
@@ -14,7 +14,7 @@ export var addColumnAt = function addColumnAt(columnIndex, isCellBackgroundDupli
|
|
|
14
14
|
map: map,
|
|
15
15
|
tableStart: table.start,
|
|
16
16
|
table: table.node
|
|
17
|
-
}, columnIndex
|
|
17
|
+
}, columnIndex));
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
return tr;
|
|
@@ -12,7 +12,7 @@ export function columnIsHeader(map, table, col) {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
// Add a column at the given position in a table.
|
|
15
|
-
export function addColumn(tr, _ref, col
|
|
15
|
+
export function addColumn(tr, _ref, col) {
|
|
16
16
|
var map = _ref.map,
|
|
17
17
|
tableStart = _ref.tableStart,
|
|
18
18
|
table = _ref.table;
|
|
@@ -47,7 +47,7 @@ export function addColumn(tr, _ref, col, isCellBackgroundDuplicated) {
|
|
|
47
47
|
throw new Error("addColumn: invalid node at mapped pos ".concat(mappedPos));
|
|
48
48
|
}
|
|
49
49
|
type = _cell.type;
|
|
50
|
-
if (_cell.attrs.background
|
|
50
|
+
if (_cell.attrs.background) {
|
|
51
51
|
attrs = {
|
|
52
52
|
background: _cell.attrs.background
|
|
53
53
|
};
|
|
@@ -81,7 +81,7 @@ export var cloneRowAt = function cloneRowAt(rowIndex) {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
// Returns a new transaction that adds a new row at index `rowIndex`. Optionally clone the previous row.
|
|
84
|
-
export var addRowAt = function addRowAt(rowIndex, clonePreviousRow
|
|
84
|
+
export var addRowAt = function addRowAt(rowIndex, clonePreviousRow) {
|
|
85
85
|
return function (tr) {
|
|
86
86
|
var table = findTable(tr.selection);
|
|
87
87
|
if (table) {
|
|
@@ -95,7 +95,7 @@ export var addRowAt = function addRowAt(rowIndex, clonePreviousRow, isCellBackgr
|
|
|
95
95
|
map: map,
|
|
96
96
|
tableStart: table.start,
|
|
97
97
|
table: table.node
|
|
98
|
-
}, rowIndex
|
|
98
|
+
}, rowIndex));
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
101
|
return tr;
|
|
@@ -12,7 +12,7 @@ function rowIsHeader(map, table, row) {
|
|
|
12
12
|
}
|
|
13
13
|
return true;
|
|
14
14
|
}
|
|
15
|
-
export function addRow(tr, _ref, row
|
|
15
|
+
export function addRow(tr, _ref, row) {
|
|
16
16
|
var map = _ref.map,
|
|
17
17
|
tableStart = _ref.tableStart,
|
|
18
18
|
table = _ref.table;
|
|
@@ -50,7 +50,7 @@ export function addRow(tr, _ref, row, isCellBackgroundDuplicated) {
|
|
|
50
50
|
throw new Error("addRow: invalid node at mapped pos ".concat(mappedPos));
|
|
51
51
|
}
|
|
52
52
|
type = cell.type;
|
|
53
|
-
if (cell.attrs.background
|
|
53
|
+
if (cell.attrs.background) {
|
|
54
54
|
_attrs = {
|
|
55
55
|
background: cell.attrs.background
|
|
56
56
|
};
|
|
@@ -13,22 +13,22 @@ function changedDescendants(old, cur, offsetStart, f) {
|
|
|
13
13
|
var oldSize = old.childCount;
|
|
14
14
|
var curSize = cur.childCount;
|
|
15
15
|
outer: for (var i = 0, j = 0; i < curSize; i++) {
|
|
16
|
-
var
|
|
16
|
+
var child = cur.child(i);
|
|
17
17
|
for (var scan = j, e = Math.min(oldSize, i + 3); scan < e; scan++) {
|
|
18
|
-
if (old.child(scan) ===
|
|
18
|
+
if (old.child(scan) === child) {
|
|
19
19
|
j = scan + 1;
|
|
20
|
-
offset +=
|
|
20
|
+
offset += child.nodeSize;
|
|
21
21
|
// eslint-disable-next-line no-continue
|
|
22
22
|
continue outer;
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
|
-
f(
|
|
26
|
-
if (j < oldSize && old.child(j).sameMarkup(
|
|
27
|
-
changedDescendants(old.child(j),
|
|
25
|
+
f(child, offset);
|
|
26
|
+
if (j < oldSize && old.child(j).sameMarkup(child)) {
|
|
27
|
+
changedDescendants(old.child(j), child, offset + 1, f);
|
|
28
28
|
} else {
|
|
29
|
-
|
|
29
|
+
child.nodesBetween(0, child.content.size, f, offset + 1);
|
|
30
30
|
}
|
|
31
|
-
offset +=
|
|
31
|
+
offset += child.nodeSize;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function _createForOfIteratorHelper(
|
|
2
|
-
function _unsupportedIterableToArray(
|
|
3
|
-
function _arrayLikeToArray(
|
|
1
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
2
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
3
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
4
4
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { CellSelection } from '../cell-selection';
|
|
6
6
|
import { TableMap } from '../table-map';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
export declare const addColumnAt: (columnIndex: number
|
|
2
|
+
export declare const addColumnAt: (columnIndex: number) => (tr: Transaction) => Transaction;
|
|
@@ -2,4 +2,4 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { TableContext, TableMap } from '../table-map';
|
|
4
4
|
export declare function columnIsHeader(map: TableMap, table: PMNode, col: number): boolean;
|
|
5
|
-
export declare function addColumn(tr: Transaction, { map, tableStart, table }: TableContext, col: number
|
|
5
|
+
export declare function addColumn(tr: Transaction, { map, tableStart, table }: TableContext, col: number): Transaction;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
export declare const cloneRowAt: (rowIndex: number) => (tr: Transaction) => Transaction;
|
|
3
|
-
export declare const addRowAt: (rowIndex: number, clonePreviousRow?: boolean
|
|
3
|
+
export declare const addRowAt: (rowIndex: number, clonePreviousRow?: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { TableContext } from '../table-map';
|
|
3
|
-
export declare function addRow(tr: Transaction, { map, tableStart, table }: TableContext, row: number
|
|
3
|
+
export declare function addRow(tr: Transaction, { map, tableStart, table }: TableContext, row: number): Transaction;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
-
export declare const addColumnAt: (columnIndex: number
|
|
2
|
+
export declare const addColumnAt: (columnIndex: number) => (tr: Transaction) => Transaction;
|
|
@@ -2,4 +2,4 @@ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { TableContext, TableMap } from '../table-map';
|
|
4
4
|
export declare function columnIsHeader(map: TableMap, table: PMNode, col: number): boolean;
|
|
5
|
-
export declare function addColumn(tr: Transaction, { map, tableStart, table }: TableContext, col: number
|
|
5
|
+
export declare function addColumn(tr: Transaction, { map, tableStart, table }: TableContext, col: number): Transaction;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
export declare const cloneRowAt: (rowIndex: number) => (tr: Transaction) => Transaction;
|
|
3
|
-
export declare const addRowAt: (rowIndex: number, clonePreviousRow?: boolean
|
|
3
|
+
export declare const addRowAt: (rowIndex: number, clonePreviousRow?: boolean) => (tr: Transaction) => Transaction;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import type { TableContext } from '../table-map';
|
|
3
|
-
export declare function addRow(tr: Transaction, { map, tableStart, table }: TableContext, row: number
|
|
3
|
+
export declare function addRow(tr: Transaction, { map, tableStart, table }: TableContext, row: number): Transaction;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-tables",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.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,11 +24,10 @@
|
|
|
24
24
|
"atlaskit:src": "src/index.ts",
|
|
25
25
|
"atlassian": {
|
|
26
26
|
"team": "Editor: Jenga",
|
|
27
|
-
"singleton": true
|
|
28
|
-
"releaseModel": "continuous"
|
|
27
|
+
"singleton": true
|
|
29
28
|
},
|
|
30
29
|
"dependencies": {
|
|
31
|
-
"@atlaskit/editor-prosemirror": "
|
|
30
|
+
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
32
31
|
"@babel/runtime": "^7.0.0"
|
|
33
32
|
},
|
|
34
33
|
"techstack": {
|