@codemirror/view 6.22.2 → 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,11 @@
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
+
1
9
  ## 6.22.2 (2023-12-08)
2
10
 
3
11
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -5815,7 +5815,7 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
5815
5815
  flexShrink: 0,
5816
5816
  display: "block",
5817
5817
  whiteSpace: "pre",
5818
- wordWrap: "normal",
5818
+ wordWrap: "normal", // https://github.com/codemirror/dev/issues/456
5819
5819
  boxSizing: "border-box",
5820
5820
  minHeight: "100%",
5821
5821
  padding: "4px 0",
@@ -5825,9 +5825,9 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
5825
5825
  }
5826
5826
  },
5827
5827
  ".cm-lineWrapping": {
5828
- whiteSpace_fallback: "pre-wrap",
5828
+ whiteSpace_fallback: "pre-wrap", // For IE
5829
5829
  whiteSpace: "break-spaces",
5830
- wordBreak: "break-word",
5830
+ wordBreak: "break-word", // For Safari, which doesn't support overflow-wrap: anywhere
5831
5831
  overflowWrap: "anywhere",
5832
5832
  flexShrink: 1
5833
5833
  },
@@ -5915,7 +5915,7 @@ const baseTheme$1 = buildTheme("." + baseThemeID, {
5915
5915
  color: "#ccc"
5916
5916
  },
5917
5917
  ".cm-gutter": {
5918
- display: "flex !important",
5918
+ display: "flex !important", // Necessary -- prevents margin collapsing
5919
5919
  flexDirection: "column",
5920
5920
  flexShrink: 0,
5921
5921
  boxSizing: "border-box",
@@ -6946,6 +6946,8 @@ class EditorView {
6946
6946
  this.dom = document.createElement("div");
6947
6947
  this.dom.appendChild(this.announceDOM);
6948
6948
  this.dom.appendChild(this.scrollDOM);
6949
+ if (config.parent)
6950
+ config.parent.appendChild(this.dom);
6949
6951
  let { dispatch } = config;
6950
6952
  this.dispatchTransactions = config.dispatchTransactions ||
6951
6953
  (dispatch && ((trs) => trs.forEach(tr => dispatch(tr, this)))) ||
@@ -6966,8 +6968,6 @@ class EditorView {
6966
6968
  this.updateAttrs();
6967
6969
  this.updateState = 0 /* UpdateState.Idle */;
6968
6970
  this.requestMeasure();
6969
- if (config.parent)
6970
- config.parent.appendChild(this.dom);
6971
6971
  }
6972
6972
  dispatch(...input) {
6973
6973
  let trs = input.length == 1 && input[0] instanceof state.Transaction ? input
@@ -9302,16 +9302,11 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
9302
9302
  // positioning.
9303
9303
  makeAbsolute = dom.offsetParent != this.container.ownerDocument.body;
9304
9304
  }
9305
- else {
9305
+ else if (dom.style.top == Outside && dom.style.left == "0px") {
9306
9306
  // On other browsers, we have to awkwardly try and use other
9307
9307
  // information to detect a transform.
9308
- if (this.view.scaleX != 1 || this.view.scaleY != 1) {
9309
- makeAbsolute = true;
9310
- }
9311
- else if (dom.style.top == Outside && dom.style.left == "0px") {
9312
- let rect = dom.getBoundingClientRect();
9313
- makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
9314
- }
9308
+ let rect = dom.getBoundingClientRect();
9309
+ makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
9315
9310
  }
9316
9311
  }
9317
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
@@ -5810,7 +5810,7 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
5810
5810
  flexShrink: 0,
5811
5811
  display: "block",
5812
5812
  whiteSpace: "pre",
5813
- wordWrap: "normal",
5813
+ wordWrap: "normal", // https://github.com/codemirror/dev/issues/456
5814
5814
  boxSizing: "border-box",
5815
5815
  minHeight: "100%",
5816
5816
  padding: "4px 0",
@@ -5820,9 +5820,9 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
5820
5820
  }
5821
5821
  },
5822
5822
  ".cm-lineWrapping": {
5823
- whiteSpace_fallback: "pre-wrap",
5823
+ whiteSpace_fallback: "pre-wrap", // For IE
5824
5824
  whiteSpace: "break-spaces",
5825
- wordBreak: "break-word",
5825
+ wordBreak: "break-word", // For Safari, which doesn't support overflow-wrap: anywhere
5826
5826
  overflowWrap: "anywhere",
5827
5827
  flexShrink: 1
5828
5828
  },
@@ -5910,7 +5910,7 @@ const baseTheme$1 = /*@__PURE__*/buildTheme("." + baseThemeID, {
5910
5910
  color: "#ccc"
5911
5911
  },
5912
5912
  ".cm-gutter": {
5913
- display: "flex !important",
5913
+ display: "flex !important", // Necessary -- prevents margin collapsing
5914
5914
  flexDirection: "column",
5915
5915
  flexShrink: 0,
5916
5916
  boxSizing: "border-box",
@@ -6941,6 +6941,8 @@ class EditorView {
6941
6941
  this.dom = document.createElement("div");
6942
6942
  this.dom.appendChild(this.announceDOM);
6943
6943
  this.dom.appendChild(this.scrollDOM);
6944
+ if (config.parent)
6945
+ config.parent.appendChild(this.dom);
6944
6946
  let { dispatch } = config;
6945
6947
  this.dispatchTransactions = config.dispatchTransactions ||
6946
6948
  (dispatch && ((trs) => trs.forEach(tr => dispatch(tr, this)))) ||
@@ -6961,8 +6963,6 @@ class EditorView {
6961
6963
  this.updateAttrs();
6962
6964
  this.updateState = 0 /* UpdateState.Idle */;
6963
6965
  this.requestMeasure();
6964
- if (config.parent)
6965
- config.parent.appendChild(this.dom);
6966
6966
  }
6967
6967
  dispatch(...input) {
6968
6968
  let trs = input.length == 1 && input[0] instanceof Transaction ? input
@@ -9297,16 +9297,11 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
9297
9297
  // positioning.
9298
9298
  makeAbsolute = dom.offsetParent != this.container.ownerDocument.body;
9299
9299
  }
9300
- else {
9300
+ else if (dom.style.top == Outside && dom.style.left == "0px") {
9301
9301
  // On other browsers, we have to awkwardly try and use other
9302
9302
  // information to detect a transform.
9303
- if (this.view.scaleX != 1 || this.view.scaleY != 1) {
9304
- makeAbsolute = true;
9305
- }
9306
- else if (dom.style.top == Outside && dom.style.left == "0px") {
9307
- let rect = dom.getBoundingClientRect();
9308
- makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
9309
- }
9303
+ let rect = dom.getBoundingClientRect();
9304
+ makeAbsolute = Math.abs(rect.top + 10000) > 1 || Math.abs(rect.left) > 1;
9310
9305
  }
9311
9306
  }
9312
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.2",
3
+ "version": "6.22.3",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",