mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-29 05:00:06 +02:00

Prevent codemirror tooltips appearing on top of pdf preview GitOrigin-RevId: 0c6ce15cd91b4958674fbc247bcd27ce5778f7fc
20 lines
518 B
TypeScript
20 lines
518 B
TypeScript
import { repositionTooltips, ViewPlugin } from '@codemirror/view'
|
|
|
|
const REPOSITION_EVENT = 'editor:repositionAllTooltips'
|
|
|
|
export const tooltipsReposition = () =>
|
|
ViewPlugin.define(view => {
|
|
const listener = () => repositionTooltips(view)
|
|
|
|
window.addEventListener(REPOSITION_EVENT, listener)
|
|
|
|
return {
|
|
destroy() {
|
|
window.removeEventListener(REPOSITION_EVENT, listener)
|
|
},
|
|
}
|
|
})
|
|
|
|
export const repositionAllTooltips = () => {
|
|
window.dispatchEvent(new Event(REPOSITION_EVENT))
|
|
}
|