prosemirror-view 1.32.4 → 1.32.6

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,15 @@
1
+ ## 1.32.6 (2023-12-08)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug that could cause view updates to crash in rare situations where inline nodes were added around decorations.
6
+
7
+ ## 1.32.5 (2023-12-04)
8
+
9
+ ### Bug fixes
10
+
11
+ Fix a bug in `DecorationSet.map` that, in specific cases when mapping through groups of changes, move decorations to the wrong position.
12
+
1
13
  ## 1.32.4 (2023-11-08)
2
14
 
3
15
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -2429,6 +2429,10 @@ function iterDeco(parent, deco, onWidget, onNode) {
2429
2429
  end = cutAt;
2430
2430
  index = -1;
2431
2431
  }
2432
+ } else {
2433
+ while (decoIndex < locals.length && locals[decoIndex].to <= end) {
2434
+ decoIndex++;
2435
+ }
2432
2436
  }
2433
2437
 
2434
2438
  var outerDeco = _child.isInline && !_child.isLeaf ? active.filter(function (d) {
@@ -4678,7 +4682,7 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
4678
4682
 
4679
4683
  if (oldEnd >= start) {
4680
4684
  children[_i12 + 1] = oldStart <= start ? -2 : -1;
4681
- } else if (newStart >= offset && dSize) {
4685
+ } else if (oldStart >= _baseOffset && dSize) {
4682
4686
  children[_i12] += dSize;
4683
4687
  children[_i12 + 1] += dSize;
4684
4688
  }
package/dist/index.js CHANGED
@@ -2023,6 +2023,10 @@ function iterDeco(parent, deco, onWidget, onNode) {
2023
2023
  index = -1;
2024
2024
  }
2025
2025
  }
2026
+ else {
2027
+ while (decoIndex < locals.length && locals[decoIndex].to <= end)
2028
+ decoIndex++;
2029
+ }
2026
2030
  let outerDeco = child.isInline && !child.isLeaf ? active.filter(d => !d.inline) : active.slice();
2027
2031
  onNode(child, outerDeco, deco.forChild(offset, child), index);
2028
2032
  offset = end;
@@ -4181,7 +4185,7 @@ function mapChildren(oldChildren, newLocal, mapping, node, offset, oldOffset, op
4181
4185
  if (oldEnd >= start) {
4182
4186
  children[i + 1] = oldStart <= start ? -2 : -1;
4183
4187
  }
4184
- else if (newStart >= offset && dSize) {
4188
+ else if (oldStart >= baseOffset && dSize) {
4185
4189
  children[i] += dSize;
4186
4190
  children[i + 1] += dSize;
4187
4191
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prosemirror-view",
3
- "version": "1.32.4",
3
+ "version": "1.32.6",
4
4
  "description": "ProseMirror's view component",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",
package/src/decoration.ts CHANGED
@@ -568,7 +568,7 @@ function mapChildren(
568
568
  let start = (children[i] as number) + baseOffset - moved
569
569
  if (oldEnd >= start) {
570
570
  children[i + 1] = oldStart <= start ? -2 : -1
571
- } else if (newStart >= offset && dSize) {
571
+ } else if (oldStart >= baseOffset && dSize) {
572
572
  ;(children[i] as number) += dSize
573
573
  ;(children[i + 1] as number) += dSize
574
574
  }
package/src/viewdesc.ts CHANGED
@@ -1449,6 +1449,8 @@ function iterDeco(
1449
1449
  end = cutAt
1450
1450
  index = -1
1451
1451
  }
1452
+ } else {
1453
+ while (decoIndex < locals.length && locals[decoIndex].to <= end) decoIndex++
1452
1454
  }
1453
1455
 
1454
1456
  let outerDeco = child.isInline && !child.isLeaf ? active.filter(d => !d.inline) : active.slice()