@codemirror/view 6.36.2 → 6.36.4
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 +21 -11
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +21 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
## 6.36.4 (2025-03-03)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue where scrolling down to a range higher than the viewport could in some situations fail to scroll to the proper position.
|
|
6
|
+
|
|
7
|
+
## 6.36.3 (2025-02-18)
|
|
8
|
+
|
|
9
|
+
### Bug fixes
|
|
10
|
+
|
|
11
|
+
Make sure event handlers registered with `domEventHandlers` are not called during view updates, to avoid triggering nested update errors.
|
|
12
|
+
|
|
13
|
+
Don't include the window scrollbars in the space available for displaying tooltips.
|
|
14
|
+
|
|
15
|
+
Work around an issue with Chrome's `EditContext` that shows up when using autocompletion while composing with Samsung's virtual Android keyboard.
|
|
16
|
+
|
|
1
17
|
## 6.36.2 (2025-01-09)
|
|
2
18
|
|
|
3
19
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -133,14 +133,14 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
|
|
|
133
133
|
let moveX = 0, moveY = 0;
|
|
134
134
|
if (y == "nearest") {
|
|
135
135
|
if (rect.top < bounding.top) {
|
|
136
|
-
moveY =
|
|
136
|
+
moveY = rect.top - (bounding.top + yMargin);
|
|
137
137
|
if (side > 0 && rect.bottom > bounding.bottom + moveY)
|
|
138
|
-
moveY = rect.bottom - bounding.bottom +
|
|
138
|
+
moveY = rect.bottom - bounding.bottom + yMargin;
|
|
139
139
|
}
|
|
140
140
|
else if (rect.bottom > bounding.bottom) {
|
|
141
141
|
moveY = rect.bottom - bounding.bottom + yMargin;
|
|
142
142
|
if (side < 0 && (rect.top - moveY) < bounding.top)
|
|
143
|
-
moveY =
|
|
143
|
+
moveY = rect.top - (bounding.top + yMargin);
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
else {
|
|
@@ -152,14 +152,14 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
|
|
|
152
152
|
}
|
|
153
153
|
if (x == "nearest") {
|
|
154
154
|
if (rect.left < bounding.left) {
|
|
155
|
-
moveX =
|
|
155
|
+
moveX = rect.left - (bounding.left + xMargin);
|
|
156
156
|
if (side > 0 && rect.right > bounding.right + moveX)
|
|
157
|
-
moveX = rect.right - bounding.right +
|
|
157
|
+
moveX = rect.right - bounding.right + xMargin;
|
|
158
158
|
}
|
|
159
159
|
else if (rect.right > bounding.right) {
|
|
160
160
|
moveX = rect.right - bounding.right + xMargin;
|
|
161
161
|
if (side < 0 && rect.left < bounding.left + moveX)
|
|
162
|
-
moveX =
|
|
162
|
+
moveX = rect.left - (bounding.left + xMargin);
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
else {
|
|
@@ -194,6 +194,10 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
|
|
|
194
194
|
}
|
|
195
195
|
if (top)
|
|
196
196
|
break;
|
|
197
|
+
if (rect.top < bounding.top || rect.bottom > bounding.bottom ||
|
|
198
|
+
rect.left < bounding.left || rect.right > bounding.right)
|
|
199
|
+
rect = { left: Math.max(rect.left, bounding.left), right: Math.min(rect.right, bounding.right),
|
|
200
|
+
top: Math.max(rect.top, bounding.top), bottom: Math.min(rect.bottom, bounding.bottom) };
|
|
197
201
|
cur = cur.assignedSlot || cur.parentNode;
|
|
198
202
|
}
|
|
199
203
|
else if (cur.nodeType == 11) { // A shadow root
|
|
@@ -4209,7 +4213,10 @@ class InputState {
|
|
|
4209
4213
|
return;
|
|
4210
4214
|
if (event.type == "keydown" && this.keydown(event))
|
|
4211
4215
|
return;
|
|
4212
|
-
this.
|
|
4216
|
+
if (this.view.updateState != 0 /* UpdateState.Idle */)
|
|
4217
|
+
Promise.resolve().then(() => this.runHandlers(event.type, event));
|
|
4218
|
+
else
|
|
4219
|
+
this.runHandlers(event.type, event);
|
|
4213
4220
|
}
|
|
4214
4221
|
runHandlers(type, event) {
|
|
4215
4222
|
let handlers = this.handlers[type];
|
|
@@ -7313,8 +7320,11 @@ class EditContextManager {
|
|
|
7313
7320
|
return !abort;
|
|
7314
7321
|
}
|
|
7315
7322
|
update(update) {
|
|
7316
|
-
let reverted = this.pendingContextChange;
|
|
7317
|
-
if (this.composing &&
|
|
7323
|
+
let reverted = this.pendingContextChange, startSel = update.startState.selection.main;
|
|
7324
|
+
if (this.composing &&
|
|
7325
|
+
(this.composing.drifted ||
|
|
7326
|
+
(!update.changes.touchesRange(startSel.from, startSel.to) &&
|
|
7327
|
+
update.transactions.some(tr => !tr.isUserEvent("input.type") && tr.changes.touchesRange(this.from, this.to))))) {
|
|
7318
7328
|
this.composing.drifted = true;
|
|
7319
7329
|
this.composing.editorBase = update.changes.mapPos(this.composing.editorBase);
|
|
7320
7330
|
}
|
|
@@ -9800,8 +9810,8 @@ function tooltips(config = {}) {
|
|
|
9800
9810
|
return tooltipConfig.of(config);
|
|
9801
9811
|
}
|
|
9802
9812
|
function windowSpace(view) {
|
|
9803
|
-
let
|
|
9804
|
-
return { top: 0, left: 0, bottom:
|
|
9813
|
+
let docElt = view.dom.ownerDocument.documentElement;
|
|
9814
|
+
return { top: 0, left: 0, bottom: docElt.clientHeight, right: docElt.clientWidth };
|
|
9805
9815
|
}
|
|
9806
9816
|
const tooltipConfig = state.Facet.define({
|
|
9807
9817
|
combine: values => {
|
package/dist/index.d.cts
CHANGED
|
@@ -1839,9 +1839,10 @@ declare function tooltips(config?: {
|
|
|
1839
1839
|
/**
|
|
1840
1840
|
By default, when figuring out whether there is room for a
|
|
1841
1841
|
tooltip at a given position, the extension considers the entire
|
|
1842
|
-
space between 0,0 and
|
|
1843
|
-
|
|
1844
|
-
|
|
1842
|
+
space between 0,0 and
|
|
1843
|
+
`documentElement.clientWidth`/`clientHeight` to be available for
|
|
1844
|
+
showing tooltips. You can provide a function here that returns
|
|
1845
|
+
an alternative rectangle.
|
|
1845
1846
|
*/
|
|
1846
1847
|
tooltipSpace?: (view: EditorView) => Rect;
|
|
1847
1848
|
}): Extension;
|
package/dist/index.d.ts
CHANGED
|
@@ -1839,9 +1839,10 @@ declare function tooltips(config?: {
|
|
|
1839
1839
|
/**
|
|
1840
1840
|
By default, when figuring out whether there is room for a
|
|
1841
1841
|
tooltip at a given position, the extension considers the entire
|
|
1842
|
-
space between 0,0 and
|
|
1843
|
-
|
|
1844
|
-
|
|
1842
|
+
space between 0,0 and
|
|
1843
|
+
`documentElement.clientWidth`/`clientHeight` to be available for
|
|
1844
|
+
showing tooltips. You can provide a function here that returns
|
|
1845
|
+
an alternative rectangle.
|
|
1845
1846
|
*/
|
|
1846
1847
|
tooltipSpace?: (view: EditorView) => Rect;
|
|
1847
1848
|
}): Extension;
|
package/dist/index.js
CHANGED
|
@@ -131,14 +131,14 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
|
|
|
131
131
|
let moveX = 0, moveY = 0;
|
|
132
132
|
if (y == "nearest") {
|
|
133
133
|
if (rect.top < bounding.top) {
|
|
134
|
-
moveY =
|
|
134
|
+
moveY = rect.top - (bounding.top + yMargin);
|
|
135
135
|
if (side > 0 && rect.bottom > bounding.bottom + moveY)
|
|
136
|
-
moveY = rect.bottom - bounding.bottom +
|
|
136
|
+
moveY = rect.bottom - bounding.bottom + yMargin;
|
|
137
137
|
}
|
|
138
138
|
else if (rect.bottom > bounding.bottom) {
|
|
139
139
|
moveY = rect.bottom - bounding.bottom + yMargin;
|
|
140
140
|
if (side < 0 && (rect.top - moveY) < bounding.top)
|
|
141
|
-
moveY =
|
|
141
|
+
moveY = rect.top - (bounding.top + yMargin);
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
else {
|
|
@@ -150,14 +150,14 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
|
|
|
150
150
|
}
|
|
151
151
|
if (x == "nearest") {
|
|
152
152
|
if (rect.left < bounding.left) {
|
|
153
|
-
moveX =
|
|
153
|
+
moveX = rect.left - (bounding.left + xMargin);
|
|
154
154
|
if (side > 0 && rect.right > bounding.right + moveX)
|
|
155
|
-
moveX = rect.right - bounding.right +
|
|
155
|
+
moveX = rect.right - bounding.right + xMargin;
|
|
156
156
|
}
|
|
157
157
|
else if (rect.right > bounding.right) {
|
|
158
158
|
moveX = rect.right - bounding.right + xMargin;
|
|
159
159
|
if (side < 0 && rect.left < bounding.left + moveX)
|
|
160
|
-
moveX =
|
|
160
|
+
moveX = rect.left - (bounding.left + xMargin);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
else {
|
|
@@ -192,6 +192,10 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
|
|
|
192
192
|
}
|
|
193
193
|
if (top)
|
|
194
194
|
break;
|
|
195
|
+
if (rect.top < bounding.top || rect.bottom > bounding.bottom ||
|
|
196
|
+
rect.left < bounding.left || rect.right > bounding.right)
|
|
197
|
+
rect = { left: Math.max(rect.left, bounding.left), right: Math.min(rect.right, bounding.right),
|
|
198
|
+
top: Math.max(rect.top, bounding.top), bottom: Math.min(rect.bottom, bounding.bottom) };
|
|
195
199
|
cur = cur.assignedSlot || cur.parentNode;
|
|
196
200
|
}
|
|
197
201
|
else if (cur.nodeType == 11) { // A shadow root
|
|
@@ -4205,7 +4209,10 @@ class InputState {
|
|
|
4205
4209
|
return;
|
|
4206
4210
|
if (event.type == "keydown" && this.keydown(event))
|
|
4207
4211
|
return;
|
|
4208
|
-
this.
|
|
4212
|
+
if (this.view.updateState != 0 /* UpdateState.Idle */)
|
|
4213
|
+
Promise.resolve().then(() => this.runHandlers(event.type, event));
|
|
4214
|
+
else
|
|
4215
|
+
this.runHandlers(event.type, event);
|
|
4209
4216
|
}
|
|
4210
4217
|
runHandlers(type, event) {
|
|
4211
4218
|
let handlers = this.handlers[type];
|
|
@@ -7308,8 +7315,11 @@ class EditContextManager {
|
|
|
7308
7315
|
return !abort;
|
|
7309
7316
|
}
|
|
7310
7317
|
update(update) {
|
|
7311
|
-
let reverted = this.pendingContextChange;
|
|
7312
|
-
if (this.composing &&
|
|
7318
|
+
let reverted = this.pendingContextChange, startSel = update.startState.selection.main;
|
|
7319
|
+
if (this.composing &&
|
|
7320
|
+
(this.composing.drifted ||
|
|
7321
|
+
(!update.changes.touchesRange(startSel.from, startSel.to) &&
|
|
7322
|
+
update.transactions.some(tr => !tr.isUserEvent("input.type") && tr.changes.touchesRange(this.from, this.to))))) {
|
|
7313
7323
|
this.composing.drifted = true;
|
|
7314
7324
|
this.composing.editorBase = update.changes.mapPos(this.composing.editorBase);
|
|
7315
7325
|
}
|
|
@@ -9795,8 +9805,8 @@ function tooltips(config = {}) {
|
|
|
9795
9805
|
return tooltipConfig.of(config);
|
|
9796
9806
|
}
|
|
9797
9807
|
function windowSpace(view) {
|
|
9798
|
-
let
|
|
9799
|
-
return { top: 0, left: 0, bottom:
|
|
9808
|
+
let docElt = view.dom.ownerDocument.documentElement;
|
|
9809
|
+
return { top: 0, left: 0, bottom: docElt.clientHeight, right: docElt.clientWidth };
|
|
9800
9810
|
}
|
|
9801
9811
|
const tooltipConfig = /*@__PURE__*/Facet.define({
|
|
9802
9812
|
combine: values => {
|