@codemirror/tooltip
Advanced tools
Comparing version 0.19.15 to 0.19.16
@@ -0,1 +1,7 @@ | ||
## 0.19.16 (2022-02-25) | ||
### New features | ||
Tooltip views may now have a `getPos` property, which can be used to override the way the tooltip's position is computed. | ||
## 0.19.15 (2022-02-18) | ||
@@ -2,0 +8,0 @@ |
import { EditorView, ViewUpdate } from '@codemirror/view'; | ||
import { Extension, Facet, EditorState, StateEffect } from '@codemirror/state'; | ||
declare type Rect = { | ||
left: number; | ||
right: number; | ||
top: number; | ||
bottom: number; | ||
}; | ||
/** | ||
@@ -103,2 +109,9 @@ Return an extension that configures tooltip behavior. | ||
/** | ||
By default, a tooltip's screen position will be based on the | ||
text position of its `pos` property. This method can be provided | ||
to make the tooltip view itself responsible for finding its | ||
screen position. | ||
*/ | ||
getCoords?: (pos: number) => Rect; | ||
/** | ||
By default, tooltips are moved when they overlap with other | ||
@@ -105,0 +118,0 @@ tooltips. Set this to `true` to disable that behavior for this |
@@ -177,3 +177,6 @@ import { ViewPlugin, Direction, EditorView, logException } from '@codemirror/view'; | ||
parent: this.parent ? this.container.getBoundingClientRect() : editor, | ||
pos: this.manager.tooltips.map(t => this.view.coordsAtPos(t.pos)), | ||
pos: this.manager.tooltips.map((t, i) => { | ||
let tv = this.manager.tooltipViews[i]; | ||
return tv.getCoords ? tv.getCoords(t.pos) : this.view.coordsAtPos(t.pos); | ||
}), | ||
size: this.manager.tooltipViews.map(({ dom }) => dom.getBoundingClientRect()), | ||
@@ -180,0 +183,0 @@ space: this.view.state.facet(tooltipConfig).tooltipSpace(this.view), |
{ | ||
"name": "@codemirror/tooltip", | ||
"version": "0.19.15", | ||
"version": "0.19.16", | ||
"description": "Tooltip support for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59562
1303