@codemirror/view 6.10.0 → 6.10.1

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.10.1 (2023-05-01)
2
+
3
+ ### Bug fixes
4
+
5
+ Limit cursor height in front of custom placeholder DOM elements.
6
+
1
7
  ## 6.10.0 (2023-04-25)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -8352,7 +8352,14 @@ class Placeholder extends WidgetType {
8352
8352
  }
8353
8353
  coordsAt(dom) {
8354
8354
  let rects = dom.firstChild ? clientRectsFor(dom.firstChild) : [];
8355
- return rects.length ? flattenRect(rects[0], window.getComputedStyle(dom).direction != "rtl") : null;
8355
+ if (!rects.length)
8356
+ return null;
8357
+ let style = window.getComputedStyle(dom.parentNode);
8358
+ let rect = flattenRect(rects[0], style.direction != "rtl");
8359
+ let lineHeight = parseInt(style.lineHeight);
8360
+ if (rect.bottom - rect.top > lineHeight * 1.5)
8361
+ return { left: rect.left, right: rect.right, top: rect.top, bottom: rect.top + lineHeight };
8362
+ return rect;
8356
8363
  }
8357
8364
  ignoreEvent() { return false; }
8358
8365
  }
package/dist/index.js CHANGED
@@ -8345,7 +8345,14 @@ class Placeholder extends WidgetType {
8345
8345
  }
8346
8346
  coordsAt(dom) {
8347
8347
  let rects = dom.firstChild ? clientRectsFor(dom.firstChild) : [];
8348
- return rects.length ? flattenRect(rects[0], window.getComputedStyle(dom).direction != "rtl") : null;
8348
+ if (!rects.length)
8349
+ return null;
8350
+ let style = window.getComputedStyle(dom.parentNode);
8351
+ let rect = flattenRect(rects[0], style.direction != "rtl");
8352
+ let lineHeight = parseInt(style.lineHeight);
8353
+ if (rect.bottom - rect.top > lineHeight * 1.5)
8354
+ return { left: rect.left, right: rect.right, top: rect.top, bottom: rect.top + lineHeight };
8355
+ return rect;
8349
8356
  }
8350
8357
  ignoreEvent() { return false; }
8351
8358
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.10.0",
3
+ "version": "6.10.1",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",