@codemirror/view 6.7.2 → 6.7.3

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 CHANGED
@@ -1,3 +1,9 @@
1
+ ## 6.7.3 (2023-01-12)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug in `posAtCoords` that could cause incorrect results for positions to the left of a wrapped line.
6
+
1
7
  ## 6.7.2 (2023-01-04)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -3102,7 +3102,8 @@ function domPosAtCoords(parent, x, y) {
3102
3102
  closestRect = rect;
3103
3103
  closestX = dx;
3104
3104
  closestY = dy;
3105
- closestOverlap = !dx || (dx > 0 ? i < rects.length - 1 : i > 0);
3105
+ let side = dy ? (y < rect.top ? -1 : 1) : dx ? (x < rect.left ? -1 : 1) : 0;
3106
+ closestOverlap = !side || (side > 0 ? i < rects.length - 1 : i > 0);
3106
3107
  }
3107
3108
  if (dx == 0) {
3108
3109
  if (y > rect.bottom && (!aboveRect || aboveRect.bottom < rect.bottom)) {
package/dist/index.js CHANGED
@@ -3096,7 +3096,8 @@ function domPosAtCoords(parent, x, y) {
3096
3096
  closestRect = rect;
3097
3097
  closestX = dx;
3098
3098
  closestY = dy;
3099
- closestOverlap = !dx || (dx > 0 ? i < rects.length - 1 : i > 0);
3099
+ let side = dy ? (y < rect.top ? -1 : 1) : dx ? (x < rect.left ? -1 : 1) : 0;
3100
+ closestOverlap = !side || (side > 0 ? i < rects.length - 1 : i > 0);
3100
3101
  }
3101
3102
  if (dx == 0) {
3102
3103
  if (y > rect.bottom && (!aboveRect || aboveRect.bottom < rect.bottom)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.7.2",
3
+ "version": "6.7.3",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",