prosemirror-view 1.23.9 → 1.23.10

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.23.10 (2022-03-22)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a crash in `DecorationSet.map` that could occur with some kinds of lift transformations.
6
+
1
7
  ## 1.23.9 (2022-03-11)
2
8
 
3
9
  ### Bug fixes
package/dist/index.es.js CHANGED
@@ -4677,9 +4677,10 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
4677
4677
  var shift = function (oldStart, oldEnd, newStart, newEnd) {
4678
4678
  for (var i = 0; i < children.length; i += 3) {
4679
4679
  var end = children[i + 1], dSize = (void 0);
4680
- if (end == -1 || oldStart > end + oldOffset) { continue }
4681
- if (oldEnd >= children[i] + oldOffset) {
4682
- children[i + 1] = -1;
4680
+ if (end < 0 || oldStart > end + oldOffset) { continue }
4681
+ var start = children[i] + oldOffset;
4682
+ if (oldEnd >= start) {
4683
+ children[i + 1] = oldStart <= start ? -2 : -1;
4683
4684
  } else if (newStart >= offset && (dSize = (newEnd - newStart) - (oldEnd - oldStart))) {
4684
4685
  children[i] += dSize;
4685
4686
  children[i + 1] += dSize;
@@ -4691,7 +4692,12 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
4691
4692
  // Find the child nodes that still correspond to a single node,
4692
4693
  // recursively call mapInner on them and update their positions.
4693
4694
  var mustRebuild = false;
4694
- for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] == -1) { // Touched nodes
4695
+ for (var i$1 = 0; i$1 < children.length; i$1 += 3) { if (children[i$1 + 1] < 0) { // Touched nodes
4696
+ if (children[i$1 + 1] == -2) {
4697
+ mustRebuild = true;
4698
+ children[i$1 + 1] = -1;
4699
+ continue
4700
+ }
4695
4701
  var from = mapping.map(oldChildren[i$1] + oldOffset), fromLocal = from - offset;
4696
4702
  if (fromLocal < 0 || fromLocal >= node.content.size) {
4697
4703
  mustRebuild = true;