@codemirror/view 6.39.1 → 6.39.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 +6 -0
- package/dist/index.cjs +9 -2
- package/dist/index.js +9 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3707,15 +3707,22 @@ function posAtCoords(view, coords, precise, scanY) {
|
|
|
3707
3707
|
let content = view.contentDOM.getBoundingClientRect(), docTop = content.top + view.viewState.paddingTop;
|
|
3708
3708
|
let { x, y } = coords, yOffset = y - docTop, block;
|
|
3709
3709
|
// First find the block at the given Y position, if any. If scanY is
|
|
3710
|
-
// given (used for vertical cursor motion), try to skip widgets
|
|
3710
|
+
// given (used for vertical cursor motion), try to skip widgets and
|
|
3711
|
+
// line padding.
|
|
3711
3712
|
for (;;) {
|
|
3712
3713
|
if (yOffset < 0)
|
|
3713
3714
|
return new PosAssoc(0, 1);
|
|
3714
3715
|
if (yOffset > view.viewState.docHeight)
|
|
3715
3716
|
return new PosAssoc(view.state.doc.length, -1);
|
|
3716
3717
|
block = view.elementAtHeight(yOffset);
|
|
3717
|
-
if (scanY == null
|
|
3718
|
+
if (scanY == null)
|
|
3718
3719
|
break;
|
|
3720
|
+
if (block.type == exports.BlockType.Text) {
|
|
3721
|
+
// Check whether we aren't landing the top/bottom padding of the line
|
|
3722
|
+
let rect = view.docView.coordsAt(scanY < 0 ? block.from : block.to, scanY);
|
|
3723
|
+
if (rect && (scanY < 0 ? rect.top <= yOffset + docTop : rect.bottom >= yOffset + docTop))
|
|
3724
|
+
break;
|
|
3725
|
+
}
|
|
3719
3726
|
let halfLine = view.viewState.heightOracle.textHeight / 2;
|
|
3720
3727
|
yOffset = scanY > 0 ? block.bottom + halfLine : block.top - halfLine;
|
|
3721
3728
|
}
|
package/dist/index.js
CHANGED
|
@@ -3703,15 +3703,22 @@ function posAtCoords(view, coords, precise, scanY) {
|
|
|
3703
3703
|
let content = view.contentDOM.getBoundingClientRect(), docTop = content.top + view.viewState.paddingTop;
|
|
3704
3704
|
let { x, y } = coords, yOffset = y - docTop, block;
|
|
3705
3705
|
// First find the block at the given Y position, if any. If scanY is
|
|
3706
|
-
// given (used for vertical cursor motion), try to skip widgets
|
|
3706
|
+
// given (used for vertical cursor motion), try to skip widgets and
|
|
3707
|
+
// line padding.
|
|
3707
3708
|
for (;;) {
|
|
3708
3709
|
if (yOffset < 0)
|
|
3709
3710
|
return new PosAssoc(0, 1);
|
|
3710
3711
|
if (yOffset > view.viewState.docHeight)
|
|
3711
3712
|
return new PosAssoc(view.state.doc.length, -1);
|
|
3712
3713
|
block = view.elementAtHeight(yOffset);
|
|
3713
|
-
if (scanY == null
|
|
3714
|
+
if (scanY == null)
|
|
3714
3715
|
break;
|
|
3716
|
+
if (block.type == BlockType.Text) {
|
|
3717
|
+
// Check whether we aren't landing the top/bottom padding of the line
|
|
3718
|
+
let rect = view.docView.coordsAt(scanY < 0 ? block.from : block.to, scanY);
|
|
3719
|
+
if (rect && (scanY < 0 ? rect.top <= yOffset + docTop : rect.bottom >= yOffset + docTop))
|
|
3720
|
+
break;
|
|
3721
|
+
}
|
|
3715
3722
|
let halfLine = view.viewState.heightOracle.textHeight / 2;
|
|
3716
3723
|
yOffset = scanY > 0 ? block.bottom + halfLine : block.top - halfLine;
|
|
3717
3724
|
}
|