slate-react 0.98.4 → 0.99.0-20238251534
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/index.es.js +29 -0
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/dist/plugin/react-editor.d.ts.map +1 -1
- package/dist/plugin/with-react.d.ts.map +1 -1
- package/dist/slate-react.js +36 -0
- package/dist/slate-react.min.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -795,6 +795,13 @@ var ReactEditor = {
|
|
|
795
795
|
IS_FOCUSED.set(editor, true);
|
|
796
796
|
|
|
797
797
|
if (root.activeElement !== el) {
|
|
798
|
+
if (editor.selection && root instanceof Document) {
|
|
799
|
+
var domSelection = root.getSelection();
|
|
800
|
+
var domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
|
801
|
+
domSelection === null || domSelection === void 0 ? void 0 : domSelection.removeAllRanges();
|
|
802
|
+
domSelection === null || domSelection === void 0 ? void 0 : domSelection.addRange(domRange);
|
|
803
|
+
}
|
|
804
|
+
|
|
798
805
|
el.focus({
|
|
799
806
|
preventScroll: true
|
|
800
807
|
});
|
|
@@ -5545,6 +5552,7 @@ var withReact = function withReact(editor) {
|
|
|
5545
5552
|
|
|
5546
5553
|
e.apply = function (op) {
|
|
5547
5554
|
var matches = [];
|
|
5555
|
+
var pathRefMatches = [];
|
|
5548
5556
|
var pendingDiffs = EDITOR_TO_PENDING_DIFFS.get(e);
|
|
5549
5557
|
|
|
5550
5558
|
if (pendingDiffs !== null && pendingDiffs !== void 0 && pendingDiffs.length) {
|
|
@@ -5607,6 +5615,20 @@ var withReact = function withReact(editor) {
|
|
|
5607
5615
|
{
|
|
5608
5616
|
var commonPath = slate.Path.common(slate.Path.parent(op.path), slate.Path.parent(op.newPath));
|
|
5609
5617
|
matches.push.apply(matches, _toConsumableArray(getMatches(e, commonPath)));
|
|
5618
|
+
var changedPath;
|
|
5619
|
+
|
|
5620
|
+
if (slate.Path.isBefore(op.path, op.newPath)) {
|
|
5621
|
+
matches.push.apply(matches, _toConsumableArray(getMatches(e, slate.Path.parent(op.path))));
|
|
5622
|
+
changedPath = op.newPath;
|
|
5623
|
+
} else {
|
|
5624
|
+
matches.push.apply(matches, _toConsumableArray(getMatches(e, slate.Path.parent(op.newPath))));
|
|
5625
|
+
changedPath = op.path;
|
|
5626
|
+
}
|
|
5627
|
+
|
|
5628
|
+
var changedNode = slate.Node.get(editor, slate.Path.parent(changedPath));
|
|
5629
|
+
var changedNodeKey = ReactEditor.findKey(e, changedNode);
|
|
5630
|
+
var changedPathRef = slate.Editor.pathRef(e, slate.Path.parent(changedPath));
|
|
5631
|
+
pathRefMatches.push([changedPathRef, changedNodeKey]);
|
|
5610
5632
|
break;
|
|
5611
5633
|
}
|
|
5612
5634
|
}
|
|
@@ -5624,6 +5646,20 @@ var withReact = function withReact(editor) {
|
|
|
5624
5646
|
|
|
5625
5647
|
NODE_TO_KEY.set(node, key);
|
|
5626
5648
|
}
|
|
5649
|
+
|
|
5650
|
+
for (var _i2 = 0, _pathRefMatches = pathRefMatches; _i2 < _pathRefMatches.length; _i2++) {
|
|
5651
|
+
var _pathRefMatches$_i = _slicedToArray(_pathRefMatches[_i2], 2),
|
|
5652
|
+
pathRef = _pathRefMatches$_i[0],
|
|
5653
|
+
_key = _pathRefMatches$_i[1];
|
|
5654
|
+
|
|
5655
|
+
if (pathRef.current) {
|
|
5656
|
+
var _Editor$node3 = slate.Editor.node(e, pathRef.current),
|
|
5657
|
+
_Editor$node4 = _slicedToArray(_Editor$node3, 1),
|
|
5658
|
+
_node = _Editor$node4[0];
|
|
5659
|
+
|
|
5660
|
+
NODE_TO_KEY.set(_node, _key);
|
|
5661
|
+
}
|
|
5662
|
+
}
|
|
5627
5663
|
};
|
|
5628
5664
|
|
|
5629
5665
|
e.setFragmentData = function (data) {
|