@codemirror/view 6.39.0-beta.4 → 6.39.0-beta.5

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.cjs CHANGED
@@ -2397,7 +2397,7 @@ class TileBuilder {
2397
2397
  for (let cur = this.blockWrappers; cur.value && cur.from <= this.pos; cur.next())
2398
2398
  if (cur.to >= this.pos) {
2399
2399
  let wrap = new OpenWrapper(cur.from, cur.to, cur.value, cur.rank), i = this.wrappers.length;
2400
- while (i > 0 && this.wrappers[i - 1].rank < wrap.rank)
2400
+ while (i > 0 && (this.wrappers[i - 1].rank - wrap.rank || this.wrappers[i - 1].to - wrap.to) < 0)
2401
2401
  i--;
2402
2402
  this.wrappers.splice(i, 0, wrap);
2403
2403
  }
@@ -2653,8 +2653,10 @@ class TileUpdate {
2653
2653
  }
2654
2654
  else {
2655
2655
  this.cache.add(tile);
2656
- if (tile instanceof MarkTile)
2656
+ if (tile instanceof MarkTile) {
2657
2657
  activeMarks.unshift(tile.mark);
2658
+ openMarks++;
2659
+ }
2658
2660
  }
2659
2661
  this.openWidget = false;
2660
2662
  },
@@ -3229,20 +3231,18 @@ class DocView {
3229
3231
  if (pos > to)
3230
3232
  break;
3231
3233
  let child = tile.children[i], end = pos + child.length;
3234
+ let childRect = child.dom.getBoundingClientRect(), { height } = childRect;
3235
+ if (measureBounds && !i)
3236
+ spaceAbove += childRect.top - measureBounds.top;
3232
3237
  if (child instanceof BlockWrapperTile) {
3233
3238
  if (end > from)
3234
- scan(child, pos, child.dom.getBoundingClientRect());
3239
+ scan(child, pos, childRect);
3235
3240
  }
3236
3241
  else if (pos >= from) {
3237
- let childRect = child.dom.getBoundingClientRect(), { height } = childRect;
3238
- if (measureBounds && !i)
3239
- spaceAbove += childRect.top - measureBounds.top;
3240
3242
  if (spaceAbove > 0)
3241
3243
  result.push(-spaceAbove);
3242
3244
  result.push(height + spaceAbove);
3243
3245
  spaceAbove = 0;
3244
- if (measureBounds && i == tile.children.length - 1)
3245
- spaceAbove += measureBounds.bottom - childRect.bottom;
3246
3246
  if (isWider) {
3247
3247
  let last = child.dom.lastChild;
3248
3248
  let rects = last ? clientRectsFor(last) : [];
@@ -3258,6 +3258,8 @@ class DocView {
3258
3258
  }
3259
3259
  }
3260
3260
  }
3261
+ if (measureBounds && i == tile.children.length - 1)
3262
+ spaceAbove += measureBounds.bottom - childRect.bottom;
3261
3263
  pos = end + child.breakAfter;
3262
3264
  }
3263
3265
  };
package/dist/index.js CHANGED
@@ -2393,7 +2393,7 @@ class TileBuilder {
2393
2393
  for (let cur = this.blockWrappers; cur.value && cur.from <= this.pos; cur.next())
2394
2394
  if (cur.to >= this.pos) {
2395
2395
  let wrap = new OpenWrapper(cur.from, cur.to, cur.value, cur.rank), i = this.wrappers.length;
2396
- while (i > 0 && this.wrappers[i - 1].rank < wrap.rank)
2396
+ while (i > 0 && (this.wrappers[i - 1].rank - wrap.rank || this.wrappers[i - 1].to - wrap.to) < 0)
2397
2397
  i--;
2398
2398
  this.wrappers.splice(i, 0, wrap);
2399
2399
  }
@@ -2649,8 +2649,10 @@ class TileUpdate {
2649
2649
  }
2650
2650
  else {
2651
2651
  this.cache.add(tile);
2652
- if (tile instanceof MarkTile)
2652
+ if (tile instanceof MarkTile) {
2653
2653
  activeMarks.unshift(tile.mark);
2654
+ openMarks++;
2655
+ }
2654
2656
  }
2655
2657
  this.openWidget = false;
2656
2658
  },
@@ -3225,20 +3227,18 @@ class DocView {
3225
3227
  if (pos > to)
3226
3228
  break;
3227
3229
  let child = tile.children[i], end = pos + child.length;
3230
+ let childRect = child.dom.getBoundingClientRect(), { height } = childRect;
3231
+ if (measureBounds && !i)
3232
+ spaceAbove += childRect.top - measureBounds.top;
3228
3233
  if (child instanceof BlockWrapperTile) {
3229
3234
  if (end > from)
3230
- scan(child, pos, child.dom.getBoundingClientRect());
3235
+ scan(child, pos, childRect);
3231
3236
  }
3232
3237
  else if (pos >= from) {
3233
- let childRect = child.dom.getBoundingClientRect(), { height } = childRect;
3234
- if (measureBounds && !i)
3235
- spaceAbove += childRect.top - measureBounds.top;
3236
3238
  if (spaceAbove > 0)
3237
3239
  result.push(-spaceAbove);
3238
3240
  result.push(height + spaceAbove);
3239
3241
  spaceAbove = 0;
3240
- if (measureBounds && i == tile.children.length - 1)
3241
- spaceAbove += measureBounds.bottom - childRect.bottom;
3242
3242
  if (isWider) {
3243
3243
  let last = child.dom.lastChild;
3244
3244
  let rects = last ? clientRectsFor(last) : [];
@@ -3254,6 +3254,8 @@ class DocView {
3254
3254
  }
3255
3255
  }
3256
3256
  }
3257
+ if (measureBounds && i == tile.children.length - 1)
3258
+ spaceAbove += measureBounds.bottom - childRect.bottom;
3257
3259
  pos = end + child.breakAfter;
3258
3260
  }
3259
3261
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.39.0-beta.4",
3
+ "version": "6.39.0-beta.5",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",