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/index.js
CHANGED
|
@@ -1454,29 +1454,36 @@ var Editable$1 = function Editable(props) {
|
|
|
1454
1454
|
// When there is an inline element, e.g. a link, and you select
|
|
1455
1455
|
// right after it (the start of the next node).
|
|
1456
1456
|
selection.anchor.offset !== 0) {
|
|
1457
|
+
var _node$parentElement;
|
|
1458
|
+
|
|
1457
1459
|
_native = true; // Skip native if there are marks, as
|
|
1458
1460
|
// `insertText` will insert a node, not just text.
|
|
1459
1461
|
|
|
1460
1462
|
if (editor.marks) {
|
|
1461
1463
|
_native = false;
|
|
1462
|
-
} // Chrome also has issues correctly editing the end of
|
|
1463
|
-
// Therefore we don't allow native events to insert text at the end of nodes.
|
|
1464
|
+
} // Chrome also has issues correctly editing the end of anchor elements: https://bugs.chromium.org/p/chromium/issues/detail?id=1259100
|
|
1465
|
+
// Therefore we don't allow native events to insert text at the end of anchor nodes.
|
|
1464
1466
|
|
|
1465
1467
|
|
|
1466
1468
|
var anchor = selection.anchor;
|
|
1467
|
-
var inline = slate.Editor.above(editor, {
|
|
1468
|
-
at: anchor,
|
|
1469
|
-
match: function match(n) {
|
|
1470
|
-
return slate.Editor.isInline(editor, n);
|
|
1471
|
-
},
|
|
1472
|
-
mode: 'highest'
|
|
1473
|
-
});
|
|
1474
1469
|
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1470
|
+
var _ReactEditor$toDOMPoi = ReactEditor.toDOMPoint(editor, anchor),
|
|
1471
|
+
_ReactEditor$toDOMPoi2 = _slicedToArray(_ReactEditor$toDOMPoi, 2),
|
|
1472
|
+
node = _ReactEditor$toDOMPoi2[0],
|
|
1473
|
+
offset = _ReactEditor$toDOMPoi2[1];
|
|
1474
|
+
|
|
1475
|
+
var anchorNode = (_node$parentElement = node.parentElement) === null || _node$parentElement === void 0 ? void 0 : _node$parentElement.closest('a');
|
|
1476
|
+
|
|
1477
|
+
if (anchorNode && ReactEditor.hasDOMNode(editor, anchorNode)) {
|
|
1478
|
+
var _lastText$textContent;
|
|
1479
|
+
|
|
1480
|
+
var _ReactEditor$getWindo = ReactEditor.getWindow(editor),
|
|
1481
|
+
document = _ReactEditor$getWindo.document; // Find the last text node inside the anchor.
|
|
1482
|
+
|
|
1483
|
+
|
|
1484
|
+
var lastText = document.createTreeWalker(anchorNode, NodeFilter.SHOW_TEXT).lastChild();
|
|
1478
1485
|
|
|
1479
|
-
if (
|
|
1486
|
+
if (lastText === node && ((_lastText$textContent = lastText.textContent) === null || _lastText$textContent === void 0 ? void 0 : _lastText$textContent.length) === offset) {
|
|
1480
1487
|
_native = false;
|
|
1481
1488
|
}
|
|
1482
1489
|
}
|
|
@@ -1931,8 +1938,8 @@ var Editable$1 = function Editable(props) {
|
|
|
1931
1938
|
});
|
|
1932
1939
|
|
|
1933
1940
|
if (inline) {
|
|
1934
|
-
var
|
|
1935
|
-
inlinePath =
|
|
1941
|
+
var _inline = _slicedToArray(inline, 2),
|
|
1942
|
+
inlinePath = _inline[1];
|
|
1936
1943
|
|
|
1937
1944
|
if (slate.Editor.isEnd(editor, selection.anchor, inlinePath)) {
|
|
1938
1945
|
var point = slate.Editor.after(editor, inlinePath);
|