@codemirror/view 6.43.6 → 6.43.7

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,15 @@
1
+ ## 6.43.7 (2026-07-27)
2
+
3
+ ### Bug fixes
4
+
5
+ Make the panel container top/bottom style a regular rule, rather than an inline style.
6
+
7
+ Fix an issue where widgets changing length could break content updates.
8
+
9
+ Fix incorrectly drawn selection when a line wrap point lies between widgets.
10
+
11
+ Work around regression in Firefox 153 breaking selection hiding.
12
+
1
13
  ## 6.43.6 (2026-07-06)
2
14
 
3
15
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -1970,6 +1970,9 @@ class LineTile extends CompositeTile {
1970
1970
  }
1971
1971
  get domAttrs() { return this.attrs; }
1972
1972
  // Find the tile associated with a given position in this line.
1973
+ // Side -2/2 is handled specially, in that it allows the position
1974
+ // returned to be before (-2) or after (2) widgets that would always
1975
+ // be after/before a cursor position.
1973
1976
  resolveInline(pos, side, forCoords) {
1974
1977
  let before = null, beforeOff = -1, after = null, afterOff = -1;
1975
1978
  function scan(tile, pos) {
@@ -1980,11 +1983,11 @@ class LineTile extends CompositeTile {
1980
1983
  scan(child, pos - off);
1981
1984
  }
1982
1985
  else if ((!after || after.isHidden && (side > 0 && !(after.flags & 32 /* TileFlag.After */) || forCoords && onSameLine(after, child))) &&
1983
- (end > pos || (child.flags & 32 /* TileFlag.After */))) {
1986
+ (end > pos || (child.flags & 32 /* TileFlag.After */) && side <= 1)) {
1984
1987
  after = child;
1985
1988
  afterOff = pos - off;
1986
1989
  }
1987
- else if (off < pos || (child.flags & 16 /* TileFlag.Before */) && !child.isHidden) {
1990
+ else if (off < pos || (child.flags & 16 /* TileFlag.Before */) && !child.isHidden && side >= -1) {
1988
1991
  before = child;
1989
1992
  beforeOff = pos - off;
1990
1993
  }
@@ -2190,7 +2193,15 @@ class TilePointer {
2190
2193
  let { tile, index, beforeBreak, parents } = this;
2191
2194
  while (dist || side > 0) {
2192
2195
  if (!tile.isComposite()) {
2193
- if (index == tile.length) {
2196
+ let len = tile.length;
2197
+ if (index < len && dist) {
2198
+ let take = Math.min(dist, len - index);
2199
+ if (walker)
2200
+ walker.skip(tile, index, index + take);
2201
+ dist -= take;
2202
+ index += take;
2203
+ }
2204
+ if (index == len) {
2194
2205
  beforeBreak = !!tile.breakAfter;
2195
2206
  ({ tile, index } = parents.pop());
2196
2207
  index++;
@@ -2198,13 +2209,6 @@ class TilePointer {
2198
2209
  else if (!dist) {
2199
2210
  break;
2200
2211
  }
2201
- else {
2202
- let take = Math.min(dist, tile.length - index);
2203
- if (walker)
2204
- walker.skip(tile, index, index + take);
2205
- dist -= take;
2206
- index += take;
2207
- }
2208
2212
  }
2209
2213
  else if (beforeBreak) {
2210
2214
  if (!dist)
@@ -6983,6 +6987,8 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
6983
6987
  backgroundColor: "#f5f5f5",
6984
6988
  color: "black"
6985
6989
  },
6990
+ ".cm-panels-top": { top: "0" },
6991
+ ".cm-panels-bottom": { bottom: "0" },
6986
6992
  "&light .cm-panels-top": {
6987
6993
  borderBottom: "1px solid #ddd"
6988
6994
  },
@@ -9591,9 +9597,10 @@ const selectionLayer = layer({
9591
9597
  },
9592
9598
  class: "cm-selectionLayer"
9593
9599
  });
9600
+ const selectionBg = browser.gecko && browser.gecko_version >= 153 ? "#ffffff01" : "transparent";
9594
9601
  const hideNativeSelection = state.Prec.highest(EditorView.theme({
9595
9602
  ".cm-line": {
9596
- "& ::selection, &::selection": { backgroundColor: "transparent !important" },
9603
+ "& ::selection, &::selection": { backgroundColor: `${selectionBg} !important` },
9597
9604
  caretColor: "transparent !important"
9598
9605
  },
9599
9606
  ".cm-content": {
@@ -11104,7 +11111,6 @@ class PanelGroup {
11104
11111
  if (!this.dom) {
11105
11112
  this.dom = document.createElement("div");
11106
11113
  this.dom.className = this.top ? "cm-panels cm-panels-top" : "cm-panels cm-panels-bottom";
11107
- this.dom.style[this.top ? "top" : "bottom"] = "0";
11108
11114
  let parent = this.container || this.view.dom;
11109
11115
  parent.insertBefore(this.dom, this.top ? parent.firstChild : null);
11110
11116
  }
package/dist/index.js CHANGED
@@ -1966,6 +1966,9 @@ class LineTile extends CompositeTile {
1966
1966
  }
1967
1967
  get domAttrs() { return this.attrs; }
1968
1968
  // Find the tile associated with a given position in this line.
1969
+ // Side -2/2 is handled specially, in that it allows the position
1970
+ // returned to be before (-2) or after (2) widgets that would always
1971
+ // be after/before a cursor position.
1969
1972
  resolveInline(pos, side, forCoords) {
1970
1973
  let before = null, beforeOff = -1, after = null, afterOff = -1;
1971
1974
  function scan(tile, pos) {
@@ -1976,11 +1979,11 @@ class LineTile extends CompositeTile {
1976
1979
  scan(child, pos - off);
1977
1980
  }
1978
1981
  else if ((!after || after.isHidden && (side > 0 && !(after.flags & 32 /* TileFlag.After */) || forCoords && onSameLine(after, child))) &&
1979
- (end > pos || (child.flags & 32 /* TileFlag.After */))) {
1982
+ (end > pos || (child.flags & 32 /* TileFlag.After */) && side <= 1)) {
1980
1983
  after = child;
1981
1984
  afterOff = pos - off;
1982
1985
  }
1983
- else if (off < pos || (child.flags & 16 /* TileFlag.Before */) && !child.isHidden) {
1986
+ else if (off < pos || (child.flags & 16 /* TileFlag.Before */) && !child.isHidden && side >= -1) {
1984
1987
  before = child;
1985
1988
  beforeOff = pos - off;
1986
1989
  }
@@ -2186,7 +2189,15 @@ class TilePointer {
2186
2189
  let { tile, index, beforeBreak, parents } = this;
2187
2190
  while (dist || side > 0) {
2188
2191
  if (!tile.isComposite()) {
2189
- if (index == tile.length) {
2192
+ let len = tile.length;
2193
+ if (index < len && dist) {
2194
+ let take = Math.min(dist, len - index);
2195
+ if (walker)
2196
+ walker.skip(tile, index, index + take);
2197
+ dist -= take;
2198
+ index += take;
2199
+ }
2200
+ if (index == len) {
2190
2201
  beforeBreak = !!tile.breakAfter;
2191
2202
  ({ tile, index } = parents.pop());
2192
2203
  index++;
@@ -2194,13 +2205,6 @@ class TilePointer {
2194
2205
  else if (!dist) {
2195
2206
  break;
2196
2207
  }
2197
- else {
2198
- let take = Math.min(dist, tile.length - index);
2199
- if (walker)
2200
- walker.skip(tile, index, index + take);
2201
- dist -= take;
2202
- index += take;
2203
- }
2204
2208
  }
2205
2209
  else if (beforeBreak) {
2206
2210
  if (!dist)
@@ -6978,6 +6982,8 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
6978
6982
  backgroundColor: "#f5f5f5",
6979
6983
  color: "black"
6980
6984
  },
6985
+ ".cm-panels-top": { top: "0" },
6986
+ ".cm-panels-bottom": { bottom: "0" },
6981
6987
  "&light .cm-panels-top": {
6982
6988
  borderBottom: "1px solid #ddd"
6983
6989
  },
@@ -9586,9 +9592,10 @@ const selectionLayer = /*@__PURE__*/layer({
9586
9592
  },
9587
9593
  class: "cm-selectionLayer"
9588
9594
  });
9595
+ const selectionBg = browser.gecko && browser.gecko_version >= 153 ? "#ffffff01" : "transparent";
9589
9596
  const hideNativeSelection = /*@__PURE__*/Prec.highest(/*@__PURE__*/EditorView.theme({
9590
9597
  ".cm-line": {
9591
- "& ::selection, &::selection": { backgroundColor: "transparent !important" },
9598
+ "& ::selection, &::selection": { backgroundColor: `${selectionBg} !important` },
9592
9599
  caretColor: "transparent !important"
9593
9600
  },
9594
9601
  ".cm-content": {
@@ -11099,7 +11106,6 @@ class PanelGroup {
11099
11106
  if (!this.dom) {
11100
11107
  this.dom = document.createElement("div");
11101
11108
  this.dom.className = this.top ? "cm-panels cm-panels-top" : "cm-panels cm-panels-bottom";
11102
- this.dom.style[this.top ? "top" : "bottom"] = "0";
11103
11109
  let parent = this.container || this.view.dom;
11104
11110
  parent.insertBefore(this.dom, this.top ? parent.firstChild : null);
11105
11111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.43.6",
3
+ "version": "6.43.7",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",