@atlaskit/editor-tables 3.0.10 → 3.0.11
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 +8 -0
- package/dist/cjs/utils/find.js +5 -5
- package/dist/cjs/utils/normalize-selection.js +4 -3
- package/dist/es2019/utils/find.js +5 -4
- package/dist/es2019/utils/normalize-selection.js +5 -3
- package/dist/esm/utils/find.js +5 -5
- package/dist/esm/utils/normalize-selection.js +5 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-tables
|
|
2
2
|
|
|
3
|
+
## 3.0.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`346f91cfe1997`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/346f91cfe1997) -
|
|
8
|
+
Clean up prefer static regex violations
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 3.0.10
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/utils/find.js
CHANGED
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.findTableClosestToPos = exports.findTable = exports.findCellRectClosestToPos = exports.findCellClosestToPos = void 0;
|
|
7
7
|
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
8
|
var _tableMap = require("../table-map");
|
|
9
|
+
// Ignored via go/ees005
|
|
10
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
11
|
+
var CELL_ROLE_REGEX = /cell/i;
|
|
12
|
+
|
|
9
13
|
// Iterates over parent nodes, returning the closest table node.
|
|
10
14
|
var findTable = exports.findTable = function findTable(selection) {
|
|
11
15
|
return (0, _utils.findParentNode)(function (node) {
|
|
@@ -24,11 +28,7 @@ var findTableClosestToPos = exports.findTableClosestToPos = function findTableCl
|
|
|
24
28
|
// Iterates over parent nodes, returning a table cell or a table header node closest to a given `$pos`.
|
|
25
29
|
var findCellClosestToPos = exports.findCellClosestToPos = function findCellClosestToPos($pos) {
|
|
26
30
|
var predicate = function predicate(node) {
|
|
27
|
-
return (
|
|
28
|
-
// Ignored via go/ees005
|
|
29
|
-
// eslint-disable-next-line require-unicode-regexp
|
|
30
|
-
node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole)
|
|
31
|
-
);
|
|
31
|
+
return node.type.spec.tableRole && CELL_ROLE_REGEX.test(node.type.spec.tableRole);
|
|
32
32
|
};
|
|
33
33
|
return (0, _utils.findParentNodeClosestToPos)($pos, predicate);
|
|
34
34
|
};
|
|
@@ -7,6 +7,9 @@ exports.normalizeSelection = normalizeSelection;
|
|
|
7
7
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
8
|
var _cellSelection = require("../cell-selection");
|
|
9
9
|
var _tableMap = require("../table-map");
|
|
10
|
+
// Ignored via go/ees005
|
|
11
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
12
|
+
var ROW_OR_TABLE_ROLE_REGEX = /row|table/;
|
|
10
13
|
function normalizeSelection(state, transaction, allowTableNodeSelection) {
|
|
11
14
|
var tr = transaction;
|
|
12
15
|
var sel = (tr || state).selection;
|
|
@@ -58,9 +61,7 @@ function isCellBoundarySelection(_ref2) {
|
|
|
58
61
|
break;
|
|
59
62
|
}
|
|
60
63
|
}
|
|
61
|
-
|
|
62
|
-
// eslint-disable-next-line require-unicode-regexp
|
|
63
|
-
return afterFrom === beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole);
|
|
64
|
+
return afterFrom === beforeTo && ROW_OR_TABLE_ROLE_REGEX.test($from.node(depth).type.spec.tableRole);
|
|
64
65
|
}
|
|
65
66
|
function isTextSelectionAcrossSameTableCells(_ref3) {
|
|
66
67
|
var $from = _ref3.$from,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { findParentNode, findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
2
|
import { TableMap } from '../table-map';
|
|
3
|
+
// Ignored via go/ees005
|
|
4
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
5
|
+
const CELL_ROLE_REGEX = /cell/i;
|
|
6
|
+
|
|
3
7
|
// Iterates over parent nodes, returning the closest table node.
|
|
4
8
|
export const findTable = selection => findParentNode(node => node.type.spec.tableRole && node.type.spec.tableRole === 'table')(selection);
|
|
5
9
|
|
|
@@ -11,10 +15,7 @@ export const findTableClosestToPos = $pos => {
|
|
|
11
15
|
|
|
12
16
|
// Iterates over parent nodes, returning a table cell or a table header node closest to a given `$pos`.
|
|
13
17
|
export const findCellClosestToPos = $pos => {
|
|
14
|
-
const predicate = node =>
|
|
15
|
-
// Ignored via go/ees005
|
|
16
|
-
// eslint-disable-next-line require-unicode-regexp
|
|
17
|
-
node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole);
|
|
18
|
+
const predicate = node => node.type.spec.tableRole && CELL_ROLE_REGEX.test(node.type.spec.tableRole);
|
|
18
19
|
return findParentNodeClosestToPos($pos, predicate);
|
|
19
20
|
};
|
|
20
21
|
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { CellSelection } from '../cell-selection';
|
|
3
3
|
import { TableMap } from '../table-map';
|
|
4
|
+
|
|
5
|
+
// Ignored via go/ees005
|
|
6
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
7
|
+
const ROW_OR_TABLE_ROLE_REGEX = /row|table/;
|
|
4
8
|
export function normalizeSelection(state, transaction, allowTableNodeSelection) {
|
|
5
9
|
let tr = transaction;
|
|
6
10
|
const sel = (tr || state).selection;
|
|
@@ -56,9 +60,7 @@ function isCellBoundarySelection({
|
|
|
56
60
|
break;
|
|
57
61
|
}
|
|
58
62
|
}
|
|
59
|
-
|
|
60
|
-
// eslint-disable-next-line require-unicode-regexp
|
|
61
|
-
return afterFrom === beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole);
|
|
63
|
+
return afterFrom === beforeTo && ROW_OR_TABLE_ROLE_REGEX.test($from.node(depth).type.spec.tableRole);
|
|
62
64
|
}
|
|
63
65
|
function isTextSelectionAcrossSameTableCells({
|
|
64
66
|
$from,
|
package/dist/esm/utils/find.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { findParentNode, findParentNodeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
2
|
import { TableMap } from '../table-map';
|
|
3
|
+
// Ignored via go/ees005
|
|
4
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
5
|
+
var CELL_ROLE_REGEX = /cell/i;
|
|
6
|
+
|
|
3
7
|
// Iterates over parent nodes, returning the closest table node.
|
|
4
8
|
export var findTable = function findTable(selection) {
|
|
5
9
|
return findParentNode(function (node) {
|
|
@@ -18,11 +22,7 @@ export var findTableClosestToPos = function findTableClosestToPos($pos) {
|
|
|
18
22
|
// Iterates over parent nodes, returning a table cell or a table header node closest to a given `$pos`.
|
|
19
23
|
export var findCellClosestToPos = function findCellClosestToPos($pos) {
|
|
20
24
|
var predicate = function predicate(node) {
|
|
21
|
-
return (
|
|
22
|
-
// Ignored via go/ees005
|
|
23
|
-
// eslint-disable-next-line require-unicode-regexp
|
|
24
|
-
node.type.spec.tableRole && /cell/i.test(node.type.spec.tableRole)
|
|
25
|
-
);
|
|
25
|
+
return node.type.spec.tableRole && CELL_ROLE_REGEX.test(node.type.spec.tableRole);
|
|
26
26
|
};
|
|
27
27
|
return findParentNodeClosestToPos($pos, predicate);
|
|
28
28
|
};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { CellSelection } from '../cell-selection';
|
|
3
3
|
import { TableMap } from '../table-map';
|
|
4
|
+
|
|
5
|
+
// Ignored via go/ees005
|
|
6
|
+
// eslint-disable-next-line require-unicode-regexp
|
|
7
|
+
var ROW_OR_TABLE_ROLE_REGEX = /row|table/;
|
|
4
8
|
export function normalizeSelection(state, transaction, allowTableNodeSelection) {
|
|
5
9
|
var tr = transaction;
|
|
6
10
|
var sel = (tr || state).selection;
|
|
@@ -52,9 +56,7 @@ function isCellBoundarySelection(_ref2) {
|
|
|
52
56
|
break;
|
|
53
57
|
}
|
|
54
58
|
}
|
|
55
|
-
|
|
56
|
-
// eslint-disable-next-line require-unicode-regexp
|
|
57
|
-
return afterFrom === beforeTo && /row|table/.test($from.node(depth).type.spec.tableRole);
|
|
59
|
+
return afterFrom === beforeTo && ROW_OR_TABLE_ROLE_REGEX.test($from.node(depth).type.spec.tableRole);
|
|
58
60
|
}
|
|
59
61
|
function isTextSelectionAcrossSameTableCells(_ref3) {
|
|
60
62
|
var $from = _ref3.$from,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-tables",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.11",
|
|
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/"
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@atlaskit/editor-prosemirror": "^8.0.0",
|
|
23
23
|
"@atlaskit/platform-feature-flags": "^2.0.0",
|
|
24
|
-
"@atlaskit/tmp-editor-statsig": "^114.
|
|
24
|
+
"@atlaskit/tmp-editor-statsig": "^114.4.0",
|
|
25
25
|
"@babel/runtime": "^7.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|