@codemirror/view 6.39.6 → 6.39.8

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,17 @@
1
+ ## 6.39.8 (2025-12-30)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug that cause `coordsAtPos` to use the dimensions of widget buffers when there were more meaningful elements to use nearby.
6
+
7
+ Fix a data structure corruption that could cause crashes during viewport changes.
8
+
9
+ ## 6.39.7 (2025-12-24)
10
+
11
+ ### Bug fixes
12
+
13
+ Fix a bug that could sometimes cause the document to become mangled during composition.
14
+
1
15
  ## 6.39.6 (2025-12-23)
2
16
 
3
17
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -2149,7 +2149,7 @@ class WidgetBufferTile extends Tile {
2149
2149
  img.setAttribute("aria-hidden", "true");
2150
2150
  super(img, 0, flags);
2151
2151
  }
2152
- get isHidden() { return false; }
2152
+ get isHidden() { return true; }
2153
2153
  get overrideDOMText() { return state.Text.empty; }
2154
2154
  coordsIn(pos) { return this.dom.getBoundingClientRect(); }
2155
2155
  }
@@ -2304,6 +2304,9 @@ class TileBuilder {
2304
2304
  }
2305
2305
  this.cache.reused.set(mark, 2 /* Reused.DOM */);
2306
2306
  }
2307
+ let oldTile = Tile.get(composition.text);
2308
+ if (oldTile)
2309
+ this.cache.reused.set(oldTile, 2 /* Reused.DOM */);
2307
2310
  let text = new TextTile(composition.text, composition.text.nodeValue);
2308
2311
  text.flags |= 8 /* TileFlag.Composition */;
2309
2312
  head.append(text);
@@ -2538,10 +2541,14 @@ class TileCache {
2538
2541
  widgets.splice(i, 1);
2539
2542
  if (i < this.index[0])
2540
2543
  this.index[0]--;
2541
- this.reused.set(tile, 1 /* Reused.Full */);
2542
- tile.length = length;
2543
- tile.flags = (tile.flags & ~(496 /* TileFlag.Widget */ | 1 /* TileFlag.BreakAfter */)) | flags;
2544
- return tile;
2544
+ if (tile.length == length && (tile.flags & (496 /* TileFlag.Widget */ | 1 /* TileFlag.BreakAfter */)) == flags) {
2545
+ this.reused.set(tile, 1 /* Reused.Full */);
2546
+ return tile;
2547
+ }
2548
+ else {
2549
+ this.reused.set(tile, 2 /* Reused.DOM */);
2550
+ return new WidgetTile(tile.dom, length, widget, (tile.flags & ~(496 /* TileFlag.Widget */ | 1 /* TileFlag.BreakAfter */)) | flags);
2551
+ }
2545
2552
  }
2546
2553
  }
2547
2554
  }
package/dist/index.js CHANGED
@@ -2145,7 +2145,7 @@ class WidgetBufferTile extends Tile {
2145
2145
  img.setAttribute("aria-hidden", "true");
2146
2146
  super(img, 0, flags);
2147
2147
  }
2148
- get isHidden() { return false; }
2148
+ get isHidden() { return true; }
2149
2149
  get overrideDOMText() { return Text.empty; }
2150
2150
  coordsIn(pos) { return this.dom.getBoundingClientRect(); }
2151
2151
  }
@@ -2300,6 +2300,9 @@ class TileBuilder {
2300
2300
  }
2301
2301
  this.cache.reused.set(mark, 2 /* Reused.DOM */);
2302
2302
  }
2303
+ let oldTile = Tile.get(composition.text);
2304
+ if (oldTile)
2305
+ this.cache.reused.set(oldTile, 2 /* Reused.DOM */);
2303
2306
  let text = new TextTile(composition.text, composition.text.nodeValue);
2304
2307
  text.flags |= 8 /* TileFlag.Composition */;
2305
2308
  head.append(text);
@@ -2534,10 +2537,14 @@ class TileCache {
2534
2537
  widgets.splice(i, 1);
2535
2538
  if (i < this.index[0])
2536
2539
  this.index[0]--;
2537
- this.reused.set(tile, 1 /* Reused.Full */);
2538
- tile.length = length;
2539
- tile.flags = (tile.flags & ~(496 /* TileFlag.Widget */ | 1 /* TileFlag.BreakAfter */)) | flags;
2540
- return tile;
2540
+ if (tile.length == length && (tile.flags & (496 /* TileFlag.Widget */ | 1 /* TileFlag.BreakAfter */)) == flags) {
2541
+ this.reused.set(tile, 1 /* Reused.Full */);
2542
+ return tile;
2543
+ }
2544
+ else {
2545
+ this.reused.set(tile, 2 /* Reused.DOM */);
2546
+ return new WidgetTile(tile.dom, length, widget, (tile.flags & ~(496 /* TileFlag.Widget */ | 1 /* TileFlag.BreakAfter */)) | flags);
2547
+ }
2541
2548
  }
2542
2549
  }
2543
2550
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.39.6",
3
+ "version": "6.39.8",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",