@atlaskit/editor-tables 2.2.1 → 2.2.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 +7 -0
- package/dist/cjs/pm-plugins/input.js +3 -2
- package/dist/cjs/utils/select-nodes.js +23 -2
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/pm-plugins/input.js +3 -2
- package/dist/es2019/utils/select-nodes.js +20 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/pm-plugins/input.js +3 -2
- package/dist/esm/utils/select-nodes.js +19 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/utils/select-nodes.d.ts +2 -0
- package/package.json +1 -1
- package/report.api.md +16 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# @atlaskit/editor-tables
|
|
2
2
|
|
|
3
|
+
## 2.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`47f1f76cb80`](https://bitbucket.org/atlassian/atlassian-frontend/commits/47f1f76cb80) - Add selectTableClosestToPos function
|
|
8
|
+
- [`755d7bf5c2a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/755d7bf5c2a) - [ux] ED-12527 Prevents editor-tables handleMouseDown() from creating a cell selection when right clicking in a table cell.
|
|
9
|
+
|
|
3
10
|
## 2.2.1
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -160,9 +160,10 @@ function handleTripleClick(view, pos) {
|
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
function handleMouseDown(view, event) {
|
|
163
|
-
var startEvent = event;
|
|
163
|
+
var startEvent = event; // Prevent right clicks from making a cell selection https://product-fabric.atlassian.net/browse/ED-12527
|
|
164
164
|
|
|
165
|
-
if (startEvent.ctrlKey || startEvent.metaKey
|
|
165
|
+
if (startEvent.ctrlKey || startEvent.metaKey || startEvent.button === 2 // right mouse click
|
|
166
|
+
) {
|
|
166
167
|
return false;
|
|
167
168
|
}
|
|
168
169
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectTable = exports.selectRow = exports.selectColumn = void 0;
|
|
6
|
+
exports.selectTableClosestToPos = exports.selectTable = exports.selectRow = exports.selectColumn = void 0;
|
|
7
7
|
|
|
8
8
|
var _cellSelection = require("../cell-selection");
|
|
9
9
|
|
|
@@ -101,4 +101,25 @@ var selectTable = function selectTable(tr) {
|
|
|
101
101
|
return tr;
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
exports.selectTable = selectTable;
|
|
104
|
+
exports.selectTable = selectTable;
|
|
105
|
+
|
|
106
|
+
var selectTableClosestToPos = function selectTableClosestToPos(tr, $pos) {
|
|
107
|
+
var table = (0, _find.findTableClosestToPos)($pos);
|
|
108
|
+
|
|
109
|
+
if (table) {
|
|
110
|
+
var _TableMap$get2 = _tableMap.TableMap.get(table.node),
|
|
111
|
+
map = _TableMap$get2.map;
|
|
112
|
+
|
|
113
|
+
if (map && map.length) {
|
|
114
|
+
var head = table.start + map[0];
|
|
115
|
+
var anchor = table.start + map[map.length - 1];
|
|
116
|
+
var $head = tr.doc.resolve(head);
|
|
117
|
+
var $anchor = tr.doc.resolve(anchor);
|
|
118
|
+
return (0, _cloneTr.cloneTr)(tr.setSelection(new _cellSelection.CellSelection($anchor, $head)));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return tr;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
exports.selectTableClosestToPos = selectTableClosestToPos;
|
package/dist/cjs/version.json
CHANGED
|
@@ -145,9 +145,10 @@ export function handleTripleClick(view, pos) {
|
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
147
|
export function handleMouseDown(view, event) {
|
|
148
|
-
const startEvent = event;
|
|
148
|
+
const startEvent = event; // Prevent right clicks from making a cell selection https://product-fabric.atlassian.net/browse/ED-12527
|
|
149
149
|
|
|
150
|
-
if (startEvent.ctrlKey || startEvent.metaKey
|
|
150
|
+
if (startEvent.ctrlKey || startEvent.metaKey || startEvent.button === 2 // right mouse click
|
|
151
|
+
) {
|
|
151
152
|
return false;
|
|
152
153
|
}
|
|
153
154
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellSelection } from '../cell-selection';
|
|
2
2
|
import { TableMap } from '../table-map';
|
|
3
3
|
import { cloneTr } from './clone-tr';
|
|
4
|
-
import { findCellClosestToPos, findTable } from './find';
|
|
4
|
+
import { findCellClosestToPos, findTable, findTableClosestToPos } from './find';
|
|
5
5
|
|
|
6
6
|
const select = type => (index, expand) => tr => {
|
|
7
7
|
const table = findTable(tr.selection);
|
|
@@ -81,5 +81,24 @@ export const selectTable = tr => {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
return tr;
|
|
85
|
+
};
|
|
86
|
+
export const selectTableClosestToPos = (tr, $pos) => {
|
|
87
|
+
const table = findTableClosestToPos($pos);
|
|
88
|
+
|
|
89
|
+
if (table) {
|
|
90
|
+
const {
|
|
91
|
+
map
|
|
92
|
+
} = TableMap.get(table.node);
|
|
93
|
+
|
|
94
|
+
if (map && map.length) {
|
|
95
|
+
const head = table.start + map[0];
|
|
96
|
+
const anchor = table.start + map[map.length - 1];
|
|
97
|
+
const $head = tr.doc.resolve(head);
|
|
98
|
+
const $anchor = tr.doc.resolve(anchor);
|
|
99
|
+
return cloneTr(tr.setSelection(new CellSelection($anchor, $head)));
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
84
103
|
return tr;
|
|
85
104
|
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -141,9 +141,10 @@ export function handleTripleClick(view, pos) {
|
|
|
141
141
|
return true;
|
|
142
142
|
}
|
|
143
143
|
export function handleMouseDown(view, event) {
|
|
144
|
-
var startEvent = event;
|
|
144
|
+
var startEvent = event; // Prevent right clicks from making a cell selection https://product-fabric.atlassian.net/browse/ED-12527
|
|
145
145
|
|
|
146
|
-
if (startEvent.ctrlKey || startEvent.metaKey
|
|
146
|
+
if (startEvent.ctrlKey || startEvent.metaKey || startEvent.button === 2 // right mouse click
|
|
147
|
+
) {
|
|
147
148
|
return false;
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CellSelection } from '../cell-selection';
|
|
2
2
|
import { TableMap } from '../table-map';
|
|
3
3
|
import { cloneTr } from './clone-tr';
|
|
4
|
-
import { findCellClosestToPos, findTable } from './find';
|
|
4
|
+
import { findCellClosestToPos, findTable, findTableClosestToPos } from './find';
|
|
5
5
|
|
|
6
6
|
var select = function select(type) {
|
|
7
7
|
return function (index, expand) {
|
|
@@ -84,5 +84,23 @@ export var selectTable = function selectTable(tr) {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
+
return tr;
|
|
88
|
+
};
|
|
89
|
+
export var selectTableClosestToPos = function selectTableClosestToPos(tr, $pos) {
|
|
90
|
+
var table = findTableClosestToPos($pos);
|
|
91
|
+
|
|
92
|
+
if (table) {
|
|
93
|
+
var _TableMap$get2 = TableMap.get(table.node),
|
|
94
|
+
map = _TableMap$get2.map;
|
|
95
|
+
|
|
96
|
+
if (map && map.length) {
|
|
97
|
+
var head = table.start + map[0];
|
|
98
|
+
var anchor = table.start + map[map.length - 1];
|
|
99
|
+
var $head = tr.doc.resolve(head);
|
|
100
|
+
var $anchor = tr.doc.resolve(anchor);
|
|
101
|
+
return cloneTr(tr.setSelection(new CellSelection($anchor, $head)));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
87
105
|
return tr;
|
|
88
106
|
};
|
package/dist/esm/version.json
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ResolvedPos } from 'prosemirror-model';
|
|
1
2
|
import { Transaction } from 'prosemirror-state';
|
|
2
3
|
export declare const selectColumn: (index: number, expand?: boolean | undefined) => (tr: Transaction) => Transaction;
|
|
3
4
|
export declare const selectRow: (index: number, expand?: boolean | undefined) => (tr: Transaction) => Transaction;
|
|
4
5
|
export declare const selectTable: (tr: Transaction) => Transaction;
|
|
6
|
+
export declare const selectTableClosestToPos: (tr: Transaction, $pos: ResolvedPos) => Transaction;
|
package/package.json
CHANGED
package/report.api.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
<!-- API Report Version: 2.2 -->
|
|
2
|
+
|
|
1
3
|
## API Report File for "@atlaskit/editor-tables"
|
|
2
4
|
|
|
3
|
-
> Do not edit this file.
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
Generated API Report version: 2.0
|
|
7
|
-
-->
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
### Main Entry Types
|
|
13
|
+
|
|
14
|
+
<!--SECTION START: Main Entry Types-->
|
|
10
15
|
|
|
11
16
|
```ts
|
|
12
17
|
import { ContentNodeWithPos } from 'prosemirror-utils';
|
|
@@ -131,7 +136,7 @@ export class TableMap {
|
|
|
131
136
|
// (undocumented)
|
|
132
137
|
map: number[];
|
|
133
138
|
// (undocumented)
|
|
134
|
-
nextCell(pos: number, axis: Axis, dir: number):
|
|
139
|
+
nextCell(pos: number, axis: Axis, dir: number): null | number;
|
|
135
140
|
// (undocumented)
|
|
136
141
|
positionAt(row: number, col: number, table: Node_2): number;
|
|
137
142
|
// (undocumented)
|
|
@@ -144,10 +149,10 @@ export class TableMap {
|
|
|
144
149
|
|
|
145
150
|
// @public (undocumented)
|
|
146
151
|
type TableProblem =
|
|
152
|
+
| TableProblemColWidthMismatch
|
|
147
153
|
| TableProblemCollision
|
|
148
154
|
| TableProblemLongRowspan
|
|
149
|
-
| TableProblemMissing
|
|
150
|
-
| TableProblemColWidthMismatch;
|
|
155
|
+
| TableProblemMissing;
|
|
151
156
|
|
|
152
157
|
// @public (undocumented)
|
|
153
158
|
type TableProblemCollision = {
|
|
@@ -192,9 +197,11 @@ enum TableProblemTypes {
|
|
|
192
197
|
|
|
193
198
|
// @public (undocumented)
|
|
194
199
|
export const uuid: {
|
|
195
|
-
setStatic(value:
|
|
200
|
+
setStatic(value: false | string): void;
|
|
196
201
|
generate(): string;
|
|
197
202
|
};
|
|
198
203
|
|
|
199
204
|
// (No @packageDocumentation comment for this package)
|
|
200
205
|
```
|
|
206
|
+
|
|
207
|
+
<!--SECTION END: Main Entry Types-->
|