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.es.js
CHANGED
|
@@ -560,6 +560,13 @@ var ReactEditor = {
|
|
|
560
560
|
IS_FOCUSED.set(editor, true);
|
|
561
561
|
|
|
562
562
|
if (root.activeElement !== el) {
|
|
563
|
+
if (editor.selection && root instanceof Document) {
|
|
564
|
+
var domSelection = root.getSelection();
|
|
565
|
+
var domRange = ReactEditor.toDOMRange(editor, editor.selection);
|
|
566
|
+
domSelection === null || domSelection === void 0 ? void 0 : domSelection.removeAllRanges();
|
|
567
|
+
domSelection === null || domSelection === void 0 ? void 0 : domSelection.addRange(domRange);
|
|
568
|
+
}
|
|
569
|
+
|
|
563
570
|
el.focus({
|
|
564
571
|
preventScroll: true
|
|
565
572
|
});
|
|
@@ -4985,6 +4992,7 @@ var withReact = function withReact(editor) {
|
|
|
4985
4992
|
|
|
4986
4993
|
e.apply = op => {
|
|
4987
4994
|
var matches = [];
|
|
4995
|
+
var pathRefMatches = [];
|
|
4988
4996
|
var pendingDiffs = EDITOR_TO_PENDING_DIFFS.get(e);
|
|
4989
4997
|
|
|
4990
4998
|
if (pendingDiffs !== null && pendingDiffs !== void 0 && pendingDiffs.length) {
|
|
@@ -5045,6 +5053,20 @@ var withReact = function withReact(editor) {
|
|
|
5045
5053
|
{
|
|
5046
5054
|
var commonPath = Path.common(Path.parent(op.path), Path.parent(op.newPath));
|
|
5047
5055
|
matches.push(...getMatches(e, commonPath));
|
|
5056
|
+
var changedPath;
|
|
5057
|
+
|
|
5058
|
+
if (Path.isBefore(op.path, op.newPath)) {
|
|
5059
|
+
matches.push(...getMatches(e, Path.parent(op.path)));
|
|
5060
|
+
changedPath = op.newPath;
|
|
5061
|
+
} else {
|
|
5062
|
+
matches.push(...getMatches(e, Path.parent(op.newPath)));
|
|
5063
|
+
changedPath = op.path;
|
|
5064
|
+
}
|
|
5065
|
+
|
|
5066
|
+
var changedNode = Node.get(editor, Path.parent(changedPath));
|
|
5067
|
+
var changedNodeKey = ReactEditor.findKey(e, changedNode);
|
|
5068
|
+
var changedPathRef = Editor.pathRef(e, Path.parent(changedPath));
|
|
5069
|
+
pathRefMatches.push([changedPathRef, changedNodeKey]);
|
|
5048
5070
|
break;
|
|
5049
5071
|
}
|
|
5050
5072
|
}
|
|
@@ -5055,6 +5077,13 @@ var withReact = function withReact(editor) {
|
|
|
5055
5077
|
var [node] = Editor.node(e, path);
|
|
5056
5078
|
NODE_TO_KEY.set(node, key);
|
|
5057
5079
|
}
|
|
5080
|
+
|
|
5081
|
+
for (var [pathRef, _key] of pathRefMatches) {
|
|
5082
|
+
if (pathRef.current) {
|
|
5083
|
+
var [_node] = Editor.node(e, pathRef.current);
|
|
5084
|
+
NODE_TO_KEY.set(_node, _key);
|
|
5085
|
+
}
|
|
5086
|
+
}
|
|
5058
5087
|
};
|
|
5059
5088
|
|
|
5060
5089
|
e.setFragmentData = data => {
|