@atlaskit/editor-plugin-table 2.9.0 → 2.10.0
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 +16 -0
- package/dist/cjs/plugins/table/event-handlers.js +52 -56
- package/dist/cjs/plugins/table/nodeviews/TableComponent.js +19 -69
- package/dist/cjs/plugins/table/nodeviews/TableContainer.js +9 -0
- package/dist/cjs/plugins/table/nodeviews/TableResizer.js +19 -4
- package/dist/cjs/plugins/table/nodeviews/table.js +23 -30
- package/dist/cjs/plugins/table/nodeviews/tableCell.js +3 -6
- package/dist/cjs/plugins/table/nodeviews/update-overflow-shadows.js +2 -40
- package/dist/cjs/plugins/table/pm-plugins/main.js +3 -3
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -73
- package/dist/cjs/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -1
- package/dist/cjs/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -5
- package/dist/cjs/plugins/table/ui/TableFloatingControls/index.js +3 -7
- package/dist/cjs/plugins/table/ui/common-styles.js +2 -2
- package/dist/cjs/plugins/table/utils/dom.js +5 -12
- package/dist/es2019/plugins/table/event-handlers.js +3 -6
- package/dist/es2019/plugins/table/nodeviews/TableComponent.js +18 -69
- package/dist/es2019/plugins/table/nodeviews/TableContainer.js +9 -0
- package/dist/es2019/plugins/table/nodeviews/TableResizer.js +19 -4
- package/dist/es2019/plugins/table/nodeviews/table.js +24 -32
- package/dist/es2019/plugins/table/nodeviews/tableCell.js +3 -7
- package/dist/es2019/plugins/table/nodeviews/update-overflow-shadows.js +0 -35
- package/dist/es2019/plugins/table/pm-plugins/main.js +3 -4
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -77
- package/dist/es2019/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -1
- package/dist/es2019/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -5
- package/dist/es2019/plugins/table/ui/TableFloatingControls/index.js +3 -9
- package/dist/es2019/plugins/table/ui/common-styles.js +3 -3
- package/dist/es2019/plugins/table/utils/dom.js +5 -12
- package/dist/esm/plugins/table/event-handlers.js +52 -56
- package/dist/esm/plugins/table/nodeviews/TableComponent.js +19 -69
- package/dist/esm/plugins/table/nodeviews/TableContainer.js +9 -0
- package/dist/esm/plugins/table/nodeviews/TableResizer.js +19 -4
- package/dist/esm/plugins/table/nodeviews/table.js +23 -30
- package/dist/esm/plugins/table/nodeviews/tableCell.js +3 -6
- package/dist/esm/plugins/table/nodeviews/update-overflow-shadows.js +0 -37
- package/dist/esm/plugins/table/pm-plugins/main.js +3 -3
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.js +2 -73
- package/dist/esm/plugins/table/pm-plugins/sticky-headers/plugin.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/event-handlers.js +1 -1
- package/dist/esm/plugins/table/pm-plugins/table-resizing/utils/dom.js +1 -5
- package/dist/esm/plugins/table/ui/TableFloatingControls/index.js +3 -7
- package/dist/esm/plugins/table/ui/common-styles.js +2 -2
- package/dist/esm/plugins/table/utils/dom.js +5 -12
- package/dist/types/plugins/table/event-handlers.d.ts +1 -2
- package/dist/types/plugins/table/nodeviews/TableComponent.d.ts +0 -2
- package/dist/types/plugins/table/nodeviews/TableContainer.d.ts +6 -5
- package/dist/types/plugins/table/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types/plugins/table/nodeviews/table.d.ts +0 -1
- package/dist/types/plugins/table/nodeviews/tableCell.d.ts +2 -3
- package/dist/types/plugins/table/nodeviews/types.d.ts +0 -1
- package/dist/types/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -6
- package/dist/types/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +1 -6
- package/dist/types/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +1 -2
- package/dist/types/plugins/table/types.d.ts +2 -2
- package/dist/types/plugins/table/ui/TableFloatingControls/index.d.ts +0 -1
- package/dist/types/plugins/table/utils/dom.d.ts +1 -1
- package/dist/types-ts4.5/plugins/table/event-handlers.d.ts +1 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableComponent.d.ts +0 -2
- package/dist/types-ts4.5/plugins/table/nodeviews/TableContainer.d.ts +6 -5
- package/dist/types-ts4.5/plugins/table/nodeviews/TableResizer.d.ts +2 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/table.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/tableCell.d.ts +2 -3
- package/dist/types-ts4.5/plugins/table/nodeviews/types.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/nodeviews/update-overflow-shadows.d.ts +0 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.d.ts +1 -6
- package/dist/types-ts4.5/plugins/table/pm-plugins/table-resizing/utils/dom.d.ts +1 -2
- package/dist/types-ts4.5/plugins/table/types.d.ts +2 -2
- package/dist/types-ts4.5/plugins/table/ui/TableFloatingControls/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/table/utils/dom.d.ts +1 -1
- package/package.json +2 -2
- package/report.api.md +2 -0
- package/src/__tests__/integration/horizontal-scroll-shadows.ts +6 -9
- package/src/__tests__/integration/resize.ts +6 -16
- package/src/__tests__/unit/event-handlers.ts +1 -4
- package/src/__tests__/unit/nodeviews/TableComponent.tsx +48 -92
- package/src/__tests__/unit/nodeviews/cell.ts +1 -3
- package/src/__tests__/unit/nodeviews/table.ts +71 -83
- package/src/__tests__/unit/pm-plugins/sticky-headers/tableRow.tsx +5 -9
- package/src/__tests__/unit/ui/RowControls.tsx +1 -0
- package/src/__tests__/unit/utils/dom.ts +6 -112
- package/src/plugins/table/event-handlers.ts +72 -79
- package/src/plugins/table/nodeviews/TableComponent.tsx +37 -114
- package/src/plugins/table/nodeviews/TableContainer.tsx +17 -11
- package/src/plugins/table/nodeviews/TableResizer.tsx +34 -4
- package/src/plugins/table/nodeviews/table.tsx +22 -30
- package/src/plugins/table/nodeviews/tableCell.tsx +3 -11
- package/src/plugins/table/nodeviews/types.ts +0 -1
- package/src/plugins/table/nodeviews/update-overflow-shadows.ts +0 -54
- package/src/plugins/table/pm-plugins/main.ts +4 -22
- package/src/plugins/table/pm-plugins/sticky-headers/nodeviews/tableRow.ts +1 -83
- package/src/plugins/table/pm-plugins/sticky-headers/plugin.ts +1 -7
- package/src/plugins/table/pm-plugins/table-resizing/event-handlers.ts +1 -1
- package/src/plugins/table/pm-plugins/table-resizing/utils/dom.ts +30 -48
- package/src/plugins/table/types.ts +3 -2
- package/src/plugins/table/ui/TableFloatingControls/index.tsx +3 -15
- package/src/plugins/table/ui/common-styles.ts +1 -1
- package/src/plugins/table/utils/dom.ts +3 -11
- package/tmp/api-report-tmp.d.ts +2 -0
- package/dist/cjs/version.json +0 -5
- package/dist/es2019/version.json +0 -5
- package/dist/esm/version.json +0 -5
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
|
|
6
6
|
describe('table plugin: utils/dom.js', () => {
|
|
7
7
|
let element: HTMLElement;
|
|
8
|
-
let mouseMoveOptimization = false;
|
|
9
8
|
let elementContentRects: any;
|
|
10
9
|
const elementRect: DOMRect = {
|
|
11
10
|
width: 100,
|
|
@@ -30,7 +29,6 @@ describe('table plugin: utils/dom.js', () => {
|
|
|
30
29
|
|
|
31
30
|
beforeEach(() => {
|
|
32
31
|
element = document.createElement('div');
|
|
33
|
-
mouseMoveOptimization = false;
|
|
34
32
|
element.getBoundingClientRect = () => elementRect;
|
|
35
33
|
});
|
|
36
34
|
|
|
@@ -40,37 +38,18 @@ describe('table plugin: utils/dom.js', () => {
|
|
|
40
38
|
|
|
41
39
|
describe('and when the mouse is outside of the gap', () => {
|
|
42
40
|
describe('for 1px on the left', () => {
|
|
43
|
-
it('should return null
|
|
44
|
-
const event = {
|
|
45
|
-
target: element,
|
|
46
|
-
clientX: GAP + elementRect.left + 1,
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
expect(
|
|
50
|
-
getMousePositionHorizontalRelativeByElement(
|
|
51
|
-
// @ts-ignore
|
|
52
|
-
event,
|
|
53
|
-
mouseMoveOptimization,
|
|
54
|
-
elementContentRects,
|
|
55
|
-
GAP,
|
|
56
|
-
),
|
|
57
|
-
).toBeNull();
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('should return null when mouseMoveOptimization is enabled', () => {
|
|
41
|
+
it('should return null', () => {
|
|
61
42
|
const event = {
|
|
62
43
|
target: element,
|
|
63
44
|
offsetX: GAP + 1,
|
|
64
45
|
};
|
|
65
46
|
|
|
66
|
-
mouseMoveOptimization = true;
|
|
67
47
|
elementContentRects = { 'table-cell-id': { width: 100 } };
|
|
68
48
|
|
|
69
49
|
expect(
|
|
70
50
|
getMousePositionHorizontalRelativeByElement(
|
|
71
51
|
// @ts-ignore
|
|
72
52
|
event,
|
|
73
|
-
mouseMoveOptimization,
|
|
74
53
|
elementContentRects,
|
|
75
54
|
GAP,
|
|
76
55
|
),
|
|
@@ -79,37 +58,18 @@ describe('table plugin: utils/dom.js', () => {
|
|
|
79
58
|
});
|
|
80
59
|
|
|
81
60
|
describe('for 1px on the right', () => {
|
|
82
|
-
it('should return null
|
|
83
|
-
const event = {
|
|
84
|
-
target: element,
|
|
85
|
-
clientX: elementRect.width + elementRect.left - GAP - 1,
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
expect(
|
|
89
|
-
getMousePositionHorizontalRelativeByElement(
|
|
90
|
-
// @ts-ignore
|
|
91
|
-
event,
|
|
92
|
-
mouseMoveOptimization,
|
|
93
|
-
elementContentRects,
|
|
94
|
-
GAP,
|
|
95
|
-
),
|
|
96
|
-
).toBeNull();
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('should return null when mouseMoveOptimization is enabled', () => {
|
|
61
|
+
it('should return null', () => {
|
|
100
62
|
const event = {
|
|
101
63
|
target: element,
|
|
102
64
|
offsetX: elementRect.width - GAP - 1,
|
|
103
65
|
};
|
|
104
66
|
|
|
105
|
-
mouseMoveOptimization = true;
|
|
106
67
|
elementContentRects = { 'table-cell-id': { width: 100 } };
|
|
107
68
|
|
|
108
69
|
expect(
|
|
109
70
|
getMousePositionHorizontalRelativeByElement(
|
|
110
71
|
// @ts-ignore
|
|
111
72
|
event,
|
|
112
|
-
mouseMoveOptimization,
|
|
113
73
|
elementContentRects,
|
|
114
74
|
GAP,
|
|
115
75
|
),
|
|
@@ -119,74 +79,36 @@ describe('table plugin: utils/dom.js', () => {
|
|
|
119
79
|
});
|
|
120
80
|
|
|
121
81
|
describe('and when the mouse is inside of the gap', () => {
|
|
122
|
-
it('should return left
|
|
123
|
-
const event = {
|
|
124
|
-
target: element,
|
|
125
|
-
clientX: GAP + elementRect.left,
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
expect(
|
|
129
|
-
getMousePositionHorizontalRelativeByElement(
|
|
130
|
-
// @ts-ignore
|
|
131
|
-
event,
|
|
132
|
-
mouseMoveOptimization,
|
|
133
|
-
elementContentRects,
|
|
134
|
-
GAP,
|
|
135
|
-
),
|
|
136
|
-
).toBe('left');
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('should return left when mouseMoveOptimization is enabled', () => {
|
|
82
|
+
it('should return left', () => {
|
|
140
83
|
const event = {
|
|
141
84
|
target: element,
|
|
142
85
|
offsetX: GAP,
|
|
143
86
|
};
|
|
144
87
|
|
|
145
|
-
mouseMoveOptimization = true;
|
|
146
88
|
elementContentRects = { 'table-cell-id': { width: 100 } };
|
|
147
89
|
|
|
148
90
|
expect(
|
|
149
91
|
getMousePositionHorizontalRelativeByElement(
|
|
150
92
|
// @ts-ignore
|
|
151
93
|
event,
|
|
152
|
-
mouseMoveOptimization,
|
|
153
94
|
elementContentRects,
|
|
154
95
|
GAP,
|
|
155
96
|
),
|
|
156
97
|
).toBe('left');
|
|
157
98
|
});
|
|
158
99
|
|
|
159
|
-
it('should return right
|
|
160
|
-
const event = {
|
|
161
|
-
target: element,
|
|
162
|
-
clientX: elementRect.width + elementRect.left - GAP,
|
|
163
|
-
};
|
|
164
|
-
|
|
165
|
-
expect(
|
|
166
|
-
getMousePositionHorizontalRelativeByElement(
|
|
167
|
-
// @ts-ignore
|
|
168
|
-
event,
|
|
169
|
-
mouseMoveOptimization,
|
|
170
|
-
elementContentRects,
|
|
171
|
-
GAP,
|
|
172
|
-
),
|
|
173
|
-
).toBe('right');
|
|
174
|
-
});
|
|
175
|
-
|
|
176
|
-
it('should return right when mouseMoveOptimization is enabled', () => {
|
|
100
|
+
it('should return right', () => {
|
|
177
101
|
const event = {
|
|
178
102
|
target: element,
|
|
179
103
|
offsetX: elementRect.width - GAP,
|
|
180
104
|
};
|
|
181
105
|
|
|
182
|
-
mouseMoveOptimization = true;
|
|
183
106
|
elementContentRects = { 'table-cell-id': { width: 100 } };
|
|
184
107
|
|
|
185
108
|
expect(
|
|
186
109
|
getMousePositionHorizontalRelativeByElement(
|
|
187
110
|
// @ts-ignore
|
|
188
111
|
event,
|
|
189
|
-
mouseMoveOptimization,
|
|
190
112
|
elementContentRects,
|
|
191
113
|
GAP,
|
|
192
114
|
),
|
|
@@ -195,63 +117,35 @@ describe('table plugin: utils/dom.js', () => {
|
|
|
195
117
|
});
|
|
196
118
|
});
|
|
197
119
|
|
|
198
|
-
it('should return left when the mouse is positioned before half of the element
|
|
199
|
-
const event = {
|
|
200
|
-
target: element,
|
|
201
|
-
clientX: 50,
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
expect(
|
|
205
|
-
// @ts-ignore
|
|
206
|
-
getMousePositionHorizontalRelativeByElement(event),
|
|
207
|
-
).toBe('left');
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
it('should return left when the mouse is positioned before half of the element and mouseMoveOptimization is enabled', () => {
|
|
120
|
+
it('should return left when the mouse is positioned before half of the element', () => {
|
|
211
121
|
const event = {
|
|
212
122
|
target: element,
|
|
213
123
|
offsetX: 50,
|
|
214
124
|
};
|
|
215
125
|
|
|
216
|
-
mouseMoveOptimization = true;
|
|
217
126
|
elementContentRects = { 'table-cell-id': { width: 100 } };
|
|
218
127
|
|
|
219
128
|
expect(
|
|
220
129
|
getMousePositionHorizontalRelativeByElement(
|
|
221
130
|
// @ts-ignore
|
|
222
131
|
event,
|
|
223
|
-
mouseMoveOptimization,
|
|
224
132
|
elementContentRects,
|
|
225
133
|
),
|
|
226
134
|
).toBe('left');
|
|
227
135
|
});
|
|
228
136
|
|
|
229
|
-
it('should return right when the mouse is positioned after half of the element
|
|
230
|
-
const event = {
|
|
231
|
-
target: element,
|
|
232
|
-
clientX: 101,
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
expect(
|
|
236
|
-
// @ts-ignore
|
|
237
|
-
getMousePositionHorizontalRelativeByElement(event),
|
|
238
|
-
).toBe('right');
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('should return right when the mouse is positioned after half of the element and mouseMoveOptimization is enabled', () => {
|
|
137
|
+
it('should return right when the mouse is positioned after half of the element', () => {
|
|
242
138
|
const event = {
|
|
243
139
|
target: element,
|
|
244
140
|
offsetX: 101,
|
|
245
141
|
};
|
|
246
142
|
|
|
247
|
-
mouseMoveOptimization = true;
|
|
248
143
|
elementContentRects = { 'table-cell-id': { width: 100 } };
|
|
249
144
|
|
|
250
145
|
expect(
|
|
251
146
|
getMousePositionHorizontalRelativeByElement(
|
|
252
147
|
// @ts-ignore
|
|
253
148
|
event,
|
|
254
|
-
mouseMoveOptimization,
|
|
255
149
|
elementContentRects,
|
|
256
150
|
),
|
|
257
151
|
).toBe('right');
|
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
EVENT_TYPE,
|
|
5
5
|
TABLE_ACTION,
|
|
6
6
|
} from '@atlaskit/editor-common/analytics';
|
|
7
|
-
import type { GetEditorFeatureFlags } from '@atlaskit/editor-common/types';
|
|
8
7
|
import {
|
|
9
8
|
browser,
|
|
10
9
|
closestElement,
|
|
@@ -298,98 +297,92 @@ export const handleMouseLeave = (view: EditorView, event: Event): boolean => {
|
|
|
298
297
|
return false;
|
|
299
298
|
};
|
|
300
299
|
|
|
301
|
-
export const handleMouseMove =
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
}
|
|
311
|
-
const element = event.target;
|
|
300
|
+
export const handleMouseMove = (
|
|
301
|
+
view: EditorView,
|
|
302
|
+
event: Event,
|
|
303
|
+
elementContentRects?: ElementContentRects,
|
|
304
|
+
) => {
|
|
305
|
+
if (!(event.target instanceof HTMLElement)) {
|
|
306
|
+
return false;
|
|
307
|
+
}
|
|
308
|
+
const element = event.target;
|
|
312
309
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
return showInsertColumnButton(positionColumn)(state, dispatch);
|
|
329
|
-
}
|
|
310
|
+
if (isColumnControlsDecorations(element)) {
|
|
311
|
+
const { state, dispatch } = view;
|
|
312
|
+
const { insertColumnButtonIndex } = getPluginState(state);
|
|
313
|
+
const [startIndex, endIndex] = getColumnOrRowIndex(element);
|
|
314
|
+
|
|
315
|
+
const positionColumn =
|
|
316
|
+
getMousePositionHorizontalRelativeByElement(
|
|
317
|
+
event as MouseEvent,
|
|
318
|
+
elementContentRects,
|
|
319
|
+
) === 'right'
|
|
320
|
+
? endIndex
|
|
321
|
+
: startIndex;
|
|
322
|
+
|
|
323
|
+
if (positionColumn !== insertColumnButtonIndex) {
|
|
324
|
+
return showInsertColumnButton(positionColumn)(state, dispatch);
|
|
330
325
|
}
|
|
326
|
+
}
|
|
331
327
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
328
|
+
if (isRowControlsButton(element)) {
|
|
329
|
+
const { state, dispatch } = view;
|
|
330
|
+
const { insertRowButtonIndex } = getPluginState(state);
|
|
331
|
+
const [startIndex, endIndex] = getColumnOrRowIndex(element);
|
|
336
332
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
333
|
+
const positionRow =
|
|
334
|
+
getMousePositionVerticalRelativeByElement(event as MouseEvent) ===
|
|
335
|
+
'bottom'
|
|
336
|
+
? endIndex
|
|
337
|
+
: startIndex;
|
|
342
338
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
}
|
|
339
|
+
if (positionRow !== insertRowButtonIndex) {
|
|
340
|
+
return showInsertRowButton(positionRow)(state, dispatch);
|
|
346
341
|
}
|
|
342
|
+
}
|
|
347
343
|
|
|
348
|
-
|
|
344
|
+
if (!isResizeHandleDecoration(element) && isCell(element)) {
|
|
345
|
+
const positionColumn = getMousePositionHorizontalRelativeByElement(
|
|
346
|
+
event as MouseEvent,
|
|
347
|
+
elementContentRects,
|
|
348
|
+
RESIZE_HANDLE_AREA_DECORATION_GAP,
|
|
349
|
+
);
|
|
349
350
|
|
|
350
|
-
if (
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
351
|
+
if (positionColumn !== null) {
|
|
352
|
+
const { state, dispatch } = view;
|
|
353
|
+
const { resizeHandleColumnIndex, resizeHandleRowIndex } =
|
|
354
|
+
getPluginState(state);
|
|
355
|
+
const tableCell = closestElement(
|
|
356
|
+
element,
|
|
357
|
+
'td, th',
|
|
358
|
+
) as HTMLTableCellElement;
|
|
359
|
+
const cellStartPosition = view.posAtDOM(tableCell, 0);
|
|
360
|
+
const rect = findCellRectClosestToPos(
|
|
361
|
+
state.doc.resolve(cellStartPosition),
|
|
356
362
|
);
|
|
357
363
|
|
|
358
|
-
if (
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
positionColumn === 'left' ? rect.left : rect.right;
|
|
374
|
-
|
|
375
|
-
const rowIndexTarget = rect.top;
|
|
376
|
-
|
|
377
|
-
if (
|
|
378
|
-
columnEndIndexTarget !== resizeHandleColumnIndex ||
|
|
379
|
-
rowIndexTarget !== resizeHandleRowIndex ||
|
|
380
|
-
!hasResizeHandler({ target: element, columnEndIndexTarget })
|
|
381
|
-
) {
|
|
382
|
-
return addResizeHandleDecorations(
|
|
383
|
-
rowIndexTarget,
|
|
384
|
-
columnEndIndexTarget,
|
|
385
|
-
)(state, dispatch);
|
|
386
|
-
}
|
|
364
|
+
if (rect) {
|
|
365
|
+
const columnEndIndexTarget =
|
|
366
|
+
positionColumn === 'left' ? rect.left : rect.right;
|
|
367
|
+
|
|
368
|
+
const rowIndexTarget = rect.top;
|
|
369
|
+
|
|
370
|
+
if (
|
|
371
|
+
columnEndIndexTarget !== resizeHandleColumnIndex ||
|
|
372
|
+
rowIndexTarget !== resizeHandleRowIndex ||
|
|
373
|
+
!hasResizeHandler({ target: element, columnEndIndexTarget })
|
|
374
|
+
) {
|
|
375
|
+
return addResizeHandleDecorations(
|
|
376
|
+
rowIndexTarget,
|
|
377
|
+
columnEndIndexTarget,
|
|
378
|
+
)(state, dispatch);
|
|
387
379
|
}
|
|
388
380
|
}
|
|
389
381
|
}
|
|
382
|
+
}
|
|
390
383
|
|
|
391
|
-
|
|
392
|
-
|
|
384
|
+
return false;
|
|
385
|
+
};
|
|
393
386
|
|
|
394
387
|
export function handleTripleClick(view: EditorView, pos: number) {
|
|
395
388
|
const { state, dispatch } = view;
|