@atlaskit/editor-tables 2.9.22 → 2.9.24
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 +13 -0
- package/afm-cc/tsconfig.json +1 -1
- package/afm-jira/tsconfig.json +1 -1
- package/afm-products/tsconfig.json +1 -1
- package/dist/cjs/utils/select-nodes.js +24 -2
- package/dist/cjs/utils.js +6 -0
- package/dist/es2019/utils/select-nodes.js +23 -0
- package/dist/es2019/utils.js +1 -1
- package/dist/esm/utils/select-nodes.js +23 -1
- package/dist/esm/utils.js +1 -1
- package/dist/types/utils/select-nodes.d.ts +2 -0
- package/dist/types/utils.d.ts +1 -1
- package/dist/types-ts4.5/utils/select-nodes.d.ts +2 -0
- package/dist/types-ts4.5/utils.d.ts +1 -1
- package/package.json +5 -2
- package/build/tsconfig.json +0 -23
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @atlaskit/editor-tables
|
|
2
2
|
|
|
3
|
+
## 2.9.24
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.9.23
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`eb7609ee331ab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/eb7609ee331ab) -
|
|
14
|
+
[ux] EDITOR-4264 Fix preserved selection mapping
|
|
15
|
+
|
|
3
16
|
## 2.9.22
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/afm-cc/tsconfig.json
CHANGED
package/afm-jira/tsconfig.json
CHANGED
|
@@ -4,8 +4,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.selectTableClosestToPos = exports.selectTable = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = void 0;
|
|
7
|
+
exports.selectTableClosestToPos = exports.selectTable = exports.selectRows = exports.selectRow = exports.selectColumns = exports.selectColumn = exports.getTableSelectionClosesToPos = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
10
|
var _cellSelection = require("../cell-selection");
|
|
10
11
|
var _tableMap = require("../table-map");
|
|
11
12
|
var _cloneTr = require("./clone-tr");
|
|
@@ -166,11 +167,32 @@ var selectTable = exports.selectTable = function selectTable(tr) {
|
|
|
166
167
|
}
|
|
167
168
|
return tr;
|
|
168
169
|
};
|
|
169
|
-
var
|
|
170
|
+
var getTableSelectionClosesToPos = exports.getTableSelectionClosesToPos = function getTableSelectionClosesToPos($pos) {
|
|
170
171
|
var table = (0, _find.findTableClosestToPos)($pos);
|
|
171
172
|
if (table) {
|
|
172
173
|
var _TableMap$get2 = _tableMap.TableMap.get(table.node),
|
|
173
174
|
map = _TableMap$get2.map;
|
|
175
|
+
if (map && map.length) {
|
|
176
|
+
var head = table.start + map[0];
|
|
177
|
+
var anchor = table.start + map[map.length - 1];
|
|
178
|
+
var $head = $pos.doc.resolve(head);
|
|
179
|
+
var $anchor = $pos.doc.resolve(anchor);
|
|
180
|
+
return new _cellSelection.CellSelection($anchor, $head);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
var selectTableClosestToPos = exports.selectTableClosestToPos = function selectTableClosestToPos(tr, $pos) {
|
|
185
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_block_menu', 'isEnabled', true)) {
|
|
186
|
+
var tableSelection = getTableSelectionClosesToPos($pos);
|
|
187
|
+
if (tableSelection) {
|
|
188
|
+
return (0, _cloneTr.cloneTr)(tr.setSelection(tableSelection));
|
|
189
|
+
}
|
|
190
|
+
return tr;
|
|
191
|
+
}
|
|
192
|
+
var table = (0, _find.findTableClosestToPos)($pos);
|
|
193
|
+
if (table) {
|
|
194
|
+
var _TableMap$get3 = _tableMap.TableMap.get(table.node),
|
|
195
|
+
map = _TableMap$get3.map;
|
|
174
196
|
if (map && map.length) {
|
|
175
197
|
var head = table.start + map[0];
|
|
176
198
|
var anchor = table.start + map[map.length - 1];
|
package/dist/cjs/utils.js
CHANGED
|
@@ -201,6 +201,12 @@ Object.defineProperty(exports, "getSelectionRect", {
|
|
|
201
201
|
return _getSelectionRect.getSelectionRect;
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
|
+
Object.defineProperty(exports, "getTableSelectionClosesToPos", {
|
|
205
|
+
enumerable: true,
|
|
206
|
+
get: function get() {
|
|
207
|
+
return _selectNodes.getTableSelectionClosesToPos;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
204
210
|
Object.defineProperty(exports, "goToNextCell", {
|
|
205
211
|
enumerable: true,
|
|
206
212
|
get: function get() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
1
2
|
import { CellSelection } from '../cell-selection';
|
|
2
3
|
import { TableMap } from '../table-map';
|
|
3
4
|
import { cloneTr } from './clone-tr';
|
|
@@ -151,7 +152,29 @@ export const selectTable = tr => {
|
|
|
151
152
|
}
|
|
152
153
|
return tr;
|
|
153
154
|
};
|
|
155
|
+
export const getTableSelectionClosesToPos = $pos => {
|
|
156
|
+
const table = findTableClosestToPos($pos);
|
|
157
|
+
if (table) {
|
|
158
|
+
const {
|
|
159
|
+
map
|
|
160
|
+
} = TableMap.get(table.node);
|
|
161
|
+
if (map && map.length) {
|
|
162
|
+
const head = table.start + map[0];
|
|
163
|
+
const anchor = table.start + map[map.length - 1];
|
|
164
|
+
const $head = $pos.doc.resolve(head);
|
|
165
|
+
const $anchor = $pos.doc.resolve(anchor);
|
|
166
|
+
return new CellSelection($anchor, $head);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
};
|
|
154
170
|
export const selectTableClosestToPos = (tr, $pos) => {
|
|
171
|
+
if (expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
|
|
172
|
+
const tableSelection = getTableSelectionClosesToPos($pos);
|
|
173
|
+
if (tableSelection) {
|
|
174
|
+
return cloneTr(tr.setSelection(tableSelection));
|
|
175
|
+
}
|
|
176
|
+
return tr;
|
|
177
|
+
}
|
|
155
178
|
const table = findTableClosestToPos($pos);
|
|
156
179
|
if (table) {
|
|
157
180
|
const {
|
package/dist/es2019/utils.js
CHANGED
|
@@ -32,7 +32,7 @@ export { normalizeSelection } from './utils/normalize-selection';
|
|
|
32
32
|
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos } from './utils/remove-column';
|
|
33
33
|
export { removeRowAt, removeSelectedRows, removeRowClosestToPos } from './utils/remove-row';
|
|
34
34
|
export { removeTable } from './utils/remove-table';
|
|
35
|
-
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos } from './utils/select-nodes';
|
|
35
|
+
export { getTableSelectionClosesToPos, selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos } from './utils/select-nodes';
|
|
36
36
|
export { selectionCell } from './utils/selection-cell';
|
|
37
37
|
export { selectedRect } from './utils/selection-rect';
|
|
38
38
|
export { setCellAttrs } from './utils/set-cell-attrs';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
2
3
|
import { CellSelection } from '../cell-selection';
|
|
3
4
|
import { TableMap } from '../table-map';
|
|
4
5
|
import { cloneTr } from './clone-tr';
|
|
@@ -159,11 +160,32 @@ export var selectTable = function selectTable(tr) {
|
|
|
159
160
|
}
|
|
160
161
|
return tr;
|
|
161
162
|
};
|
|
162
|
-
export var
|
|
163
|
+
export var getTableSelectionClosesToPos = function getTableSelectionClosesToPos($pos) {
|
|
163
164
|
var table = findTableClosestToPos($pos);
|
|
164
165
|
if (table) {
|
|
165
166
|
var _TableMap$get2 = TableMap.get(table.node),
|
|
166
167
|
map = _TableMap$get2.map;
|
|
168
|
+
if (map && map.length) {
|
|
169
|
+
var head = table.start + map[0];
|
|
170
|
+
var anchor = table.start + map[map.length - 1];
|
|
171
|
+
var $head = $pos.doc.resolve(head);
|
|
172
|
+
var $anchor = $pos.doc.resolve(anchor);
|
|
173
|
+
return new CellSelection($anchor, $head);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
export var selectTableClosestToPos = function selectTableClosestToPos(tr, $pos) {
|
|
178
|
+
if (expValEquals('platform_editor_block_menu', 'isEnabled', true)) {
|
|
179
|
+
var tableSelection = getTableSelectionClosesToPos($pos);
|
|
180
|
+
if (tableSelection) {
|
|
181
|
+
return cloneTr(tr.setSelection(tableSelection));
|
|
182
|
+
}
|
|
183
|
+
return tr;
|
|
184
|
+
}
|
|
185
|
+
var table = findTableClosestToPos($pos);
|
|
186
|
+
if (table) {
|
|
187
|
+
var _TableMap$get3 = TableMap.get(table.node),
|
|
188
|
+
map = _TableMap$get3.map;
|
|
167
189
|
if (map && map.length) {
|
|
168
190
|
var head = table.start + map[0];
|
|
169
191
|
var anchor = table.start + map[map.length - 1];
|
package/dist/esm/utils.js
CHANGED
|
@@ -32,7 +32,7 @@ export { normalizeSelection } from './utils/normalize-selection';
|
|
|
32
32
|
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos } from './utils/remove-column';
|
|
33
33
|
export { removeRowAt, removeSelectedRows, removeRowClosestToPos } from './utils/remove-row';
|
|
34
34
|
export { removeTable } from './utils/remove-table';
|
|
35
|
-
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos } from './utils/select-nodes';
|
|
35
|
+
export { getTableSelectionClosesToPos, selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos } from './utils/select-nodes';
|
|
36
36
|
export { selectionCell } from './utils/selection-cell';
|
|
37
37
|
export { selectedRect } from './utils/selection-rect';
|
|
38
38
|
export { setCellAttrs } from './utils/set-cell-attrs';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { CellSelection } from '../cell-selection';
|
|
3
4
|
export declare const selectColumn: (index: number, expand?: boolean) => (tr: Transaction) => Transaction;
|
|
4
5
|
export declare const selectRow: (index: number, expand?: boolean) => (tr: Transaction) => Transaction;
|
|
5
6
|
export declare const selectRows: (indexes: number[]) => (tr: Transaction) => Transaction;
|
|
6
7
|
export declare const selectColumns: (indexes: number[]) => (tr: Transaction) => Transaction;
|
|
7
8
|
export declare const selectTable: (tr: Transaction) => Transaction;
|
|
9
|
+
export declare const getTableSelectionClosesToPos: ($pos: ResolvedPos) => CellSelection | undefined;
|
|
8
10
|
export declare const selectTableClosestToPos: (tr: Transaction, $pos: ResolvedPos) => Transaction;
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export { normalizeSelection } from './utils/normalize-selection';
|
|
|
29
29
|
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos, } from './utils/remove-column';
|
|
30
30
|
export { removeRowAt, removeSelectedRows, removeRowClosestToPos } from './utils/remove-row';
|
|
31
31
|
export { removeTable } from './utils/remove-table';
|
|
32
|
-
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos, } from './utils/select-nodes';
|
|
32
|
+
export { getTableSelectionClosesToPos, selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos, } from './utils/select-nodes';
|
|
33
33
|
export { selectionCell } from './utils/selection-cell';
|
|
34
34
|
export { selectedRect } from './utils/selection-rect';
|
|
35
35
|
export type { SelectionRect } from './utils/selection-rect';
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import type { ResolvedPos } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { CellSelection } from '../cell-selection';
|
|
3
4
|
export declare const selectColumn: (index: number, expand?: boolean) => (tr: Transaction) => Transaction;
|
|
4
5
|
export declare const selectRow: (index: number, expand?: boolean) => (tr: Transaction) => Transaction;
|
|
5
6
|
export declare const selectRows: (indexes: number[]) => (tr: Transaction) => Transaction;
|
|
6
7
|
export declare const selectColumns: (indexes: number[]) => (tr: Transaction) => Transaction;
|
|
7
8
|
export declare const selectTable: (tr: Transaction) => Transaction;
|
|
9
|
+
export declare const getTableSelectionClosesToPos: ($pos: ResolvedPos) => CellSelection | undefined;
|
|
8
10
|
export declare const selectTableClosestToPos: (tr: Transaction, $pos: ResolvedPos) => Transaction;
|
|
@@ -29,7 +29,7 @@ export { normalizeSelection } from './utils/normalize-selection';
|
|
|
29
29
|
export { removeColumnAt, removeSelectedColumns, removeColumnClosestToPos, } from './utils/remove-column';
|
|
30
30
|
export { removeRowAt, removeSelectedRows, removeRowClosestToPos } from './utils/remove-row';
|
|
31
31
|
export { removeTable } from './utils/remove-table';
|
|
32
|
-
export { selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos, } from './utils/select-nodes';
|
|
32
|
+
export { getTableSelectionClosesToPos, selectColumn, selectColumns, selectRow, selectRows, selectTable, selectTableClosestToPos, } from './utils/select-nodes';
|
|
33
33
|
export { selectionCell } from './utils/selection-cell';
|
|
34
34
|
export { selectedRect } from './utils/selection-rect';
|
|
35
35
|
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.9.
|
|
3
|
+
"version": "2.9.24",
|
|
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/"
|
|
@@ -29,9 +29,12 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@atlaskit/editor-prosemirror": "^7.2.0",
|
|
31
31
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
32
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
32
|
+
"@atlaskit/tmp-editor-statsig": "^17.0.0",
|
|
33
33
|
"@babel/runtime": "^7.0.0"
|
|
34
34
|
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@atlassian/a11y-jest-testing": "^0.8.0"
|
|
37
|
+
},
|
|
35
38
|
"techstack": {
|
|
36
39
|
"@atlassian/frontend": {
|
|
37
40
|
"circular-dependencies": [
|
package/build/tsconfig.json
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"declaration": true,
|
|
5
|
-
"target": "es5",
|
|
6
|
-
"paths": {}
|
|
7
|
-
},
|
|
8
|
-
"include": [
|
|
9
|
-
"../src/**/*.ts",
|
|
10
|
-
"../src/**/*.tsx"
|
|
11
|
-
],
|
|
12
|
-
"exclude": [
|
|
13
|
-
"../src/**/__tests__/*",
|
|
14
|
-
"../src/**/*.test.*",
|
|
15
|
-
"../src/**/test.*",
|
|
16
|
-
"../src/**/examples.*",
|
|
17
|
-
"../src/**/examples/*",
|
|
18
|
-
"../src/**/examples/**/*",
|
|
19
|
-
"../src/**/*.stories.*",
|
|
20
|
-
"../src/**/stories/*",
|
|
21
|
-
"../src/**/stories/**/*"
|
|
22
|
-
]
|
|
23
|
-
}
|