@codemirror/view 6.34.3 → 6.35.0

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
+ ## 6.35.0 (2024-11-21)
2
+
3
+ ### New features
4
+
5
+ Tooltips can now use the `clip` option to control whether they are hidden when outside the visible editor content.
6
+
1
7
  ## 6.34.3 (2024-11-15)
2
8
 
3
9
  ### Bug fixes
package/dist/index.cjs CHANGED
@@ -9949,10 +9949,10 @@ const tooltipPlugin = ViewPlugin.fromClass(class {
9949
9949
  let tooltip = this.manager.tooltips[i], tView = this.manager.tooltipViews[i], { dom } = tView;
9950
9950
  let pos = measured.pos[i], size = measured.size[i];
9951
9951
  // Hide tooltips that are outside of the editor.
9952
- if (!pos || pos.bottom <= Math.max(visible.top, space.top) ||
9952
+ if (!pos || tooltip.clip !== false && (pos.bottom <= Math.max(visible.top, space.top) ||
9953
9953
  pos.top >= Math.min(visible.bottom, space.bottom) ||
9954
9954
  pos.right < Math.max(visible.left, space.left) - .1 ||
9955
- pos.left > Math.min(visible.right, space.right) + .1) {
9955
+ pos.left > Math.min(visible.right, space.right) + .1)) {
9956
9956
  dom.style.top = Outside;
9957
9957
  continue;
9958
9958
  }
package/dist/index.d.cts CHANGED
@@ -1876,6 +1876,12 @@ interface Tooltip {
1876
1876
  to position `pos`.
1877
1877
  */
1878
1878
  arrow?: boolean;
1879
+ /**
1880
+ By default, tooltips are hidden when their position is outside
1881
+ of the visible editor content. Set this to false to turn that
1882
+ off.
1883
+ */
1884
+ clip?: boolean;
1879
1885
  }
1880
1886
  /**
1881
1887
  Describes the way a tooltip is displayed.
package/dist/index.d.ts CHANGED
@@ -1876,6 +1876,12 @@ interface Tooltip {
1876
1876
  to position `pos`.
1877
1877
  */
1878
1878
  arrow?: boolean;
1879
+ /**
1880
+ By default, tooltips are hidden when their position is outside
1881
+ of the visible editor content. Set this to false to turn that
1882
+ off.
1883
+ */
1884
+ clip?: boolean;
1879
1885
  }
1880
1886
  /**
1881
1887
  Describes the way a tooltip is displayed.
package/dist/index.js CHANGED
@@ -9944,10 +9944,10 @@ const tooltipPlugin = /*@__PURE__*/ViewPlugin.fromClass(class {
9944
9944
  let tooltip = this.manager.tooltips[i], tView = this.manager.tooltipViews[i], { dom } = tView;
9945
9945
  let pos = measured.pos[i], size = measured.size[i];
9946
9946
  // Hide tooltips that are outside of the editor.
9947
- if (!pos || pos.bottom <= Math.max(visible.top, space.top) ||
9947
+ if (!pos || tooltip.clip !== false && (pos.bottom <= Math.max(visible.top, space.top) ||
9948
9948
  pos.top >= Math.min(visible.bottom, space.bottom) ||
9949
9949
  pos.right < Math.max(visible.left, space.left) - .1 ||
9950
- pos.left > Math.min(visible.right, space.right) + .1) {
9950
+ pos.left > Math.min(visible.right, space.right) + .1)) {
9951
9951
  dom.style.top = Outside;
9952
9952
  continue;
9953
9953
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codemirror/view",
3
- "version": "6.34.3",
3
+ "version": "6.35.0",
4
4
  "description": "DOM view component for the CodeMirror code editor",
5
5
  "scripts": {
6
6
  "test": "cm-runtests",