@codemirror/tooltip
Advanced tools
Comparing version 0.17.1 to 0.17.2
@@ -0,1 +1,7 @@ | ||
## 0.17.2 (2021-01-14) | ||
### Bug fixes | ||
Fix tooltip positioning on iOS, which still handles position: fixed strangely. | ||
## 0.17.1 (2021-01-06) | ||
@@ -2,0 +8,0 @@ |
import { ViewPlugin, themeClass, Direction, EditorView } from '@codemirror/view'; | ||
import { Facet, StateEffect, StateField, MapMode } from '@codemirror/state'; | ||
const ios = typeof navigator != "undefined" && | ||
!/Edge\/(\d+)/.exec(navigator.userAgent) && /Apple Computer/.test(navigator.vendor) && | ||
(/Mobile\/\w+/.test(navigator.userAgent) || navigator.maxTouchPoints > 2); | ||
const Outside = "-10000px"; | ||
@@ -82,4 +85,11 @@ const tooltipPlugin = ViewPlugin.fromClass(class { | ||
above = !above; | ||
dom.style.top = (above ? pos.top - height : pos.bottom) + "px"; | ||
dom.style.left = left + "px"; | ||
if (ios) { | ||
dom.style.top = ((above ? pos.top - height : pos.bottom) - editor.top) + "px"; | ||
dom.style.left = (left - editor.left) + "px"; | ||
dom.style.position = "absolute"; | ||
} | ||
else { | ||
dom.style.top = (above ? pos.top - height : pos.bottom) + "px"; | ||
dom.style.left = left + "px"; | ||
} | ||
dom.classList.toggle("cm-tooltip-above", above); | ||
@@ -86,0 +96,0 @@ dom.classList.toggle("cm-tooltip-below", !above); |
{ | ||
"name": "@codemirror/tooltip", | ||
"version": "0.17.1", | ||
"version": "0.17.2", | ||
"description": "Tooltip support for the CodeMirror code editor", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is not supported yet
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
49327
547