@codemirror/view 6.38.7 → 6.38.8
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 +8 -0
- package/dist/index.cjs +9 -6
- package/dist/index.js +9 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 6.38.8 (2025-11-17)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Improve handling of composition with multiple cursors on MacOS.
|
|
6
|
+
|
|
7
|
+
Fix an issue where computing a document position from screen coordinates would sometimes go wrong in right-to-left text.
|
|
8
|
+
|
|
1
9
|
## 6.38.7 (2025-11-14)
|
|
2
10
|
|
|
3
11
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -3548,7 +3548,7 @@ function domPosInText(node, x, y) {
|
|
|
3548
3548
|
// Check for RTL on browsers that support getting client
|
|
3549
3549
|
// rects for empty ranges.
|
|
3550
3550
|
let rectBefore = textRange(node, i).getBoundingClientRect();
|
|
3551
|
-
if (rectBefore.left
|
|
3551
|
+
if (Math.abs(rectBefore.left - rect.right) < 0.1)
|
|
3552
3552
|
after = !right;
|
|
3553
3553
|
}
|
|
3554
3554
|
if (dy <= 0)
|
|
@@ -4020,7 +4020,10 @@ class DOMChange {
|
|
|
4020
4020
|
anchor = view.state.doc.length;
|
|
4021
4021
|
}
|
|
4022
4022
|
}
|
|
4023
|
-
|
|
4023
|
+
if (view.inputState.composing > -1 && view.state.selection.ranges.length > 1)
|
|
4024
|
+
this.newSel = view.state.selection.replaceRange(state.EditorSelection.range(anchor, head));
|
|
4025
|
+
else
|
|
4026
|
+
this.newSel = state.EditorSelection.single(anchor, head);
|
|
4024
4027
|
}
|
|
4025
4028
|
}
|
|
4026
4029
|
}
|
|
@@ -4173,7 +4176,7 @@ function applyDefaultInsert(view, change, newSel) {
|
|
|
4173
4176
|
let changes = startState.changes(change);
|
|
4174
4177
|
let mainSel = newSel && newSel.main.to <= changes.newLength ? newSel.main : undefined;
|
|
4175
4178
|
// Try to apply a composition change to all cursors
|
|
4176
|
-
if (startState.selection.ranges.length > 1 && view.inputState.composing >= 0 &&
|
|
4179
|
+
if (startState.selection.ranges.length > 1 && (view.inputState.composing >= 0 || view.inputState.compositionPendingChange) &&
|
|
4177
4180
|
change.to <= sel.to + 10 && change.to >= sel.to - 10) {
|
|
4178
4181
|
let replaced = view.state.sliceDoc(change.from, change.to);
|
|
4179
4182
|
let compositionRange, composition = newSel && findCompositionNode(view, newSel.main.head);
|
|
@@ -4184,17 +4187,17 @@ function applyDefaultInsert(view, change, newSel) {
|
|
|
4184
4187
|
else {
|
|
4185
4188
|
compositionRange = view.state.doc.lineAt(sel.head);
|
|
4186
4189
|
}
|
|
4187
|
-
let offset = sel.to - change.to
|
|
4190
|
+
let offset = sel.to - change.to;
|
|
4188
4191
|
tr = startState.changeByRange(range => {
|
|
4189
4192
|
if (range.from == sel.from && range.to == sel.to)
|
|
4190
4193
|
return { changes, range: mainSel || range.map(changes) };
|
|
4191
4194
|
let to = range.to - offset, from = to - replaced.length;
|
|
4192
|
-
if (
|
|
4195
|
+
if (view.state.sliceDoc(from, to) != replaced ||
|
|
4193
4196
|
// Unfortunately, there's no way to make multiple
|
|
4194
4197
|
// changes in the same node work without aborting
|
|
4195
4198
|
// composition, so cursors in the composition range are
|
|
4196
4199
|
// ignored.
|
|
4197
|
-
|
|
4200
|
+
to >= compositionRange.from && from <= compositionRange.to)
|
|
4198
4201
|
return { range };
|
|
4199
4202
|
let rangeChanges = startState.changes({ from, to, insert: change.insert }), selOff = range.to - sel.to;
|
|
4200
4203
|
return {
|
package/dist/index.js
CHANGED
|
@@ -3544,7 +3544,7 @@ function domPosInText(node, x, y) {
|
|
|
3544
3544
|
// Check for RTL on browsers that support getting client
|
|
3545
3545
|
// rects for empty ranges.
|
|
3546
3546
|
let rectBefore = textRange(node, i).getBoundingClientRect();
|
|
3547
|
-
if (rectBefore.left
|
|
3547
|
+
if (Math.abs(rectBefore.left - rect.right) < 0.1)
|
|
3548
3548
|
after = !right;
|
|
3549
3549
|
}
|
|
3550
3550
|
if (dy <= 0)
|
|
@@ -4016,7 +4016,10 @@ class DOMChange {
|
|
|
4016
4016
|
anchor = view.state.doc.length;
|
|
4017
4017
|
}
|
|
4018
4018
|
}
|
|
4019
|
-
|
|
4019
|
+
if (view.inputState.composing > -1 && view.state.selection.ranges.length > 1)
|
|
4020
|
+
this.newSel = view.state.selection.replaceRange(EditorSelection.range(anchor, head));
|
|
4021
|
+
else
|
|
4022
|
+
this.newSel = EditorSelection.single(anchor, head);
|
|
4020
4023
|
}
|
|
4021
4024
|
}
|
|
4022
4025
|
}
|
|
@@ -4169,7 +4172,7 @@ function applyDefaultInsert(view, change, newSel) {
|
|
|
4169
4172
|
let changes = startState.changes(change);
|
|
4170
4173
|
let mainSel = newSel && newSel.main.to <= changes.newLength ? newSel.main : undefined;
|
|
4171
4174
|
// Try to apply a composition change to all cursors
|
|
4172
|
-
if (startState.selection.ranges.length > 1 && view.inputState.composing >= 0 &&
|
|
4175
|
+
if (startState.selection.ranges.length > 1 && (view.inputState.composing >= 0 || view.inputState.compositionPendingChange) &&
|
|
4173
4176
|
change.to <= sel.to + 10 && change.to >= sel.to - 10) {
|
|
4174
4177
|
let replaced = view.state.sliceDoc(change.from, change.to);
|
|
4175
4178
|
let compositionRange, composition = newSel && findCompositionNode(view, newSel.main.head);
|
|
@@ -4180,17 +4183,17 @@ function applyDefaultInsert(view, change, newSel) {
|
|
|
4180
4183
|
else {
|
|
4181
4184
|
compositionRange = view.state.doc.lineAt(sel.head);
|
|
4182
4185
|
}
|
|
4183
|
-
let offset = sel.to - change.to
|
|
4186
|
+
let offset = sel.to - change.to;
|
|
4184
4187
|
tr = startState.changeByRange(range => {
|
|
4185
4188
|
if (range.from == sel.from && range.to == sel.to)
|
|
4186
4189
|
return { changes, range: mainSel || range.map(changes) };
|
|
4187
4190
|
let to = range.to - offset, from = to - replaced.length;
|
|
4188
|
-
if (
|
|
4191
|
+
if (view.state.sliceDoc(from, to) != replaced ||
|
|
4189
4192
|
// Unfortunately, there's no way to make multiple
|
|
4190
4193
|
// changes in the same node work without aborting
|
|
4191
4194
|
// composition, so cursors in the composition range are
|
|
4192
4195
|
// ignored.
|
|
4193
|
-
|
|
4196
|
+
to >= compositionRange.from && from <= compositionRange.to)
|
|
4194
4197
|
return { range };
|
|
4195
4198
|
let rangeChanges = startState.changes({ from, to, insert: change.insert }), selOff = range.to - sel.to;
|
|
4196
4199
|
return {
|