@codemirror/view 6.22.1 → 6.22.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,19 @@
1
+ ## 6.22.3 (2023-12-13)
2
+
3
+ ### Bug fixes
4
+
5
+ Fix a bug that could cause tooltips to be unnecessarily be positioned absolutely.
6
+
7
+ Make sure that, when an editor creates tooltips immediately on initialization, the editor is attached to the document when their `mount` callback is called.
8
+
9
+ ## 6.22.2 (2023-12-08)
10
+
11
+ ### Bug fixes
12
+
13
+ Fix an issue in the bidirectional motion that could cause the cursor to get stuck in a loop when a zero-width non-joiner char was placed on a direction boundary.
14
+
15
+ Fix a bug that corrupts the editor's internal view tree data structure on some types of edits, putting the editor in a broken state.
16
+
1
17
  ## 6.22.1 (2023-11-27)
2
18
 
3
19
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -96,6 +96,15 @@ function windowRect(win) {
96
96
  return { left: 0, right: win.innerWidth,
97
97
  top: 0, bottom: win.innerHeight };
98
98
  }
99
+ function getScale(elt, rect) {
100
+ let scaleX = rect.width / elt.offsetWidth;
101
+ let scaleY = rect.height / elt.offsetHeight;
102
+ if (scaleX > 0.995 && scaleX < 1.005 || !isFinite(scaleX) || Math.abs(rect.width - elt.offsetWidth) < 1)
103
+ scaleX = 1;
104
+ if (scaleY > 0.995 && scaleY < 1.005 || !isFinite(scaleY) || Math.abs(rect.height - elt.offsetHeight) < 1)
105
+ scaleY = 1;
106
+ return { scaleX, scaleY };
107
+ }
99
108
  function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
100
109
  let doc = dom.ownerDocument, win = doc.defaultView || window;
101
110
  for (let cur = dom, stop = false; cur && !stop;) {
@@ -113,8 +122,7 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
113
122
  continue;
114
123
  }
115
124
  let rect = cur.getBoundingClientRect();
116
- scaleX = rect.width / cur.offsetWidth;
117
- scaleY = rect.height / cur.offsetHeight;
125
+ ({ scaleX, scaleY } = getScale(cur, rect));
118
126
  // Make sure scrollbar width isn't included in the rectangle
119
127
  bounding = { left: rect.left, right: rect.left + cur.clientWidth * scaleX,
120
128
  top: rect.top, bottom: rect.top + cur.clientHeight * scaleY };
@@ -541,7 +549,8 @@ class ContentView {
541
549
  getSide() { return 0; }
542
550
  destroy() {
543
551
  for (let child of this.children)
544
- child.destroy();
552
+ if (child.parent == this)
553
+ child.destroy();
545
554
  this.parent = null;
546
555
  }
547
556
  }
@@ -778,7 +787,7 @@ class MarkView extends ContentView {
778
787
  if (source && (!(source instanceof MarkView && source.mark.eq(this.mark)) ||
779
788
  (from && openStart <= 0) || (to < this.length && openEnd <= 0)))
780
789
  return false;
781
- mergeChildrenInto(this, from, to, source ? source.children : [], openStart - 1, openEnd - 1);
790
+ mergeChildrenInto(this, from, to, source ? source.children.slice() : [], openStart - 1, openEnd - 1);
782
791
  this.markDirty();
783
792
  return true;
784
793
  }
@@ -1114,7 +1123,7 @@ class LineView extends ContentView {
1114
1123
  }
1115
1124
  if (hasStart)
1116
1125
  this.setDeco(source ? source.attrs : null);
1117
- mergeChildrenInto(this, from, to, source ? source.children : [], openStart, openEnd);
1126
+ mergeChildrenInto(this, from, to, source ? source.children.slice() : [], openStart, openEnd);
1118
1127
  return true;
1119
1128
  }
1120
1129
  split(at) {
@@ -2185,9 +2194,8 @@ function charType(ch) {
2185
2194
  0x590 <= ch && ch <= 0x5f4 ? 2 /* T.R */ :
2186
2195
  0x600 <= ch && ch <= 0x6f9 ? ArabicTypes[ch - 0x600] :
2187
2196
  0x6ee <= ch && ch <= 0x8ac ? 4 /* T.AL */ :
2188
- 0x2000 <= ch && ch <= 0x200b ? 256 /* T.NI */ :
2189
- 0xfb50 <= ch && ch <= 0xfdff ? 4 /* T.AL */ :
2190
- ch == 0x200c ? 256 /* T.NI */ : 1 /* T.L */;
2197
+ 0x2000 <= ch && ch <= 0x200c ? 256 /* T.NI */ :
2198
+ 0xfb50 <= ch && ch <= 0xfdff ? 4 /* T.AL */ : 1 /* T.L */;
2191
2199
  }
2192
2200
  const BidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;
2193
2201
  /**
@@ -2608,7 +2616,7 @@ function moveVisually(line, order, dir, start, forward) {
2608
2616
  let indexForward = forward == (span.dir == dir);
2609
2617
  let nextIndex = state.findClusterBreak(line.text, startIndex, indexForward);
2610
2618
  movedOver = line.text.slice(Math.min(startIndex, nextIndex), Math.max(startIndex, nextIndex));
2611
- if (nextIndex != span.side(forward, dir))
2619
+ if (nextIndex > span.from && nextIndex < span.to)
2612
2620
  return state.EditorSelection.cursor(nextIndex + line.from, indexForward ? -1 : 1, span.level);
2613
2621
  let nextSpan = spanI == (forward ? order.length - 1 : 0) ? null : order[spanI + (forward ? 1 : -1)];
2614
2622
  if (!nextSpan && span.level != dir)
@@ -5362,12 +5370,7 @@ class ViewState {
5362
5370
  this.mustMeasureContent = false;
5363
5371
  let result = 0, bias = 0;
5364
5372
  if (domRect.width && domRect.height) {
5365
- let scaleX = domRect.width / dom.offsetWidth;
5366
- let scaleY = domRect.height / dom.offsetHeight;
5367
- if (scaleX > 0.995 && scaleX < 1.005 || !isFinite(scaleX) || Math.abs(domRect.width - dom.offsetWidth) < 1)
5368
- scaleX = 1;
5369
- if (scaleY > 0.995 && scaleY < 1.005 || !isFinite(scaleY) || Math.abs(domRect.height - dom.offsetHeight) < 1)
5370
- scaleY = 1;
5373
+ let { scaleX, scaleY } = getScale(dom, domRect);
5371
5374
  if (this.scaleX != scaleX || this.scaleY != scaleY) {
5372
5375
  this.scaleX = scaleX;
5373
5376
  this.scaleY = scaleY;
@@ -5812,7 +5815,7 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
5812
5815
  flexShrink: 0,
5813
5816
  display: "block",
5814
5817
  whiteSpace: "pre",
5815
- wordWrap: "normal",
5818
+ wordWrap: "normal", // https://github.com/codemirror/dev/issues/456
5816
5819
  boxSizing: "border-box",
5817
5820
  minHeight: "100%",
5818
5821
  padding: "4px 0",
@@ -5822,9 +5825,9 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
5822
5825
  }
5823
5826
  },
5824
5827
  ".cm-lineWrapping": {
5825
- whiteSpace_fallback: "pre-wrap",
5828
+ whiteSpace_fallback: "pre-wrap", // For IE
5826
5829
  whiteSpace: "break-spaces",
5827
- wordBreak: "break-word",
5830
+ wordBreak: "break-word", // For Safari, which doesn't support overflow-wrap: anywhere
5828
5831
  overflowWrap: "anywhere",
5829
5832
  flexShrink: 1
5830
5833
  },
@@ -5912,7 +5915,7 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
5912
5915
  color: "#ccc"
5913
5916
  },
5914
5917
  ".cm-gutter": {
5915
- display: "flex !important",
5918
+ display: "flex !important", // Necessary -- prevents margin collapsing
5916
5919
  flexDirection: "column",
5917
5920
  flexShrink: 0,
5918
5921
  boxSizing: "border-box",
@@ -6943,6 +6946,8 @@ class EditorView {
6943
6946
  this.dom = document.createElement("div");
6944
6947
  this.dom.appendChild(this.announceDOM);
6945
6948
  this.dom.appendChild(this.scrollDOM);
6949
+ if (config.parent)
6950
+ config.parent.appendChild(this.dom);
6946
6951
  let { dispatch } = config;
6947
6952
  this.dispatchTransactions = config.dispatchTransactions ||
6948
6953
  (dispatch && ((trs) => trs.forEach(tr => dispatch(tr, this)))) ||
@@ -6963,8 +6968,6 @@ class EditorView {
6963
6968
  this.updateAttrs();
6964
6969
  this.updateState = 0 /* UpdateState.Idle */;
6965
6970
  this.requestMeasure();
6966
- if (config.parent)
6967
- config.parent.appendChild(this.dom);
6968
6971
  }
6969
6972
  dispatch(...input) {
6970
6973
  let trs = input.length == 1 && input[0] instanceof state.Transaction ? input
@@ -7237,6 +7240,7 @@ class EditorView {
7237
7240
  if (this.viewState.scrollTarget) {
7238
7241
  this.docView.scrollIntoView(this.viewState.scrollTarget);
7239
7242
  this.viewState.scrollTarget = null;
7243
+ scrollAnchorHeight = -1;
7240
7244
  continue;
7241
7245
  }
7242
7246
  else {
@@ -9298,16 +9302,11 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
9298
9302
  // positioning.
9299
9303
  makeAbsolute = dom.offsetParent != this.container.ownerDocument.body;
9300
9304
  }
9301
- else {
9305
+ else if (dom.style.top == Outside && dom.style.left == "0px") {
9302
9306
  // On other browsers, we have to awkwardly try and use other
9303
9307
  // information to detect a transform.
9304
- if (this.view.scaleX != 1 || this.view.scaleY != 1) {
9305
- makeAbsolute = true;
9306
- }
9307
- else if (dom.style.top == Outside && dom.style.left == "0px") {
9308
- let rect = dom.getBoundingClientRect();
9309
- makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
9310
- }
9308
+ let rect = dom.getBoundingClientRect();
9309
+ makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
9311
9310
  }
9312
9311
  }
9313
9312
  if (makeAbsolute || this.position == "absolute") {
package/dist/index.d.cts CHANGED
@@ -2117,4 +2117,4 @@ trailing whitespace.
2117
2117
  */
2118
2118
  declare function highlightTrailingWhitespace(): Extension;
2119
2119
 
2120
- export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, EditorViewConfig, GutterMarker, KeyBinding, LayerMarker, MatchDecorator, MouseSelectionStyle, Panel, PanelConstructor, PluginSpec, PluginValue, Rect, RectangleMarker, Tooltip, TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
2120
+ export { BidiSpan, BlockInfo, BlockType, type Command, type DOMEventHandlers, type DOMEventMap, Decoration, type DecorationSet, Direction, EditorView, type EditorViewConfig, GutterMarker, type KeyBinding, type LayerMarker, MatchDecorator, type MouseSelectionStyle, type Panel, type PanelConstructor, type PluginSpec, type PluginValue, type Rect, RectangleMarker, type Tooltip, type TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
package/dist/index.d.ts CHANGED
@@ -2117,4 +2117,4 @@ trailing whitespace.
2117
2117
  */
2118
2118
  declare function highlightTrailingWhitespace(): Extension;
2119
2119
 
2120
- export { BidiSpan, BlockInfo, BlockType, Command, DOMEventHandlers, DOMEventMap, Decoration, DecorationSet, Direction, EditorView, EditorViewConfig, GutterMarker, KeyBinding, LayerMarker, MatchDecorator, MouseSelectionStyle, Panel, PanelConstructor, PluginSpec, PluginValue, Rect, RectangleMarker, Tooltip, TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
2120
+ export { BidiSpan, BlockInfo, BlockType, type Command, type DOMEventHandlers, type DOMEventMap, Decoration, type DecorationSet, Direction, EditorView, type EditorViewConfig, GutterMarker, type KeyBinding, type LayerMarker, MatchDecorator, type MouseSelectionStyle, type Panel, type PanelConstructor, type PluginSpec, type PluginValue, type Rect, RectangleMarker, type Tooltip, type TooltipView, ViewPlugin, ViewUpdate, WidgetType, closeHoverTooltips, crosshairCursor, drawSelection, dropCursor, getDrawSelectionConfig, getPanel, getTooltip, gutter, gutterLineClass, gutters, hasHoverTooltips, highlightActiveLine, highlightActiveLineGutter, highlightSpecialChars, highlightTrailingWhitespace, highlightWhitespace, hoverTooltip, keymap, layer, lineNumberMarkers, lineNumbers, logException, panels, placeholder, rectangularSelection, repositionTooltips, runScopeHandlers, scrollPastEnd, showPanel, showTooltip, tooltips };
package/dist/index.js CHANGED
@@ -94,6 +94,15 @@ function windowRect(win) {
94
94
  return { left: 0, right: win.innerWidth,
95
95
  top: 0, bottom: win.innerHeight };
96
96
  }
97
+ function getScale(elt, rect) {
98
+ let scaleX = rect.width / elt.offsetWidth;
99
+ let scaleY = rect.height / elt.offsetHeight;
100
+ if (scaleX > 0.995 && scaleX < 1.005 || !isFinite(scaleX) || Math.abs(rect.width - elt.offsetWidth) < 1)
101
+ scaleX = 1;
102
+ if (scaleY > 0.995 && scaleY < 1.005 || !isFinite(scaleY) || Math.abs(rect.height - elt.offsetHeight) < 1)
103
+ scaleY = 1;
104
+ return { scaleX, scaleY };
105
+ }
97
106
  function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
98
107
  let doc = dom.ownerDocument, win = doc.defaultView || window;
99
108
  for (let cur = dom, stop = false; cur && !stop;) {
@@ -111,8 +120,7 @@ function scrollRectIntoView(dom, rect, side, x, y, xMargin, yMargin, ltr) {
111
120
  continue;
112
121
  }
113
122
  let rect = cur.getBoundingClientRect();
114
- scaleX = rect.width / cur.offsetWidth;
115
- scaleY = rect.height / cur.offsetHeight;
123
+ ({ scaleX, scaleY } = getScale(cur, rect));
116
124
  // Make sure scrollbar width isn't included in the rectangle
117
125
  bounding = { left: rect.left, right: rect.left + cur.clientWidth * scaleX,
118
126
  top: rect.top, bottom: rect.top + cur.clientHeight * scaleY };
@@ -539,7 +547,8 @@ class ContentView {
539
547
  getSide() { return 0; }
540
548
  destroy() {
541
549
  for (let child of this.children)
542
- child.destroy();
550
+ if (child.parent == this)
551
+ child.destroy();
543
552
  this.parent = null;
544
553
  }
545
554
  }
@@ -776,7 +785,7 @@ class MarkView extends ContentView {
776
785
  if (source && (!(source instanceof MarkView && source.mark.eq(this.mark)) ||
777
786
  (from && openStart <= 0) || (to < this.length && openEnd <= 0)))
778
787
  return false;
779
- mergeChildrenInto(this, from, to, source ? source.children : [], openStart - 1, openEnd - 1);
788
+ mergeChildrenInto(this, from, to, source ? source.children.slice() : [], openStart - 1, openEnd - 1);
780
789
  this.markDirty();
781
790
  return true;
782
791
  }
@@ -1112,7 +1121,7 @@ class LineView extends ContentView {
1112
1121
  }
1113
1122
  if (hasStart)
1114
1123
  this.setDeco(source ? source.attrs : null);
1115
- mergeChildrenInto(this, from, to, source ? source.children : [], openStart, openEnd);
1124
+ mergeChildrenInto(this, from, to, source ? source.children.slice() : [], openStart, openEnd);
1116
1125
  return true;
1117
1126
  }
1118
1127
  split(at) {
@@ -2181,9 +2190,8 @@ function charType(ch) {
2181
2190
  0x590 <= ch && ch <= 0x5f4 ? 2 /* T.R */ :
2182
2191
  0x600 <= ch && ch <= 0x6f9 ? ArabicTypes[ch - 0x600] :
2183
2192
  0x6ee <= ch && ch <= 0x8ac ? 4 /* T.AL */ :
2184
- 0x2000 <= ch && ch <= 0x200b ? 256 /* T.NI */ :
2185
- 0xfb50 <= ch && ch <= 0xfdff ? 4 /* T.AL */ :
2186
- ch == 0x200c ? 256 /* T.NI */ : 1 /* T.L */;
2193
+ 0x2000 <= ch && ch <= 0x200c ? 256 /* T.NI */ :
2194
+ 0xfb50 <= ch && ch <= 0xfdff ? 4 /* T.AL */ : 1 /* T.L */;
2187
2195
  }
2188
2196
  const BidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;
2189
2197
  /**
@@ -2604,7 +2612,7 @@ function moveVisually(line, order, dir, start, forward) {
2604
2612
  let indexForward = forward == (span.dir == dir);
2605
2613
  let nextIndex = findClusterBreak(line.text, startIndex, indexForward);
2606
2614
  movedOver = line.text.slice(Math.min(startIndex, nextIndex), Math.max(startIndex, nextIndex));
2607
- if (nextIndex != span.side(forward, dir))
2615
+ if (nextIndex > span.from && nextIndex < span.to)
2608
2616
  return EditorSelection.cursor(nextIndex + line.from, indexForward ? -1 : 1, span.level);
2609
2617
  let nextSpan = spanI == (forward ? order.length - 1 : 0) ? null : order[spanI + (forward ? 1 : -1)];
2610
2618
  if (!nextSpan && span.level != dir)
@@ -5357,12 +5365,7 @@ class ViewState {
5357
5365
  this.mustMeasureContent = false;
5358
5366
  let result = 0, bias = 0;
5359
5367
  if (domRect.width && domRect.height) {
5360
- let scaleX = domRect.width / dom.offsetWidth;
5361
- let scaleY = domRect.height / dom.offsetHeight;
5362
- if (scaleX > 0.995 && scaleX < 1.005 || !isFinite(scaleX) || Math.abs(domRect.width - dom.offsetWidth) < 1)
5363
- scaleX = 1;
5364
- if (scaleY > 0.995 && scaleY < 1.005 || !isFinite(scaleY) || Math.abs(domRect.height - dom.offsetHeight) < 1)
5365
- scaleY = 1;
5368
+ let { scaleX, scaleY } = getScale(dom, domRect);
5366
5369
  if (this.scaleX != scaleX || this.scaleY != scaleY) {
5367
5370
  this.scaleX = scaleX;
5368
5371
  this.scaleY = scaleY;
@@ -5807,7 +5810,7 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
5807
5810
  flexShrink: 0,
5808
5811
  display: "block",
5809
5812
  whiteSpace: "pre",
5810
- wordWrap: "normal",
5813
+ wordWrap: "normal", // https://github.com/codemirror/dev/issues/456
5811
5814
  boxSizing: "border-box",
5812
5815
  minHeight: "100%",
5813
5816
  padding: "4px 0",
@@ -5817,9 +5820,9 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
5817
5820
  }
5818
5821
  },
5819
5822
  ".cm-lineWrapping": {
5820
- whiteSpace_fallback: "pre-wrap",
5823
+ whiteSpace_fallback: "pre-wrap", // For IE
5821
5824
  whiteSpace: "break-spaces",
5822
- wordBreak: "break-word",
5825
+ wordBreak: "break-word", // For Safari, which doesn't support overflow-wrap: anywhere
5823
5826
  overflowWrap: "anywhere",
5824
5827
  flexShrink: 1
5825
5828
  },
@@ -5907,7 +5910,7 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
5907
5910
  color: "#ccc"
5908
5911
  },
5909
5912
  ".cm-gutter": {
5910
- display: "flex !important",
5913
+ display: "flex !important", // Necessary -- prevents margin collapsing
5911
5914
  flexDirection: "column",
5912
5915
  flexShrink: 0,
5913
5916
  boxSizing: "border-box",
@@ -6938,6 +6941,8 @@ class EditorView {
6938
6941
  this.dom = document.createElement("div");
6939
6942
  this.dom.appendChild(this.announceDOM);
6940
6943
  this.dom.appendChild(this.scrollDOM);
6944
+ if (config.parent)
6945
+ config.parent.appendChild(this.dom);
6941
6946
  let { dispatch } = config;
6942
6947
  this.dispatchTransactions = config.dispatchTransactions ||
6943
6948
  (dispatch && ((trs) => trs.forEach(tr => dispatch(tr, this)))) ||
@@ -6958,8 +6963,6 @@ class EditorView {
6958
6963
  this.updateAttrs();
6959
6964
  this.updateState = 0 /* UpdateState.Idle */;
6960
6965
  this.requestMeasure();
6961
- if (config.parent)
6962
- config.parent.appendChild(this.dom);
6963
6966
  }
6964
6967
  dispatch(...input) {
6965
6968
  let trs = input.length == 1 && input[0] instanceof Transaction ? input
@@ -7232,6 +7235,7 @@ class EditorView {
7232
7235
  if (this.viewState.scrollTarget) {
7233
7236
  this.docView.scrollIntoView(this.viewState.scrollTarget);
7234
7237
  this.viewState.scrollTarget = null;
7238
+ scrollAnchorHeight = -1;
7235
7239
  continue;
7236
7240
  }
7237
7241
  else {
@@ -9293,16 +9297,11 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
9293
9297
  // positioning.
9294
9298
  makeAbsolute = dom.offsetParent != this.container.ownerDocument.body;
9295
9299
  }
9296
- else {
9300
+ else if (dom.style.top == Outside && dom.style.left == "0px") {
9297
9301
  // On other browsers, we have to awkwardly try and use other
9298
9302
  // information to detect a transform.
9299
- if (this.view.scaleX != 1 || this.view.scaleY != 1) {
9300
- makeAbsolute = true;
9301
- }
9302
- else if (dom.style.top == Outside && dom.style.left == "0px") {
9303
- let rect = dom.getBoundingClientRect();
9304
- makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
9305
- }
9303
+ let rect = dom.getBoundingClientRect();
9304
+ makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
9306
9305
  }
9307
9306
  }
9308
9307
  if (makeAbsolute || this.position == "absolute") {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.22.1",
3
+ "version": "6.22.3",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",