@codemirror/view 6.43.9 → 6.43.11
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 +16 -0
- package/dist/index.cjs +11 -10
- package/dist/index.js +11 -10
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 6.43.11 (2026-09-03)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Speed up handling of Enter/Backspace on iOS in cases where the browser's native behavior is to do nothing.
|
|
6
|
+
|
|
7
|
+
Fix the patch that avoids a crash in `posAtCoords` for non-rendered elements.
|
|
8
|
+
|
|
9
|
+
## 6.43.10 (2026-08-31)
|
|
10
|
+
|
|
11
|
+
### Bug fixes
|
|
12
|
+
|
|
13
|
+
Make sure highlighted spaces don't look odd when the browser merges them during composition.
|
|
14
|
+
|
|
15
|
+
Avoid scroll position jumping during editor scaling by properly taking scale into account when stabilizing the vertical position.
|
|
16
|
+
|
|
1
17
|
## 6.43.9 (2026-08-16)
|
|
2
18
|
|
|
3
19
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -3947,7 +3947,7 @@ class InlineCoordsScan {
|
|
|
3947
3947
|
// on the y axis, move this.y into it, and retry the scan.
|
|
3948
3948
|
if (!closestRect) {
|
|
3949
3949
|
if (!below && !above)
|
|
3950
|
-
return { i:
|
|
3950
|
+
return { i: 0, after: false };
|
|
3951
3951
|
let side = above && (!below || (this.y - above.bottom < below.top - this.y)) ? above : below;
|
|
3952
3952
|
this.y = (side.top + side.bottom) / 2;
|
|
3953
3953
|
return this.scan(positions, getRects, true);
|
|
@@ -4629,7 +4629,7 @@ class InputState {
|
|
|
4629
4629
|
iosVirtualKeyboardOpen(this.view.win))
|
|
4630
4630
|
mods.shiftKey = false;
|
|
4631
4631
|
this.pendingIOSKey = { key: event.key, keyCode: event.keyCode, mods };
|
|
4632
|
-
setTimeout(() => this.flushIOSKey(),
|
|
4632
|
+
setTimeout(() => this.flushIOSKey(), 50);
|
|
4633
4633
|
return true;
|
|
4634
4634
|
}
|
|
4635
4635
|
if (event.keyCode != 229)
|
|
@@ -4638,7 +4638,7 @@ class InputState {
|
|
|
4638
4638
|
}
|
|
4639
4639
|
flushIOSKey(change) {
|
|
4640
4640
|
let key = this.pendingIOSKey;
|
|
4641
|
-
if (!key)
|
|
4641
|
+
if (!key || this.view.observer.pendingRecords().length)
|
|
4642
4642
|
return false;
|
|
4643
4643
|
// This looks like an autocorrection before Enter
|
|
4644
4644
|
if (key.key == "Enter" && change && change.from < change.to && /^\S+$/.test(change.insert.toString()))
|
|
@@ -6645,9 +6645,8 @@ class ViewState {
|
|
|
6645
6645
|
scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(height), QueryType.ByHeight, this.heightOracle, 0, 0), this.scaler);
|
|
6646
6646
|
}
|
|
6647
6647
|
getScrollOffset() {
|
|
6648
|
-
|
|
6648
|
+
return this.scrollParent == this.view.scrollDOM ? this.scrollParent.scrollTop * this.scaleY
|
|
6649
6649
|
: (this.scrollParent ? this.scrollParent.getBoundingClientRect().top : 0) - this.view.contentDOM.getBoundingClientRect().top;
|
|
6650
|
-
return base * this.scaleY;
|
|
6651
6650
|
}
|
|
6652
6651
|
scrollAnchorAt(scrollOffset) {
|
|
6653
6652
|
let block = this.lineBlockAtHeight(scrollOffset + 8);
|
|
@@ -7039,8 +7038,9 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
|
|
|
7039
7038
|
userSelect: "none"
|
|
7040
7039
|
},
|
|
7041
7040
|
".cm-highlightSpace": {
|
|
7042
|
-
|
|
7043
|
-
|
|
7041
|
+
background: "radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",
|
|
7042
|
+
backgroundSize: ".4em",
|
|
7043
|
+
backgroundPosition: "calc(min(50%, 0px)) center"
|
|
7044
7044
|
},
|
|
7045
7045
|
".cm-highlightTab": {
|
|
7046
7046
|
backgroundImage: `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,
|
|
@@ -8151,7 +8151,7 @@ class EditorView {
|
|
|
8151
8151
|
this.observer.forceFlush();
|
|
8152
8152
|
let updated = null;
|
|
8153
8153
|
let scroll = this.viewState.scrollParent, scrollOffset = this.viewState.getScrollOffset();
|
|
8154
|
-
let { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
|
|
8154
|
+
let { scrollAnchorPos, scrollAnchorHeight, scaleY: scrollScale } = this.viewState;
|
|
8155
8155
|
if (Math.abs(scrollOffset - this.viewState.scrollOffset) > 1)
|
|
8156
8156
|
scrollAnchorHeight = -1;
|
|
8157
8157
|
this.viewState.scrollAnchorHeight = -1;
|
|
@@ -8160,13 +8160,14 @@ class EditorView {
|
|
|
8160
8160
|
if (scrollAnchorHeight < 0) {
|
|
8161
8161
|
if (isScrolledToBottom(scroll || this.win)) {
|
|
8162
8162
|
scrollAnchorPos = -1;
|
|
8163
|
-
scrollAnchorHeight = this.viewState.heightMap.height;
|
|
8163
|
+
scrollAnchorHeight = this.viewState.heightMap.height / this.viewState.scaleY;
|
|
8164
8164
|
}
|
|
8165
8165
|
else {
|
|
8166
8166
|
let block = this.viewState.scrollAnchorAt(scrollOffset);
|
|
8167
8167
|
scrollAnchorPos = block.from;
|
|
8168
8168
|
scrollAnchorHeight = block.top;
|
|
8169
8169
|
}
|
|
8170
|
+
scrollScale = this.viewState.scaleY;
|
|
8170
8171
|
}
|
|
8171
8172
|
this.updateState = 1 /* UpdateState.Measuring */;
|
|
8172
8173
|
let changed = this.viewState.measure();
|
|
@@ -8230,7 +8231,7 @@ class EditorView {
|
|
|
8230
8231
|
else {
|
|
8231
8232
|
let newAnchorHeight = scrollAnchorPos < 0 ? this.viewState.heightMap.height :
|
|
8232
8233
|
this.viewState.lineBlockAt(scrollAnchorPos).top;
|
|
8233
|
-
let diff = (newAnchorHeight - scrollAnchorHeight
|
|
8234
|
+
let diff = (newAnchorHeight / this.viewState.scaleY) - (scrollAnchorHeight / scrollScale);
|
|
8234
8235
|
if ((diff > 1 || diff < -1) &&
|
|
8235
8236
|
!(browser.ios && this.inputState.lastIOSMomentumScroll > Date.now() - 100) &&
|
|
8236
8237
|
(scroll == this.scrollDOM || this.hasFocus ||
|
package/dist/index.js
CHANGED
|
@@ -3943,7 +3943,7 @@ class InlineCoordsScan {
|
|
|
3943
3943
|
// on the y axis, move this.y into it, and retry the scan.
|
|
3944
3944
|
if (!closestRect) {
|
|
3945
3945
|
if (!below && !above)
|
|
3946
|
-
return { i:
|
|
3946
|
+
return { i: 0, after: false };
|
|
3947
3947
|
let side = above && (!below || (this.y - above.bottom < below.top - this.y)) ? above : below;
|
|
3948
3948
|
this.y = (side.top + side.bottom) / 2;
|
|
3949
3949
|
return this.scan(positions, getRects, true);
|
|
@@ -4625,7 +4625,7 @@ class InputState {
|
|
|
4625
4625
|
iosVirtualKeyboardOpen(this.view.win))
|
|
4626
4626
|
mods.shiftKey = false;
|
|
4627
4627
|
this.pendingIOSKey = { key: event.key, keyCode: event.keyCode, mods };
|
|
4628
|
-
setTimeout(() => this.flushIOSKey(),
|
|
4628
|
+
setTimeout(() => this.flushIOSKey(), 50);
|
|
4629
4629
|
return true;
|
|
4630
4630
|
}
|
|
4631
4631
|
if (event.keyCode != 229)
|
|
@@ -4634,7 +4634,7 @@ class InputState {
|
|
|
4634
4634
|
}
|
|
4635
4635
|
flushIOSKey(change) {
|
|
4636
4636
|
let key = this.pendingIOSKey;
|
|
4637
|
-
if (!key)
|
|
4637
|
+
if (!key || this.view.observer.pendingRecords().length)
|
|
4638
4638
|
return false;
|
|
4639
4639
|
// This looks like an autocorrection before Enter
|
|
4640
4640
|
if (key.key == "Enter" && change && change.from < change.to && /^\S+$/.test(change.insert.toString()))
|
|
@@ -6640,9 +6640,8 @@ class ViewState {
|
|
|
6640
6640
|
scaleBlock(this.heightMap.lineAt(this.scaler.fromDOM(height), QueryType.ByHeight, this.heightOracle, 0, 0), this.scaler);
|
|
6641
6641
|
}
|
|
6642
6642
|
getScrollOffset() {
|
|
6643
|
-
|
|
6643
|
+
return this.scrollParent == this.view.scrollDOM ? this.scrollParent.scrollTop * this.scaleY
|
|
6644
6644
|
: (this.scrollParent ? this.scrollParent.getBoundingClientRect().top : 0) - this.view.contentDOM.getBoundingClientRect().top;
|
|
6645
|
-
return base * this.scaleY;
|
|
6646
6645
|
}
|
|
6647
6646
|
scrollAnchorAt(scrollOffset) {
|
|
6648
6647
|
let block = this.lineBlockAtHeight(scrollOffset + 8);
|
|
@@ -7034,8 +7033,9 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
|
|
|
7034
7033
|
userSelect: "none"
|
|
7035
7034
|
},
|
|
7036
7035
|
".cm-highlightSpace": {
|
|
7037
|
-
|
|
7038
|
-
|
|
7036
|
+
background: "radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",
|
|
7037
|
+
backgroundSize: ".4em",
|
|
7038
|
+
backgroundPosition: "calc(min(50%, 0px)) center"
|
|
7039
7039
|
},
|
|
7040
7040
|
".cm-highlightTab": {
|
|
7041
7041
|
backgroundImage: `url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,
|
|
@@ -8146,7 +8146,7 @@ class EditorView {
|
|
|
8146
8146
|
this.observer.forceFlush();
|
|
8147
8147
|
let updated = null;
|
|
8148
8148
|
let scroll = this.viewState.scrollParent, scrollOffset = this.viewState.getScrollOffset();
|
|
8149
|
-
let { scrollAnchorPos, scrollAnchorHeight } = this.viewState;
|
|
8149
|
+
let { scrollAnchorPos, scrollAnchorHeight, scaleY: scrollScale } = this.viewState;
|
|
8150
8150
|
if (Math.abs(scrollOffset - this.viewState.scrollOffset) > 1)
|
|
8151
8151
|
scrollAnchorHeight = -1;
|
|
8152
8152
|
this.viewState.scrollAnchorHeight = -1;
|
|
@@ -8155,13 +8155,14 @@ class EditorView {
|
|
|
8155
8155
|
if (scrollAnchorHeight < 0) {
|
|
8156
8156
|
if (isScrolledToBottom(scroll || this.win)) {
|
|
8157
8157
|
scrollAnchorPos = -1;
|
|
8158
|
-
scrollAnchorHeight = this.viewState.heightMap.height;
|
|
8158
|
+
scrollAnchorHeight = this.viewState.heightMap.height / this.viewState.scaleY;
|
|
8159
8159
|
}
|
|
8160
8160
|
else {
|
|
8161
8161
|
let block = this.viewState.scrollAnchorAt(scrollOffset);
|
|
8162
8162
|
scrollAnchorPos = block.from;
|
|
8163
8163
|
scrollAnchorHeight = block.top;
|
|
8164
8164
|
}
|
|
8165
|
+
scrollScale = this.viewState.scaleY;
|
|
8165
8166
|
}
|
|
8166
8167
|
this.updateState = 1 /* UpdateState.Measuring */;
|
|
8167
8168
|
let changed = this.viewState.measure();
|
|
@@ -8225,7 +8226,7 @@ class EditorView {
|
|
|
8225
8226
|
else {
|
|
8226
8227
|
let newAnchorHeight = scrollAnchorPos < 0 ? this.viewState.heightMap.height :
|
|
8227
8228
|
this.viewState.lineBlockAt(scrollAnchorPos).top;
|
|
8228
|
-
let diff = (newAnchorHeight - scrollAnchorHeight
|
|
8229
|
+
let diff = (newAnchorHeight / this.viewState.scaleY) - (scrollAnchorHeight / scrollScale);
|
|
8229
8230
|
if ((diff > 1 || diff < -1) &&
|
|
8230
8231
|
!(browser.ios && this.inputState.lastIOSMomentumScroll > Date.now() - 100) &&
|
|
8231
8232
|
(scroll == this.scrollDOM || this.hasFocus ||
|