@codemirror/view 6.37.1 → 6.37.2
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 +16 -6
- package/dist/index.js +16 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 6.37.2 (2025-06-12)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix an issue where moving the cursor vertically from the one-but-last character on a line would sometimes move incorrectly on Safari.
|
|
6
|
+
|
|
7
|
+
Fix an issue causing coordinates between lines of text to sometimes be inappropriately placed at the end of the line by `posAtCoords`.
|
|
8
|
+
|
|
1
9
|
## 6.37.1 (2025-05-30)
|
|
2
10
|
|
|
3
11
|
### Bug fixes
|
package/dist/index.cjs
CHANGED
|
@@ -3479,8 +3479,7 @@ function domPosAtCoords(parent, x, y) {
|
|
|
3479
3479
|
closestRect = rect;
|
|
3480
3480
|
closestX = dx;
|
|
3481
3481
|
closestY = dy;
|
|
3482
|
-
|
|
3483
|
-
closestOverlap = !side || (side > 0 ? i < rects.length - 1 : i > 0);
|
|
3482
|
+
closestOverlap = !dx ? true : x < rect.left ? i > 0 : i < rects.length - 1;
|
|
3484
3483
|
}
|
|
3485
3484
|
if (dx == 0) {
|
|
3486
3485
|
if (y > rect.bottom && (!aboveRect || aboveRect.bottom < rect.bottom)) {
|
|
@@ -3656,13 +3655,24 @@ function posAtCoordsImprecise(view, contentRect, block, x, y) {
|
|
|
3656
3655
|
// line before. This is used to detect such a result so that it can be
|
|
3657
3656
|
// ignored (issue #401).
|
|
3658
3657
|
function isSuspiciousSafariCaretResult(node, offset, x) {
|
|
3659
|
-
let len;
|
|
3658
|
+
let len, scan = node;
|
|
3660
3659
|
if (node.nodeType != 3 || offset != (len = node.nodeValue.length))
|
|
3661
3660
|
return false;
|
|
3662
|
-
for (
|
|
3663
|
-
|
|
3661
|
+
for (;;) { // Check that there is no content after this node
|
|
3662
|
+
let next = scan.nextSibling;
|
|
3663
|
+
if (next) {
|
|
3664
|
+
if (next.nodeName == "BR")
|
|
3665
|
+
break;
|
|
3664
3666
|
return false;
|
|
3665
|
-
|
|
3667
|
+
}
|
|
3668
|
+
else {
|
|
3669
|
+
let parent = scan.parentNode;
|
|
3670
|
+
if (!parent || parent.nodeName == "DIV")
|
|
3671
|
+
break;
|
|
3672
|
+
scan = parent;
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3675
|
+
return textRange(node, len - 1, len).getBoundingClientRect().right > x;
|
|
3666
3676
|
}
|
|
3667
3677
|
// Chrome will move positions between lines to the start of the next line
|
|
3668
3678
|
function isSuspiciousChromeCaretResult(node, offset, x) {
|
package/dist/index.js
CHANGED
|
@@ -3475,8 +3475,7 @@ function domPosAtCoords(parent, x, y) {
|
|
|
3475
3475
|
closestRect = rect;
|
|
3476
3476
|
closestX = dx;
|
|
3477
3477
|
closestY = dy;
|
|
3478
|
-
|
|
3479
|
-
closestOverlap = !side || (side > 0 ? i < rects.length - 1 : i > 0);
|
|
3478
|
+
closestOverlap = !dx ? true : x < rect.left ? i > 0 : i < rects.length - 1;
|
|
3480
3479
|
}
|
|
3481
3480
|
if (dx == 0) {
|
|
3482
3481
|
if (y > rect.bottom && (!aboveRect || aboveRect.bottom < rect.bottom)) {
|
|
@@ -3652,13 +3651,24 @@ function posAtCoordsImprecise(view, contentRect, block, x, y) {
|
|
|
3652
3651
|
// line before. This is used to detect such a result so that it can be
|
|
3653
3652
|
// ignored (issue #401).
|
|
3654
3653
|
function isSuspiciousSafariCaretResult(node, offset, x) {
|
|
3655
|
-
let len;
|
|
3654
|
+
let len, scan = node;
|
|
3656
3655
|
if (node.nodeType != 3 || offset != (len = node.nodeValue.length))
|
|
3657
3656
|
return false;
|
|
3658
|
-
for (
|
|
3659
|
-
|
|
3657
|
+
for (;;) { // Check that there is no content after this node
|
|
3658
|
+
let next = scan.nextSibling;
|
|
3659
|
+
if (next) {
|
|
3660
|
+
if (next.nodeName == "BR")
|
|
3661
|
+
break;
|
|
3660
3662
|
return false;
|
|
3661
|
-
|
|
3663
|
+
}
|
|
3664
|
+
else {
|
|
3665
|
+
let parent = scan.parentNode;
|
|
3666
|
+
if (!parent || parent.nodeName == "DIV")
|
|
3667
|
+
break;
|
|
3668
|
+
scan = parent;
|
|
3669
|
+
}
|
|
3670
|
+
}
|
|
3671
|
+
return textRange(node, len - 1, len).getBoundingClientRect().right > x;
|
|
3662
3672
|
}
|
|
3663
3673
|
// Chrome will move positions between lines to the start of the next line
|
|
3664
3674
|
function isSuspiciousChromeCaretResult(node, offset, x) {
|