@atlaskit/editor-plugin-expand 7.4.4 → 7.4.5
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/legacyExpand/nodeviews/index.js +55 -20
- package/dist/cjs/singlePlayerExpand/node-views/index.js +55 -20
- package/dist/es2019/legacyExpand/nodeviews/index.js +38 -1
- package/dist/es2019/singlePlayerExpand/node-views/index.js +38 -1
- package/dist/esm/legacyExpand/nodeviews/index.js +55 -20
- package/dist/esm/singlePlayerExpand/node-views/index.js +55 -20
- package/dist/types/legacyExpand/nodeviews/index.d.ts +1 -0
- package/dist/types/singlePlayerExpand/node-views/index.d.ts +1 -0
- package/dist/types-ts4.5/legacyExpand/nodeviews/index.d.ts +1 -0
- package/dist/types-ts4.5/singlePlayerExpand/node-views/index.d.ts +1 -0
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-expand
|
|
2
2
|
|
|
3
|
+
## 7.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`15164638b4d1a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/15164638b4d1a) -
|
|
8
|
+
[ux] [EDITOR-2461] handle ArrowUp navigation out of the Expand title
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 7.4.4
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
|
@@ -193,7 +193,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
193
193
|
_this.handleArrowLeftFromTitle(event);
|
|
194
194
|
break;
|
|
195
195
|
case 'ArrowUp':
|
|
196
|
-
|
|
196
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
|
|
197
|
+
_this.moveToPreviousLine(event);
|
|
198
|
+
} else {
|
|
199
|
+
_this.setLeftGapCursor(event);
|
|
200
|
+
}
|
|
197
201
|
break;
|
|
198
202
|
case 'Backspace':
|
|
199
203
|
_this.deleteExpand(event);
|
|
@@ -315,7 +319,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
315
319
|
dispatch(state.tr.setSelection(new _selection.GapCursorSelection(state.doc.resolve(_this.node.nodeSize + pos), _selection.Side.RIGHT)));
|
|
316
320
|
}
|
|
317
321
|
});
|
|
318
|
-
(0, _defineProperty2.default)(this, "
|
|
322
|
+
(0, _defineProperty2.default)(this, "moveToPreviousLine", function (event) {
|
|
319
323
|
if (!_this.input) {
|
|
320
324
|
return;
|
|
321
325
|
}
|
|
@@ -331,12 +335,23 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
331
335
|
var _this$view7 = _this.view,
|
|
332
336
|
state = _this$view7.state,
|
|
333
337
|
dispatch = _this$view7.dispatch;
|
|
334
|
-
|
|
335
|
-
|
|
338
|
+
var resolvedPos = state.doc.resolve(pos);
|
|
339
|
+
if (!resolvedPos) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (resolvedPos.pos === 0) {
|
|
343
|
+
_this.setLeftGapCursor(event);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
var sel = _state.Selection.findFrom(resolvedPos, -1);
|
|
347
|
+
if (sel) {
|
|
348
|
+
_this.view.focus();
|
|
349
|
+
dispatch(state.tr.setSelection(sel));
|
|
350
|
+
}
|
|
336
351
|
}
|
|
337
352
|
});
|
|
338
|
-
(0, _defineProperty2.default)(this, "
|
|
339
|
-
if (!_this.input
|
|
353
|
+
(0, _defineProperty2.default)(this, "setLeftGapCursor", function (event) {
|
|
354
|
+
if (!_this.input) {
|
|
340
355
|
return;
|
|
341
356
|
}
|
|
342
357
|
var pos = _this.getPos();
|
|
@@ -344,15 +359,35 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
344
359
|
return;
|
|
345
360
|
}
|
|
346
361
|
var _this$input4 = _this.input,
|
|
347
|
-
value = _this$input4.value,
|
|
348
362
|
selectionStart = _this$input4.selectionStart,
|
|
349
363
|
selectionEnd = _this$input4.selectionEnd;
|
|
350
|
-
if (selectionStart === selectionEnd && selectionStart ===
|
|
364
|
+
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
351
365
|
event.preventDefault();
|
|
352
366
|
var _this$view8 = _this.view,
|
|
353
367
|
state = _this$view8.state,
|
|
354
368
|
dispatch = _this$view8.dispatch;
|
|
355
369
|
_this.view.focus();
|
|
370
|
+
dispatch(state.tr.setSelection(new _selection.GapCursorSelection(state.doc.resolve(pos), _selection.Side.LEFT)));
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
(0, _defineProperty2.default)(this, "handleArrowRightFromTitle", function (event) {
|
|
374
|
+
if (!_this.input || !_this.selectNearNode) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
var pos = _this.getPos();
|
|
378
|
+
if (typeof pos !== 'number') {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
var _this$input5 = _this.input,
|
|
382
|
+
value = _this$input5.value,
|
|
383
|
+
selectionStart = _this$input5.selectionStart,
|
|
384
|
+
selectionEnd = _this$input5.selectionEnd;
|
|
385
|
+
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
386
|
+
event.preventDefault();
|
|
387
|
+
var _this$view9 = _this.view,
|
|
388
|
+
state = _this$view9.state,
|
|
389
|
+
dispatch = _this$view9.dispatch;
|
|
390
|
+
_this.view.focus();
|
|
356
391
|
var tr = _this.selectNearNode({
|
|
357
392
|
selectionRelativeToNode: _selection.RelativeSelectionPos.End,
|
|
358
393
|
selection: _state.NodeSelection.create(state.doc, pos)
|
|
@@ -370,15 +405,15 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
370
405
|
if (typeof pos !== 'number') {
|
|
371
406
|
return;
|
|
372
407
|
}
|
|
373
|
-
var _this$
|
|
374
|
-
selectionStart = _this$
|
|
375
|
-
selectionEnd = _this$
|
|
408
|
+
var _this$input6 = _this.input,
|
|
409
|
+
selectionStart = _this$input6.selectionStart,
|
|
410
|
+
selectionEnd = _this$input6.selectionEnd;
|
|
376
411
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
377
412
|
var _this$api5;
|
|
378
413
|
event.preventDefault();
|
|
379
|
-
var _this$
|
|
380
|
-
state = _this$
|
|
381
|
-
dispatch = _this$
|
|
414
|
+
var _this$view0 = _this.view,
|
|
415
|
+
state = _this$view0.state,
|
|
416
|
+
dispatch = _this$view0.dispatch;
|
|
382
417
|
_this.view.focus();
|
|
383
418
|
var selectionSharedState = ((_this$api5 = _this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.selection) === null || _this$api5 === void 0 ? void 0 : _this$api5.sharedState.currentState()) || {};
|
|
384
419
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
@@ -403,17 +438,17 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
403
438
|
}
|
|
404
439
|
});
|
|
405
440
|
(0, _defineProperty2.default)(this, "handleUndoFromTitle", function (event) {
|
|
406
|
-
var _this$
|
|
407
|
-
state = _this$
|
|
408
|
-
dispatch = _this$
|
|
441
|
+
var _this$view1 = _this.view,
|
|
442
|
+
state = _this$view1.state,
|
|
443
|
+
dispatch = _this$view1.dispatch;
|
|
409
444
|
(0, _prosemirrorHistory.undo)(state, dispatch);
|
|
410
445
|
event.preventDefault();
|
|
411
446
|
return;
|
|
412
447
|
});
|
|
413
448
|
(0, _defineProperty2.default)(this, "handleRedoFromTitle", function (event) {
|
|
414
|
-
var _this$
|
|
415
|
-
state = _this$
|
|
416
|
-
dispatch = _this$
|
|
449
|
+
var _this$view10 = _this.view,
|
|
450
|
+
state = _this$view10.state,
|
|
451
|
+
dispatch = _this$view10.dispatch;
|
|
417
452
|
(0, _prosemirrorHistory.redo)(state, dispatch);
|
|
418
453
|
event.preventDefault();
|
|
419
454
|
return;
|
|
@@ -151,7 +151,11 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
151
151
|
_this.handleArrowLeftFromTitle(event);
|
|
152
152
|
break;
|
|
153
153
|
case 'ArrowUp':
|
|
154
|
-
|
|
154
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
|
|
155
|
+
_this.moveToPreviousLine(event);
|
|
156
|
+
} else {
|
|
157
|
+
_this.setLeftGapCursor(event);
|
|
158
|
+
}
|
|
155
159
|
break;
|
|
156
160
|
case 'Backspace':
|
|
157
161
|
_this.deleteEmptyExpand();
|
|
@@ -270,7 +274,7 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
270
274
|
dispatch(state.tr.setSelection(new _selection.GapCursorSelection(state.doc.resolve(_this.node.nodeSize + pos), _selection.Side.RIGHT)));
|
|
271
275
|
}
|
|
272
276
|
});
|
|
273
|
-
(0, _defineProperty2.default)(this, "
|
|
277
|
+
(0, _defineProperty2.default)(this, "moveToPreviousLine", function (event) {
|
|
274
278
|
if (!_this.input) {
|
|
275
279
|
return;
|
|
276
280
|
}
|
|
@@ -286,12 +290,23 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
286
290
|
var _this$view6 = _this.view,
|
|
287
291
|
state = _this$view6.state,
|
|
288
292
|
dispatch = _this$view6.dispatch;
|
|
289
|
-
|
|
290
|
-
|
|
293
|
+
var resolvedPos = state.doc.resolve(pos);
|
|
294
|
+
if (!resolvedPos) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
if (resolvedPos.pos === 0) {
|
|
298
|
+
_this.setLeftGapCursor(event);
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
var sel = _state.Selection.findFrom(resolvedPos, -1);
|
|
302
|
+
if (sel) {
|
|
303
|
+
_this.view.focus();
|
|
304
|
+
dispatch(state.tr.setSelection(sel));
|
|
305
|
+
}
|
|
291
306
|
}
|
|
292
307
|
});
|
|
293
|
-
(0, _defineProperty2.default)(this, "
|
|
294
|
-
if (!_this.input
|
|
308
|
+
(0, _defineProperty2.default)(this, "setLeftGapCursor", function (event) {
|
|
309
|
+
if (!_this.input) {
|
|
295
310
|
return;
|
|
296
311
|
}
|
|
297
312
|
var pos = _this.getPos();
|
|
@@ -299,15 +314,35 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
299
314
|
return;
|
|
300
315
|
}
|
|
301
316
|
var _this$input4 = _this.input,
|
|
302
|
-
value = _this$input4.value,
|
|
303
317
|
selectionStart = _this$input4.selectionStart,
|
|
304
318
|
selectionEnd = _this$input4.selectionEnd;
|
|
305
|
-
if (selectionStart === selectionEnd && selectionStart ===
|
|
319
|
+
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
306
320
|
event.preventDefault();
|
|
307
321
|
var _this$view7 = _this.view,
|
|
308
322
|
state = _this$view7.state,
|
|
309
323
|
dispatch = _this$view7.dispatch;
|
|
310
324
|
_this.view.focus();
|
|
325
|
+
dispatch(state.tr.setSelection(new _selection.GapCursorSelection(state.doc.resolve(pos), _selection.Side.LEFT)));
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
(0, _defineProperty2.default)(this, "handleArrowRightFromTitle", function (event) {
|
|
329
|
+
if (!_this.input || !_this.selectNearNode) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
var pos = _this.getPos();
|
|
333
|
+
if (typeof pos !== 'number') {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
var _this$input5 = _this.input,
|
|
337
|
+
value = _this$input5.value,
|
|
338
|
+
selectionStart = _this$input5.selectionStart,
|
|
339
|
+
selectionEnd = _this$input5.selectionEnd;
|
|
340
|
+
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
341
|
+
event.preventDefault();
|
|
342
|
+
var _this$view8 = _this.view,
|
|
343
|
+
state = _this$view8.state,
|
|
344
|
+
dispatch = _this$view8.dispatch;
|
|
345
|
+
_this.view.focus();
|
|
311
346
|
var tr = _this.selectNearNode({
|
|
312
347
|
selectionRelativeToNode: _selection.RelativeSelectionPos.End,
|
|
313
348
|
selection: _state.NodeSelection.create(state.doc, pos)
|
|
@@ -325,15 +360,15 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
325
360
|
if (typeof pos !== 'number') {
|
|
326
361
|
return;
|
|
327
362
|
}
|
|
328
|
-
var _this$
|
|
329
|
-
selectionStart = _this$
|
|
330
|
-
selectionEnd = _this$
|
|
363
|
+
var _this$input6 = _this.input,
|
|
364
|
+
selectionStart = _this$input6.selectionStart,
|
|
365
|
+
selectionEnd = _this$input6.selectionEnd;
|
|
331
366
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
332
367
|
var _this$api5;
|
|
333
368
|
event.preventDefault();
|
|
334
|
-
var _this$
|
|
335
|
-
state = _this$
|
|
336
|
-
dispatch = _this$
|
|
369
|
+
var _this$view9 = _this.view,
|
|
370
|
+
state = _this$view9.state,
|
|
371
|
+
dispatch = _this$view9.dispatch;
|
|
337
372
|
_this.view.focus();
|
|
338
373
|
var selectionSharedState = ((_this$api5 = _this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.selection) === null || _this$api5 === void 0 ? void 0 : _this$api5.sharedState.currentState()) || {};
|
|
339
374
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
@@ -358,17 +393,17 @@ var ExpandNodeView = exports.ExpandNodeView = /*#__PURE__*/function () {
|
|
|
358
393
|
}
|
|
359
394
|
});
|
|
360
395
|
(0, _defineProperty2.default)(this, "handleUndoFromTitle", function (event) {
|
|
361
|
-
var _this$
|
|
362
|
-
state = _this$
|
|
363
|
-
dispatch = _this$
|
|
396
|
+
var _this$view0 = _this.view,
|
|
397
|
+
state = _this$view0.state,
|
|
398
|
+
dispatch = _this$view0.dispatch;
|
|
364
399
|
(0, _prosemirrorHistory.undo)(state, dispatch);
|
|
365
400
|
event.preventDefault();
|
|
366
401
|
return;
|
|
367
402
|
});
|
|
368
403
|
(0, _defineProperty2.default)(this, "handleRedoFromTitle", function (event) {
|
|
369
|
-
var _this$
|
|
370
|
-
state = _this$
|
|
371
|
-
dispatch = _this$
|
|
404
|
+
var _this$view1 = _this.view,
|
|
405
|
+
state = _this$view1.state,
|
|
406
|
+
dispatch = _this$view1.dispatch;
|
|
372
407
|
(0, _prosemirrorHistory.redo)(state, dispatch);
|
|
373
408
|
event.preventDefault();
|
|
374
409
|
return;
|
|
@@ -179,7 +179,11 @@ export class ExpandNodeView {
|
|
|
179
179
|
this.handleArrowLeftFromTitle(event);
|
|
180
180
|
break;
|
|
181
181
|
case 'ArrowUp':
|
|
182
|
-
|
|
182
|
+
if (expValEquals('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
|
|
183
|
+
this.moveToPreviousLine(event);
|
|
184
|
+
} else {
|
|
185
|
+
this.setLeftGapCursor(event);
|
|
186
|
+
}
|
|
183
187
|
break;
|
|
184
188
|
case 'Backspace':
|
|
185
189
|
this.deleteExpand(event);
|
|
@@ -308,6 +312,39 @@ export class ExpandNodeView {
|
|
|
308
312
|
dispatch(state.tr.setSelection(new GapCursorSelection(state.doc.resolve(this.node.nodeSize + pos), Side.RIGHT)));
|
|
309
313
|
}
|
|
310
314
|
});
|
|
315
|
+
_defineProperty(this, "moveToPreviousLine", event => {
|
|
316
|
+
if (!this.input) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
const pos = this.getPos();
|
|
320
|
+
if (typeof pos !== 'number') {
|
|
321
|
+
return;
|
|
322
|
+
}
|
|
323
|
+
const {
|
|
324
|
+
selectionStart,
|
|
325
|
+
selectionEnd
|
|
326
|
+
} = this.input;
|
|
327
|
+
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
328
|
+
event.preventDefault();
|
|
329
|
+
const {
|
|
330
|
+
state,
|
|
331
|
+
dispatch
|
|
332
|
+
} = this.view;
|
|
333
|
+
const resolvedPos = state.doc.resolve(pos);
|
|
334
|
+
if (!resolvedPos) {
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
337
|
+
if (resolvedPos.pos === 0) {
|
|
338
|
+
this.setLeftGapCursor(event);
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
const sel = Selection.findFrom(resolvedPos, -1);
|
|
342
|
+
if (sel) {
|
|
343
|
+
this.view.focus();
|
|
344
|
+
dispatch(state.tr.setSelection(sel));
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
});
|
|
311
348
|
_defineProperty(this, "setLeftGapCursor", event => {
|
|
312
349
|
if (!this.input) {
|
|
313
350
|
return;
|
|
@@ -136,7 +136,11 @@ export class ExpandNodeView {
|
|
|
136
136
|
this.handleArrowLeftFromTitle(event);
|
|
137
137
|
break;
|
|
138
138
|
case 'ArrowUp':
|
|
139
|
-
|
|
139
|
+
if (expValEquals('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
|
|
140
|
+
this.moveToPreviousLine(event);
|
|
141
|
+
} else {
|
|
142
|
+
this.setLeftGapCursor(event);
|
|
143
|
+
}
|
|
140
144
|
break;
|
|
141
145
|
case 'Backspace':
|
|
142
146
|
this.deleteEmptyExpand();
|
|
@@ -262,6 +266,39 @@ export class ExpandNodeView {
|
|
|
262
266
|
dispatch(state.tr.setSelection(new GapCursorSelection(state.doc.resolve(this.node.nodeSize + pos), Side.RIGHT)));
|
|
263
267
|
}
|
|
264
268
|
});
|
|
269
|
+
_defineProperty(this, "moveToPreviousLine", event => {
|
|
270
|
+
if (!this.input) {
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const pos = this.getPos();
|
|
274
|
+
if (typeof pos !== 'number') {
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
const {
|
|
278
|
+
selectionStart,
|
|
279
|
+
selectionEnd
|
|
280
|
+
} = this.input;
|
|
281
|
+
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
282
|
+
event.preventDefault();
|
|
283
|
+
const {
|
|
284
|
+
state,
|
|
285
|
+
dispatch
|
|
286
|
+
} = this.view;
|
|
287
|
+
const resolvedPos = state.doc.resolve(pos);
|
|
288
|
+
if (!resolvedPos) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (resolvedPos.pos === 0) {
|
|
292
|
+
this.setLeftGapCursor(event);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const sel = Selection.findFrom(resolvedPos, -1);
|
|
296
|
+
if (sel) {
|
|
297
|
+
this.view.focus();
|
|
298
|
+
dispatch(state.tr.setSelection(sel));
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
});
|
|
265
302
|
_defineProperty(this, "setLeftGapCursor", event => {
|
|
266
303
|
if (!this.input) {
|
|
267
304
|
return;
|
|
@@ -186,7 +186,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
186
186
|
_this.handleArrowLeftFromTitle(event);
|
|
187
187
|
break;
|
|
188
188
|
case 'ArrowUp':
|
|
189
|
-
|
|
189
|
+
if (expValEquals('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
|
|
190
|
+
_this.moveToPreviousLine(event);
|
|
191
|
+
} else {
|
|
192
|
+
_this.setLeftGapCursor(event);
|
|
193
|
+
}
|
|
190
194
|
break;
|
|
191
195
|
case 'Backspace':
|
|
192
196
|
_this.deleteExpand(event);
|
|
@@ -308,7 +312,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
308
312
|
dispatch(state.tr.setSelection(new GapCursorSelection(state.doc.resolve(_this.node.nodeSize + pos), Side.RIGHT)));
|
|
309
313
|
}
|
|
310
314
|
});
|
|
311
|
-
_defineProperty(this, "
|
|
315
|
+
_defineProperty(this, "moveToPreviousLine", function (event) {
|
|
312
316
|
if (!_this.input) {
|
|
313
317
|
return;
|
|
314
318
|
}
|
|
@@ -324,12 +328,23 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
324
328
|
var _this$view7 = _this.view,
|
|
325
329
|
state = _this$view7.state,
|
|
326
330
|
dispatch = _this$view7.dispatch;
|
|
327
|
-
|
|
328
|
-
|
|
331
|
+
var resolvedPos = state.doc.resolve(pos);
|
|
332
|
+
if (!resolvedPos) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
if (resolvedPos.pos === 0) {
|
|
336
|
+
_this.setLeftGapCursor(event);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
var sel = Selection.findFrom(resolvedPos, -1);
|
|
340
|
+
if (sel) {
|
|
341
|
+
_this.view.focus();
|
|
342
|
+
dispatch(state.tr.setSelection(sel));
|
|
343
|
+
}
|
|
329
344
|
}
|
|
330
345
|
});
|
|
331
|
-
_defineProperty(this, "
|
|
332
|
-
if (!_this.input
|
|
346
|
+
_defineProperty(this, "setLeftGapCursor", function (event) {
|
|
347
|
+
if (!_this.input) {
|
|
333
348
|
return;
|
|
334
349
|
}
|
|
335
350
|
var pos = _this.getPos();
|
|
@@ -337,15 +352,35 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
337
352
|
return;
|
|
338
353
|
}
|
|
339
354
|
var _this$input4 = _this.input,
|
|
340
|
-
value = _this$input4.value,
|
|
341
355
|
selectionStart = _this$input4.selectionStart,
|
|
342
356
|
selectionEnd = _this$input4.selectionEnd;
|
|
343
|
-
if (selectionStart === selectionEnd && selectionStart ===
|
|
357
|
+
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
344
358
|
event.preventDefault();
|
|
345
359
|
var _this$view8 = _this.view,
|
|
346
360
|
state = _this$view8.state,
|
|
347
361
|
dispatch = _this$view8.dispatch;
|
|
348
362
|
_this.view.focus();
|
|
363
|
+
dispatch(state.tr.setSelection(new GapCursorSelection(state.doc.resolve(pos), Side.LEFT)));
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
_defineProperty(this, "handleArrowRightFromTitle", function (event) {
|
|
367
|
+
if (!_this.input || !_this.selectNearNode) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
var pos = _this.getPos();
|
|
371
|
+
if (typeof pos !== 'number') {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
var _this$input5 = _this.input,
|
|
375
|
+
value = _this$input5.value,
|
|
376
|
+
selectionStart = _this$input5.selectionStart,
|
|
377
|
+
selectionEnd = _this$input5.selectionEnd;
|
|
378
|
+
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
379
|
+
event.preventDefault();
|
|
380
|
+
var _this$view9 = _this.view,
|
|
381
|
+
state = _this$view9.state,
|
|
382
|
+
dispatch = _this$view9.dispatch;
|
|
383
|
+
_this.view.focus();
|
|
349
384
|
var tr = _this.selectNearNode({
|
|
350
385
|
selectionRelativeToNode: RelativeSelectionPos.End,
|
|
351
386
|
selection: NodeSelection.create(state.doc, pos)
|
|
@@ -363,15 +398,15 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
363
398
|
if (typeof pos !== 'number') {
|
|
364
399
|
return;
|
|
365
400
|
}
|
|
366
|
-
var _this$
|
|
367
|
-
selectionStart = _this$
|
|
368
|
-
selectionEnd = _this$
|
|
401
|
+
var _this$input6 = _this.input,
|
|
402
|
+
selectionStart = _this$input6.selectionStart,
|
|
403
|
+
selectionEnd = _this$input6.selectionEnd;
|
|
369
404
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
370
405
|
var _this$api5;
|
|
371
406
|
event.preventDefault();
|
|
372
|
-
var _this$
|
|
373
|
-
state = _this$
|
|
374
|
-
dispatch = _this$
|
|
407
|
+
var _this$view0 = _this.view,
|
|
408
|
+
state = _this$view0.state,
|
|
409
|
+
dispatch = _this$view0.dispatch;
|
|
375
410
|
_this.view.focus();
|
|
376
411
|
var selectionSharedState = ((_this$api5 = _this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.selection) === null || _this$api5 === void 0 ? void 0 : _this$api5.sharedState.currentState()) || {};
|
|
377
412
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
@@ -396,17 +431,17 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
396
431
|
}
|
|
397
432
|
});
|
|
398
433
|
_defineProperty(this, "handleUndoFromTitle", function (event) {
|
|
399
|
-
var _this$
|
|
400
|
-
state = _this$
|
|
401
|
-
dispatch = _this$
|
|
434
|
+
var _this$view1 = _this.view,
|
|
435
|
+
state = _this$view1.state,
|
|
436
|
+
dispatch = _this$view1.dispatch;
|
|
402
437
|
undo(state, dispatch);
|
|
403
438
|
event.preventDefault();
|
|
404
439
|
return;
|
|
405
440
|
});
|
|
406
441
|
_defineProperty(this, "handleRedoFromTitle", function (event) {
|
|
407
|
-
var _this$
|
|
408
|
-
state = _this$
|
|
409
|
-
dispatch = _this$
|
|
442
|
+
var _this$view10 = _this.view,
|
|
443
|
+
state = _this$view10.state,
|
|
444
|
+
dispatch = _this$view10.dispatch;
|
|
410
445
|
redo(state, dispatch);
|
|
411
446
|
event.preventDefault();
|
|
412
447
|
return;
|
|
@@ -143,7 +143,11 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
143
143
|
_this.handleArrowLeftFromTitle(event);
|
|
144
144
|
break;
|
|
145
145
|
case 'ArrowUp':
|
|
146
|
-
|
|
146
|
+
if (expValEquals('platform_editor_lovability_navigation_fixes', 'isEnabled', true)) {
|
|
147
|
+
_this.moveToPreviousLine(event);
|
|
148
|
+
} else {
|
|
149
|
+
_this.setLeftGapCursor(event);
|
|
150
|
+
}
|
|
147
151
|
break;
|
|
148
152
|
case 'Backspace':
|
|
149
153
|
_this.deleteEmptyExpand();
|
|
@@ -262,7 +266,7 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
262
266
|
dispatch(state.tr.setSelection(new GapCursorSelection(state.doc.resolve(_this.node.nodeSize + pos), Side.RIGHT)));
|
|
263
267
|
}
|
|
264
268
|
});
|
|
265
|
-
_defineProperty(this, "
|
|
269
|
+
_defineProperty(this, "moveToPreviousLine", function (event) {
|
|
266
270
|
if (!_this.input) {
|
|
267
271
|
return;
|
|
268
272
|
}
|
|
@@ -278,12 +282,23 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
278
282
|
var _this$view6 = _this.view,
|
|
279
283
|
state = _this$view6.state,
|
|
280
284
|
dispatch = _this$view6.dispatch;
|
|
281
|
-
|
|
282
|
-
|
|
285
|
+
var resolvedPos = state.doc.resolve(pos);
|
|
286
|
+
if (!resolvedPos) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
if (resolvedPos.pos === 0) {
|
|
290
|
+
_this.setLeftGapCursor(event);
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
var sel = Selection.findFrom(resolvedPos, -1);
|
|
294
|
+
if (sel) {
|
|
295
|
+
_this.view.focus();
|
|
296
|
+
dispatch(state.tr.setSelection(sel));
|
|
297
|
+
}
|
|
283
298
|
}
|
|
284
299
|
});
|
|
285
|
-
_defineProperty(this, "
|
|
286
|
-
if (!_this.input
|
|
300
|
+
_defineProperty(this, "setLeftGapCursor", function (event) {
|
|
301
|
+
if (!_this.input) {
|
|
287
302
|
return;
|
|
288
303
|
}
|
|
289
304
|
var pos = _this.getPos();
|
|
@@ -291,15 +306,35 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
291
306
|
return;
|
|
292
307
|
}
|
|
293
308
|
var _this$input4 = _this.input,
|
|
294
|
-
value = _this$input4.value,
|
|
295
309
|
selectionStart = _this$input4.selectionStart,
|
|
296
310
|
selectionEnd = _this$input4.selectionEnd;
|
|
297
|
-
if (selectionStart === selectionEnd && selectionStart ===
|
|
311
|
+
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
298
312
|
event.preventDefault();
|
|
299
313
|
var _this$view7 = _this.view,
|
|
300
314
|
state = _this$view7.state,
|
|
301
315
|
dispatch = _this$view7.dispatch;
|
|
302
316
|
_this.view.focus();
|
|
317
|
+
dispatch(state.tr.setSelection(new GapCursorSelection(state.doc.resolve(pos), Side.LEFT)));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
_defineProperty(this, "handleArrowRightFromTitle", function (event) {
|
|
321
|
+
if (!_this.input || !_this.selectNearNode) {
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
var pos = _this.getPos();
|
|
325
|
+
if (typeof pos !== 'number') {
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
var _this$input5 = _this.input,
|
|
329
|
+
value = _this$input5.value,
|
|
330
|
+
selectionStart = _this$input5.selectionStart,
|
|
331
|
+
selectionEnd = _this$input5.selectionEnd;
|
|
332
|
+
if (selectionStart === selectionEnd && selectionStart === value.length) {
|
|
333
|
+
event.preventDefault();
|
|
334
|
+
var _this$view8 = _this.view,
|
|
335
|
+
state = _this$view8.state,
|
|
336
|
+
dispatch = _this$view8.dispatch;
|
|
337
|
+
_this.view.focus();
|
|
303
338
|
var tr = _this.selectNearNode({
|
|
304
339
|
selectionRelativeToNode: RelativeSelectionPos.End,
|
|
305
340
|
selection: NodeSelection.create(state.doc, pos)
|
|
@@ -317,15 +352,15 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
317
352
|
if (typeof pos !== 'number') {
|
|
318
353
|
return;
|
|
319
354
|
}
|
|
320
|
-
var _this$
|
|
321
|
-
selectionStart = _this$
|
|
322
|
-
selectionEnd = _this$
|
|
355
|
+
var _this$input6 = _this.input,
|
|
356
|
+
selectionStart = _this$input6.selectionStart,
|
|
357
|
+
selectionEnd = _this$input6.selectionEnd;
|
|
323
358
|
if (selectionStart === selectionEnd && selectionStart === 0) {
|
|
324
359
|
var _this$api5;
|
|
325
360
|
event.preventDefault();
|
|
326
|
-
var _this$
|
|
327
|
-
state = _this$
|
|
328
|
-
dispatch = _this$
|
|
361
|
+
var _this$view9 = _this.view,
|
|
362
|
+
state = _this$view9.state,
|
|
363
|
+
dispatch = _this$view9.dispatch;
|
|
329
364
|
_this.view.focus();
|
|
330
365
|
var selectionSharedState = ((_this$api5 = _this.api) === null || _this$api5 === void 0 || (_this$api5 = _this$api5.selection) === null || _this$api5 === void 0 ? void 0 : _this$api5.sharedState.currentState()) || {};
|
|
331
366
|
// selectionRelativeToNode is undefined when user clicked to select node, then hit left to get focus in title
|
|
@@ -350,17 +385,17 @@ export var ExpandNodeView = /*#__PURE__*/function () {
|
|
|
350
385
|
}
|
|
351
386
|
});
|
|
352
387
|
_defineProperty(this, "handleUndoFromTitle", function (event) {
|
|
353
|
-
var _this$
|
|
354
|
-
state = _this$
|
|
355
|
-
dispatch = _this$
|
|
388
|
+
var _this$view0 = _this.view,
|
|
389
|
+
state = _this$view0.state,
|
|
390
|
+
dispatch = _this$view0.dispatch;
|
|
356
391
|
undo(state, dispatch);
|
|
357
392
|
event.preventDefault();
|
|
358
393
|
return;
|
|
359
394
|
});
|
|
360
395
|
_defineProperty(this, "handleRedoFromTitle", function (event) {
|
|
361
|
-
var _this$
|
|
362
|
-
state = _this$
|
|
363
|
-
dispatch = _this$
|
|
396
|
+
var _this$view1 = _this.view,
|
|
397
|
+
state = _this$view1.state,
|
|
398
|
+
dispatch = _this$view1.dispatch;
|
|
364
399
|
redo(state, dispatch);
|
|
365
400
|
event.preventDefault();
|
|
366
401
|
return;
|
|
@@ -42,6 +42,7 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
42
42
|
private moveToOutsideOfTitle;
|
|
43
43
|
private isCollapsed;
|
|
44
44
|
private setRightGapCursor;
|
|
45
|
+
private moveToPreviousLine;
|
|
45
46
|
private setLeftGapCursor;
|
|
46
47
|
private handleArrowRightFromTitle;
|
|
47
48
|
private handleArrowLeftFromTitle;
|
|
@@ -40,6 +40,7 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
40
40
|
private moveToOutsideOfTitle;
|
|
41
41
|
private isCollapsed;
|
|
42
42
|
private setRightGapCursor;
|
|
43
|
+
private moveToPreviousLine;
|
|
43
44
|
private setLeftGapCursor;
|
|
44
45
|
private handleArrowRightFromTitle;
|
|
45
46
|
private handleArrowLeftFromTitle;
|
|
@@ -42,6 +42,7 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
42
42
|
private moveToOutsideOfTitle;
|
|
43
43
|
private isCollapsed;
|
|
44
44
|
private setRightGapCursor;
|
|
45
|
+
private moveToPreviousLine;
|
|
45
46
|
private setLeftGapCursor;
|
|
46
47
|
private handleArrowRightFromTitle;
|
|
47
48
|
private handleArrowLeftFromTitle;
|
|
@@ -40,6 +40,7 @@ export declare class ExpandNodeView implements NodeView {
|
|
|
40
40
|
private moveToOutsideOfTitle;
|
|
41
41
|
private isCollapsed;
|
|
42
42
|
private setRightGapCursor;
|
|
43
|
+
private moveToPreviousLine;
|
|
43
44
|
private setLeftGapCursor;
|
|
44
45
|
private handleArrowRightFromTitle;
|
|
45
46
|
private handleArrowLeftFromTitle;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-expand",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.5",
|
|
4
4
|
"description": "Expand plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -48,16 +48,16 @@
|
|
|
48
48
|
"@atlaskit/icon-lab": "^5.12.0",
|
|
49
49
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
50
50
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^13.
|
|
52
|
-
"@atlaskit/tokens": "^8.
|
|
53
|
-
"@atlaskit/tooltip": "^20.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^13.41.0",
|
|
52
|
+
"@atlaskit/tokens": "^8.2.0",
|
|
53
|
+
"@atlaskit/tooltip": "^20.10.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|
|
55
55
|
"@emotion/react": "^11.7.1",
|
|
56
56
|
"uuid": "^3.1.0",
|
|
57
57
|
"w3c-keyname": "^2.1.8"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^110.
|
|
60
|
+
"@atlaskit/editor-common": "^110.33.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-dom": "^18.2.0",
|
|
63
63
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"@atlaskit/editor-plugin-content-insertion": "^6.0.0",
|
|
68
68
|
"@atlaskit/editor-plugin-guideline": "^6.0.0",
|
|
69
69
|
"@atlaskit/editor-plugin-quick-insert": "^6.0.0",
|
|
70
|
-
"@atlaskit/editor-plugin-table": "^15.
|
|
70
|
+
"@atlaskit/editor-plugin-table": "^15.4.0",
|
|
71
71
|
"@atlaskit/editor-plugin-type-ahead": "^6.5.0",
|
|
72
72
|
"@atlaskit/editor-plugin-width": "^7.0.0",
|
|
73
73
|
"@testing-library/react": "^13.4.0",
|