slate-react 0.77.0 → 0.77.2-20223192094
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/dist/components/editable.d.ts.map +1 -1
- package/dist/index.es.js +15 -10
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +22 -15
- package/dist/index.js.map +1 -1
- package/dist/slate-react.js +22 -15
- package/dist/slate-react.min.js +1 -1
- package/package.json +3 -3
package/dist/slate-react.js
CHANGED
|
@@ -2364,29 +2364,36 @@
|
|
|
2364
2364
|
// When there is an inline element, e.g. a link, and you select
|
|
2365
2365
|
// right after it (the start of the next node).
|
|
2366
2366
|
selection.anchor.offset !== 0) {
|
|
2367
|
+
var _node$parentElement;
|
|
2368
|
+
|
|
2367
2369
|
_native = true; // Skip native if there are marks, as
|
|
2368
2370
|
// `insertText` will insert a node, not just text.
|
|
2369
2371
|
|
|
2370
2372
|
if (editor.marks) {
|
|
2371
2373
|
_native = false;
|
|
2372
|
-
} // Chrome also has issues correctly editing the end of
|
|
2373
|
-
// Therefore we don't allow native events to insert text at the end of nodes.
|
|
2374
|
+
} // Chrome also has issues correctly editing the end of anchor elements: https://bugs.chromium.org/p/chromium/issues/detail?id=1259100
|
|
2375
|
+
// Therefore we don't allow native events to insert text at the end of anchor nodes.
|
|
2374
2376
|
|
|
2375
2377
|
|
|
2376
2378
|
var anchor = selection.anchor;
|
|
2377
|
-
var inline = slate.Editor.above(editor, {
|
|
2378
|
-
at: anchor,
|
|
2379
|
-
match: function match(n) {
|
|
2380
|
-
return slate.Editor.isInline(editor, n);
|
|
2381
|
-
},
|
|
2382
|
-
mode: 'highest'
|
|
2383
|
-
});
|
|
2384
2379
|
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2380
|
+
var _ReactEditor$toDOMPoi = ReactEditor.toDOMPoint(editor, anchor),
|
|
2381
|
+
_ReactEditor$toDOMPoi2 = _slicedToArray(_ReactEditor$toDOMPoi, 2),
|
|
2382
|
+
node = _ReactEditor$toDOMPoi2[0],
|
|
2383
|
+
offset = _ReactEditor$toDOMPoi2[1];
|
|
2384
|
+
|
|
2385
|
+
var anchorNode = (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.closest('a');
|
|
2386
|
+
|
|
2387
|
+
if (anchorNode && ReactEditor.hasDOMNode(editor, anchorNode)) {
|
|
2388
|
+
var _lastText$textContent;
|
|
2389
|
+
|
|
2390
|
+
var _ReactEditor$getWindo = ReactEditor.getWindow(editor),
|
|
2391
|
+
document = _ReactEditor$getWindo.document; // Find the last text node inside the anchor.
|
|
2392
|
+
|
|
2393
|
+
|
|
2394
|
+
var lastText = document.createTreeWalker(anchorNode, NodeFilter.SHOW_TEXT).lastChild();
|
|
2388
2395
|
|
|
2389
|
-
if (
|
|
2396
|
+
if (lastText === node && ((_lastText$textContent = lastText.textContent) === null || _lastText$textContent === void 0 ? void 0 : _lastText$textContent.length) === offset) {
|
|
2390
2397
|
_native = false;
|
|
2391
2398
|
}
|
|
2392
2399
|
}
|
|
@@ -2841,8 +2848,8 @@
|
|
|
2841
2848
|
});
|
|
2842
2849
|
|
|
2843
2850
|
if (inline) {
|
|
2844
|
-
var
|
|
2845
|
-
inlinePath =
|
|
2851
|
+
var _inline = _slicedToArray(inline, 2),
|
|
2852
|
+
inlinePath = _inline[1];
|
|
2846
2853
|
|
|
2847
2854
|
if (slate.Editor.isEnd(editor, selection.anchor, inlinePath)) {
|
|
2848
2855
|
var point = slate.Editor.after(editor, inlinePath);
|