@codemirror/view 0.19.16 → 0.19.17

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.17 (2021-11-16)
2
+
3
+ ### Bug fixes
4
+
5
+ Avoid an issue where stretches of whitespace on line wrap points could cause the cursor to be placed outside of the content.
6
+
1
7
  ## 0.19.16 (2021-11-11)
2
8
 
3
9
  ### Breaking changes
package/dist/index.cjs CHANGED
@@ -666,7 +666,7 @@ function textCoords(text, pos, side) {
666
666
  let rect = rects[(flatten ? flatten < 0 : side >= 0) ? 0 : rects.length - 1];
667
667
  if (browser.safari && !flatten && rect.width == 0)
668
668
  rect = Array.prototype.find.call(rects, r => r.width) || rect;
669
- return flatten ? flattenRect(rect, flatten < 0) : rect;
669
+ return flatten ? flattenRect(rect, flatten < 0) : rect || null;
670
670
  }
671
671
  // Also used for collapsed ranges that don't have a placeholder widget!
672
672
  class WidgetView extends InlineView {
@@ -774,7 +774,7 @@ class WidgetBufferView extends InlineView {
774
774
  domBoundsAround() { return null; }
775
775
  coordsAt(pos) {
776
776
  let rects = clientRectsFor(this.dom);
777
- return rects[rects.length - 1];
777
+ return rects[rects.length - 1] || null;
778
778
  }
779
779
  get overrideDOMText() {
780
780
  return text.Text.of([this.dom.nodeValue.replace(/\u200b/g, "")]);
@@ -916,7 +916,7 @@ function coordsInChildren(view, pos, side) {
916
916
  if (!last)
917
917
  return view.dom.getBoundingClientRect();
918
918
  let rects = clientRectsFor(last);
919
- return rects[rects.length - 1];
919
+ return rects[rects.length - 1] || null;
920
920
  }
921
921
 
922
922
  function combineAttrs(source, target) {
@@ -4938,7 +4938,8 @@ const baseTheme = buildTheme("." + baseThemeID, {
4938
4938
  }
4939
4939
  },
4940
4940
  ".cm-lineWrapping": {
4941
- whiteSpace: "pre-wrap",
4941
+ whiteSpace_fallback: "pre-wrap",
4942
+ whiteSpace: "break-spaces",
4942
4943
  wordBreak: "break-word",
4943
4944
  overflowWrap: "anywhere"
4944
4945
  },
package/dist/index.js CHANGED
@@ -663,7 +663,7 @@ function textCoords(text, pos, side) {
663
663
  let rect = rects[(flatten ? flatten < 0 : side >= 0) ? 0 : rects.length - 1];
664
664
  if (browser.safari && !flatten && rect.width == 0)
665
665
  rect = Array.prototype.find.call(rects, r => r.width) || rect;
666
- return flatten ? flattenRect(rect, flatten < 0) : rect;
666
+ return flatten ? flattenRect(rect, flatten < 0) : rect || null;
667
667
  }
668
668
  // Also used for collapsed ranges that don't have a placeholder widget!
669
669
  class WidgetView extends InlineView {
@@ -771,7 +771,7 @@ class WidgetBufferView extends InlineView {
771
771
  domBoundsAround() { return null; }
772
772
  coordsAt(pos) {
773
773
  let rects = clientRectsFor(this.dom);
774
- return rects[rects.length - 1];
774
+ return rects[rects.length - 1] || null;
775
775
  }
776
776
  get overrideDOMText() {
777
777
  return Text.of([this.dom.nodeValue.replace(/\u200b/g, "")]);
@@ -913,7 +913,7 @@ function coordsInChildren(view, pos, side) {
913
913
  if (!last)
914
914
  return view.dom.getBoundingClientRect();
915
915
  let rects = clientRectsFor(last);
916
- return rects[rects.length - 1];
916
+ return rects[rects.length - 1] || null;
917
917
  }
918
918
 
919
919
  function combineAttrs(source, target) {
@@ -4932,7 +4932,8 @@ const baseTheme = /*@__PURE__*/buildTheme("." + baseThemeID, {
4932
4932
  }
4933
4933
  },
4934
4934
  ".cm-lineWrapping": {
4935
- whiteSpace: "pre-wrap",
4935
+ whiteSpace_fallback: "pre-wrap",
4936
+ whiteSpace: "break-spaces",
4936
4937
  wordBreak: "break-word",
4937
4938
  overflowWrap: "anywhere"
4938
4939
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "0.19.16",
3
+ "version": "0.19.17",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",