slate-react 0.99.0-2023821224757 → 0.99.0

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 CHANGED
@@ -4992,6 +4992,7 @@ var withReact = function withReact(editor) {
4992
4992
 
4993
4993
  e.apply = op => {
4994
4994
  var matches = [];
4995
+ var pathRefMatches = [];
4995
4996
  var pendingDiffs = EDITOR_TO_PENDING_DIFFS.get(e);
4996
4997
 
4997
4998
  if (pendingDiffs !== null && pendingDiffs !== void 0 && pendingDiffs.length) {
@@ -5052,6 +5053,20 @@ var withReact = function withReact(editor) {
5052
5053
  {
5053
5054
  var commonPath = Path.common(Path.parent(op.path), Path.parent(op.newPath));
5054
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]);
5055
5070
  break;
5056
5071
  }
5057
5072
  }
@@ -5062,6 +5077,13 @@ var withReact = function withReact(editor) {
5062
5077
  var [node] = Editor.node(e, path);
5063
5078
  NODE_TO_KEY.set(node, key);
5064
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
+ }
5065
5087
  };
5066
5088
 
5067
5089
  e.setFragmentData = data => {