@codemirror/view 6.39.0-beta.3 → 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 +12 -8
- package/dist/index.js +12 -8
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1598,6 +1598,8 @@ class ChangedRange {
|
|
|
1598
1598
|
let end = ranges[rI + 1];
|
|
1599
1599
|
rI += 2;
|
|
1600
1600
|
toB = Math.max(toB, end);
|
|
1601
|
+
for (let i = dI; i < diff.length && diff[i].fromB <= toB; i++)
|
|
1602
|
+
off = diff[i].toA - diff[i].toB;
|
|
1601
1603
|
toA = Math.max(toA, end + off);
|
|
1602
1604
|
}
|
|
1603
1605
|
else if (dI < diff.length && diff[dI].fromB <= toB) {
|
|
@@ -2395,7 +2397,7 @@ class TileBuilder {
|
|
|
2395
2397
|
for (let cur = this.blockWrappers; cur.value && cur.from <= this.pos; cur.next())
|
|
2396
2398
|
if (cur.to >= this.pos) {
|
|
2397
2399
|
let wrap = new OpenWrapper(cur.from, cur.to, cur.value, cur.rank), i = this.wrappers.length;
|
|
2398
|
-
while (i > 0 && this.wrappers[i - 1].rank
|
|
2400
|
+
while (i > 0 && (this.wrappers[i - 1].rank - wrap.rank || this.wrappers[i - 1].to - wrap.to) < 0)
|
|
2399
2401
|
i--;
|
|
2400
2402
|
this.wrappers.splice(i, 0, wrap);
|
|
2401
2403
|
}
|
|
@@ -2651,8 +2653,10 @@ class TileUpdate {
|
|
|
2651
2653
|
}
|
|
2652
2654
|
else {
|
|
2653
2655
|
this.cache.add(tile);
|
|
2654
|
-
if (tile instanceof MarkTile)
|
|
2656
|
+
if (tile instanceof MarkTile) {
|
|
2655
2657
|
activeMarks.unshift(tile.mark);
|
|
2658
|
+
openMarks++;
|
|
2659
|
+
}
|
|
2656
2660
|
}
|
|
2657
2661
|
this.openWidget = false;
|
|
2658
2662
|
},
|
|
@@ -3227,20 +3231,18 @@ class DocView {
|
|
|
3227
3231
|
if (pos > to)
|
|
3228
3232
|
break;
|
|
3229
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;
|
|
3230
3237
|
if (child instanceof BlockWrapperTile) {
|
|
3231
3238
|
if (end > from)
|
|
3232
|
-
scan(child, pos,
|
|
3239
|
+
scan(child, pos, childRect);
|
|
3233
3240
|
}
|
|
3234
3241
|
else if (pos >= from) {
|
|
3235
|
-
let childRect = child.dom.getBoundingClientRect(), { height } = childRect;
|
|
3236
|
-
if (measureBounds && !i)
|
|
3237
|
-
spaceAbove += childRect.top - measureBounds.top;
|
|
3238
3242
|
if (spaceAbove > 0)
|
|
3239
3243
|
result.push(-spaceAbove);
|
|
3240
3244
|
result.push(height + spaceAbove);
|
|
3241
3245
|
spaceAbove = 0;
|
|
3242
|
-
if (measureBounds && i == tile.children.length - 1)
|
|
3243
|
-
spaceAbove += measureBounds.bottom - childRect.bottom;
|
|
3244
3246
|
if (isWider) {
|
|
3245
3247
|
let last = child.dom.lastChild;
|
|
3246
3248
|
let rects = last ? clientRectsFor(last) : [];
|
|
@@ -3256,6 +3258,8 @@ class DocView {
|
|
|
3256
3258
|
}
|
|
3257
3259
|
}
|
|
3258
3260
|
}
|
|
3261
|
+
if (measureBounds && i == tile.children.length - 1)
|
|
3262
|
+
spaceAbove += measureBounds.bottom - childRect.bottom;
|
|
3259
3263
|
pos = end + child.breakAfter;
|
|
3260
3264
|
}
|
|
3261
3265
|
};
|
package/dist/index.js
CHANGED
|
@@ -1594,6 +1594,8 @@ class ChangedRange {
|
|
|
1594
1594
|
let end = ranges[rI + 1];
|
|
1595
1595
|
rI += 2;
|
|
1596
1596
|
toB = Math.max(toB, end);
|
|
1597
|
+
for (let i = dI; i < diff.length && diff[i].fromB <= toB; i++)
|
|
1598
|
+
off = diff[i].toA - diff[i].toB;
|
|
1597
1599
|
toA = Math.max(toA, end + off);
|
|
1598
1600
|
}
|
|
1599
1601
|
else if (dI < diff.length && diff[dI].fromB <= toB) {
|
|
@@ -2391,7 +2393,7 @@ class TileBuilder {
|
|
|
2391
2393
|
for (let cur = this.blockWrappers; cur.value && cur.from <= this.pos; cur.next())
|
|
2392
2394
|
if (cur.to >= this.pos) {
|
|
2393
2395
|
let wrap = new OpenWrapper(cur.from, cur.to, cur.value, cur.rank), i = this.wrappers.length;
|
|
2394
|
-
while (i > 0 && this.wrappers[i - 1].rank
|
|
2396
|
+
while (i > 0 && (this.wrappers[i - 1].rank - wrap.rank || this.wrappers[i - 1].to - wrap.to) < 0)
|
|
2395
2397
|
i--;
|
|
2396
2398
|
this.wrappers.splice(i, 0, wrap);
|
|
2397
2399
|
}
|
|
@@ -2647,8 +2649,10 @@ class TileUpdate {
|
|
|
2647
2649
|
}
|
|
2648
2650
|
else {
|
|
2649
2651
|
this.cache.add(tile);
|
|
2650
|
-
if (tile instanceof MarkTile)
|
|
2652
|
+
if (tile instanceof MarkTile) {
|
|
2651
2653
|
activeMarks.unshift(tile.mark);
|
|
2654
|
+
openMarks++;
|
|
2655
|
+
}
|
|
2652
2656
|
}
|
|
2653
2657
|
this.openWidget = false;
|
|
2654
2658
|
},
|
|
@@ -3223,20 +3227,18 @@ class DocView {
|
|
|
3223
3227
|
if (pos > to)
|
|
3224
3228
|
break;
|
|
3225
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;
|
|
3226
3233
|
if (child instanceof BlockWrapperTile) {
|
|
3227
3234
|
if (end > from)
|
|
3228
|
-
scan(child, pos,
|
|
3235
|
+
scan(child, pos, childRect);
|
|
3229
3236
|
}
|
|
3230
3237
|
else if (pos >= from) {
|
|
3231
|
-
let childRect = child.dom.getBoundingClientRect(), { height } = childRect;
|
|
3232
|
-
if (measureBounds && !i)
|
|
3233
|
-
spaceAbove += childRect.top - measureBounds.top;
|
|
3234
3238
|
if (spaceAbove > 0)
|
|
3235
3239
|
result.push(-spaceAbove);
|
|
3236
3240
|
result.push(height + spaceAbove);
|
|
3237
3241
|
spaceAbove = 0;
|
|
3238
|
-
if (measureBounds && i == tile.children.length - 1)
|
|
3239
|
-
spaceAbove += measureBounds.bottom - childRect.bottom;
|
|
3240
3242
|
if (isWider) {
|
|
3241
3243
|
let last = child.dom.lastChild;
|
|
3242
3244
|
let rects = last ? clientRectsFor(last) : [];
|
|
@@ -3252,6 +3254,8 @@ class DocView {
|
|
|
3252
3254
|
}
|
|
3253
3255
|
}
|
|
3254
3256
|
}
|
|
3257
|
+
if (measureBounds && i == tile.children.length - 1)
|
|
3258
|
+
spaceAbove += measureBounds.bottom - childRect.bottom;
|
|
3255
3259
|
pos = end + child.breakAfter;
|
|
3256
3260
|
}
|
|
3257
3261
|
};
|