slate-react 0.77.1 → 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.
@@ -2364,6 +2364,8 @@
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
 
@@ -2375,23 +2377,24 @@
2375
2377
 
2376
2378
  var anchor = selection.anchor;
2377
2379
 
2378
- if (slate.Editor.isEnd(editor, anchor, anchor.path)) {
2379
- var _node$parentElement;
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];
2380
2384
 
2381
- var _ReactEditor$toDOMPoi = ReactEditor.toDOMPoint(editor, selection.anchor),
2382
- _ReactEditor$toDOMPoi2 = _slicedToArray(_ReactEditor$toDOMPoi, 1),
2383
- node = _ReactEditor$toDOMPoi2[0];
2385
+ var anchorNode = (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.closest('a');
2384
2386
 
2385
- var anchorNode = (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.closest('a');
2387
+ if (anchorNode && ReactEditor.hasDOMNode(editor, anchorNode)) {
2388
+ var _lastText$textContent;
2386
2389
 
2387
- if (anchorNode && ReactEditor.hasDOMNode(editor, anchorNode)) {
2388
- var _node = ReactEditor.toSlateNode(editor, anchorNode);
2390
+ var _ReactEditor$getWindo = ReactEditor.getWindow(editor),
2391
+ document = _ReactEditor$getWindo.document; // Find the last text node inside the anchor.
2389
2392
 
2390
- var path = ReactEditor.findPath(editor, _node);
2391
2393
 
2392
- if (slate.Editor.isEnd(editor, anchor, path)) {
2393
- _native = false;
2394
- }
2394
+ var lastText = document.createTreeWalker(anchorNode, NodeFilter.SHOW_TEXT).lastChild();
2395
+
2396
+ if (lastText === node && ((_lastText$textContent = lastText.textContent) === null || _lastText$textContent === void 0 ? void 0 : _lastText$textContent.length) === offset) {
2397
+ _native = false;
2395
2398
  }
2396
2399
  }
2397
2400
  }