@codemirror/view 0.19.41 → 0.19.42

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
+ ## 0.19.42 (2022-02-05)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a regression in cursor position determination after making an edit next to a widget.
6
+
1
7
  ## 0.19.41 (2022-02-04)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -2371,7 +2371,7 @@ class DOMReader {
2371
2371
  let view = ContentView.get(node);
2372
2372
  let fromView = view && view.overrideDOMText;
2373
2373
  if (fromView != null) {
2374
- this.findPointInside(node);
2374
+ this.findPointInside(node, fromView.length);
2375
2375
  for (let i = fromView.iter(); !i.next().done;) {
2376
2376
  if (i.lineBreak)
2377
2377
  this.lineBreak();
@@ -2395,10 +2395,10 @@ class DOMReader {
2395
2395
  if (point.node == node && node.childNodes[point.offset] == next)
2396
2396
  point.pos = this.text.length;
2397
2397
  }
2398
- findPointInside(node) {
2398
+ findPointInside(node, maxLen) {
2399
2399
  for (let point of this.points)
2400
2400
  if (node.nodeType == 3 ? point.node == node : node.contains(point.node))
2401
- point.pos = this.text.length;
2401
+ point.pos = this.text.length + Math.min(maxLen, point.offset);
2402
2402
  }
2403
2403
  }
2404
2404
  function isBlockElement(node) {
package/dist/index.js CHANGED
@@ -2366,7 +2366,7 @@ class DOMReader {
2366
2366
  let view = ContentView.get(node);
2367
2367
  let fromView = view && view.overrideDOMText;
2368
2368
  if (fromView != null) {
2369
- this.findPointInside(node);
2369
+ this.findPointInside(node, fromView.length);
2370
2370
  for (let i = fromView.iter(); !i.next().done;) {
2371
2371
  if (i.lineBreak)
2372
2372
  this.lineBreak();
@@ -2390,10 +2390,10 @@ class DOMReader {
2390
2390
  if (point.node == node && node.childNodes[point.offset] == next)
2391
2391
  point.pos = this.text.length;
2392
2392
  }
2393
- findPointInside(node) {
2393
+ findPointInside(node, maxLen) {
2394
2394
  for (let point of this.points)
2395
2395
  if (node.nodeType == 3 ? point.node == node : node.contains(point.node))
2396
- point.pos = this.text.length;
2396
+ point.pos = this.text.length + Math.min(maxLen, point.offset);
2397
2397
  }
2398
2398
  }
2399
2399
  function isBlockElement(node) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "0.19.41",
3
+ "version": "0.19.42",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",