@codemirror/view 6.39.14 → 6.39.15
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 +10 -0
- package/dist/index.cjs +17 -3
- package/dist/index.js +17 -3
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 6.39.15 (2026-02-20)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix a regression where the editor would forget previously measured line heights without good reason.
|
|
6
|
+
|
|
7
|
+
Fix an issue where scrolling the cursor into view sometimes wouldn't work on Chrome Android.
|
|
8
|
+
|
|
9
|
+
Fix a bug that broke composition inside of block wrappers.
|
|
10
|
+
|
|
1
11
|
## 6.39.14 (2026-02-12)
|
|
2
12
|
|
|
3
13
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -2791,9 +2791,10 @@ class TileUpdate {
|
|
|
2791
2791
|
marks.push(tile);
|
|
2792
2792
|
else if (tile === null || tile === void 0 ? void 0 : tile.isLine())
|
|
2793
2793
|
line = tile;
|
|
2794
|
+
else if (tile instanceof BlockWrapperTile) ; // Ignore
|
|
2794
2795
|
else if (parent.nodeName == "DIV" && !line && parent != this.view.contentDOM)
|
|
2795
2796
|
line = new LineTile(parent, lineBaseAttrs);
|
|
2796
|
-
else
|
|
2797
|
+
else if (!line)
|
|
2797
2798
|
marks.push(MarkTile.of(new MarkDecoration({ tagName: parent.nodeName.toLowerCase(), attributes: getAttrs(parent) }), parent));
|
|
2798
2799
|
}
|
|
2799
2800
|
return { line: line, marks };
|
|
@@ -3419,6 +3420,19 @@ class DocView {
|
|
|
3419
3420
|
};
|
|
3420
3421
|
let { offsetWidth, offsetHeight } = this.view.scrollDOM;
|
|
3421
3422
|
scrollRectIntoView(this.view.scrollDOM, targetRect, range.head < range.anchor ? -1 : 1, target.x, target.y, Math.max(Math.min(target.xMargin, offsetWidth), -offsetWidth), Math.max(Math.min(target.yMargin, offsetHeight), -offsetHeight), this.view.textDirection == exports.Direction.LTR);
|
|
3423
|
+
// On mobile browsers, the visual viewport may be smaller than the
|
|
3424
|
+
// actual reported viewport, causing scrollRectIntoView to fail to
|
|
3425
|
+
// scroll properly. Unfortunately, this visual viewport cannot be
|
|
3426
|
+
// updated directly, and scrollIntoView is the only way a script
|
|
3427
|
+
// can affect it. So this tries to kludge around the problem by
|
|
3428
|
+
// calling scrollIntoView on the scroll target's line.
|
|
3429
|
+
if (window.visualViewport && window.innerHeight - window.visualViewport.height > 1 &&
|
|
3430
|
+
(rect.top > window.pageYOffset + window.visualViewport.offsetTop + window.visualViewport.height ||
|
|
3431
|
+
rect.bottom < window.pageYOffset + window.visualViewport.offsetTop)) {
|
|
3432
|
+
let line = this.view.docView.lineAt(range.head, 1);
|
|
3433
|
+
if (line)
|
|
3434
|
+
line.dom.scrollIntoView({ block: "nearest" });
|
|
3435
|
+
}
|
|
3422
3436
|
}
|
|
3423
3437
|
lineHasWidget(pos) {
|
|
3424
3438
|
let scan = (child) => child.isWidget() || child.children.some(scan);
|
|
@@ -6202,7 +6216,7 @@ class ViewState {
|
|
|
6202
6216
|
let oracle = this.heightOracle;
|
|
6203
6217
|
let whiteSpace = style.whiteSpace;
|
|
6204
6218
|
this.defaultTextDirection = style.direction == "rtl" ? exports.Direction.RTL : exports.Direction.LTR;
|
|
6205
|
-
let refresh = this.heightOracle.mustRefreshForWrapping(whiteSpace) || this.mustMeasureContent;
|
|
6219
|
+
let refresh = this.heightOracle.mustRefreshForWrapping(whiteSpace) || this.mustMeasureContent === "refresh";
|
|
6206
6220
|
let domRect = dom.getBoundingClientRect();
|
|
6207
6221
|
let measureContent = refresh || this.mustMeasureContent || this.contentDOMHeight != domRect.height;
|
|
6208
6222
|
this.contentDOMHeight = domRect.height;
|
|
@@ -7779,7 +7793,7 @@ class EditorView {
|
|
|
7779
7793
|
this.requestMeasure();
|
|
7780
7794
|
if ((_a = document.fonts) === null || _a === void 0 ? void 0 : _a.ready)
|
|
7781
7795
|
document.fonts.ready.then(() => {
|
|
7782
|
-
this.viewState.mustMeasureContent =
|
|
7796
|
+
this.viewState.mustMeasureContent = "refresh";
|
|
7783
7797
|
this.requestMeasure();
|
|
7784
7798
|
});
|
|
7785
7799
|
}
|
package/dist/index.js
CHANGED
|
@@ -2787,9 +2787,10 @@ class TileUpdate {
|
|
|
2787
2787
|
marks.push(tile);
|
|
2788
2788
|
else if (tile === null || tile === void 0 ? void 0 : tile.isLine())
|
|
2789
2789
|
line = tile;
|
|
2790
|
+
else if (tile instanceof BlockWrapperTile) ; // Ignore
|
|
2790
2791
|
else if (parent.nodeName == "DIV" && !line && parent != this.view.contentDOM)
|
|
2791
2792
|
line = new LineTile(parent, lineBaseAttrs);
|
|
2792
|
-
else
|
|
2793
|
+
else if (!line)
|
|
2793
2794
|
marks.push(MarkTile.of(new MarkDecoration({ tagName: parent.nodeName.toLowerCase(), attributes: getAttrs(parent) }), parent));
|
|
2794
2795
|
}
|
|
2795
2796
|
return { line: line, marks };
|
|
@@ -3415,6 +3416,19 @@ class DocView {
|
|
|
3415
3416
|
};
|
|
3416
3417
|
let { offsetWidth, offsetHeight } = this.view.scrollDOM;
|
|
3417
3418
|
scrollRectIntoView(this.view.scrollDOM, targetRect, range.head < range.anchor ? -1 : 1, target.x, target.y, Math.max(Math.min(target.xMargin, offsetWidth), -offsetWidth), Math.max(Math.min(target.yMargin, offsetHeight), -offsetHeight), this.view.textDirection == Direction.LTR);
|
|
3419
|
+
// On mobile browsers, the visual viewport may be smaller than the
|
|
3420
|
+
// actual reported viewport, causing scrollRectIntoView to fail to
|
|
3421
|
+
// scroll properly. Unfortunately, this visual viewport cannot be
|
|
3422
|
+
// updated directly, and scrollIntoView is the only way a script
|
|
3423
|
+
// can affect it. So this tries to kludge around the problem by
|
|
3424
|
+
// calling scrollIntoView on the scroll target's line.
|
|
3425
|
+
if (window.visualViewport && window.innerHeight - window.visualViewport.height > 1 &&
|
|
3426
|
+
(rect.top > window.pageYOffset + window.visualViewport.offsetTop + window.visualViewport.height ||
|
|
3427
|
+
rect.bottom < window.pageYOffset + window.visualViewport.offsetTop)) {
|
|
3428
|
+
let line = this.view.docView.lineAt(range.head, 1);
|
|
3429
|
+
if (line)
|
|
3430
|
+
line.dom.scrollIntoView({ block: "nearest" });
|
|
3431
|
+
}
|
|
3418
3432
|
}
|
|
3419
3433
|
lineHasWidget(pos) {
|
|
3420
3434
|
let scan = (child) => child.isWidget() || child.children.some(scan);
|
|
@@ -6197,7 +6211,7 @@ class ViewState {
|
|
|
6197
6211
|
let oracle = this.heightOracle;
|
|
6198
6212
|
let whiteSpace = style.whiteSpace;
|
|
6199
6213
|
this.defaultTextDirection = style.direction == "rtl" ? Direction.RTL : Direction.LTR;
|
|
6200
|
-
let refresh = this.heightOracle.mustRefreshForWrapping(whiteSpace) || this.mustMeasureContent;
|
|
6214
|
+
let refresh = this.heightOracle.mustRefreshForWrapping(whiteSpace) || this.mustMeasureContent === "refresh";
|
|
6201
6215
|
let domRect = dom.getBoundingClientRect();
|
|
6202
6216
|
let measureContent = refresh || this.mustMeasureContent || this.contentDOMHeight != domRect.height;
|
|
6203
6217
|
this.contentDOMHeight = domRect.height;
|
|
@@ -7774,7 +7788,7 @@ class EditorView {
|
|
|
7774
7788
|
this.requestMeasure();
|
|
7775
7789
|
if ((_a = document.fonts) === null || _a === void 0 ? void 0 : _a.ready)
|
|
7776
7790
|
document.fonts.ready.then(() => {
|
|
7777
|
-
this.viewState.mustMeasureContent =
|
|
7791
|
+
this.viewState.mustMeasureContent = "refresh";
|
|
7778
7792
|
this.requestMeasure();
|
|
7779
7793
|
});
|
|
7780
7794
|
}
|