Merge pull request #26909 from overleaf/dp-eq-preview-presentation-mode

Prevent codemirror tooltips appearing on top of pdf preview

GitOrigin-RevId: 0c6ce15cd91b4958674fbc247bcd27ce5778f7fc
This commit is contained in:
David
2025-07-09 10:51:52 +01:00
committed by Copybot
parent ad5c528896
commit 4dbd82ea1c
4 changed files with 35 additions and 12 deletions
@@ -21,6 +21,7 @@ import { isMac } from '@/shared/utils/os'
import { sendSearchEvent } from '@/features/event-tracking/search-events'
import { useRailContext } from '@/features/ide-redesign/contexts/rail-context'
import usePersistedState from '@/shared/hooks/use-persisted-state'
import { repositionAllTooltips } from '@/features/source-editor/extensions/tooltips-reposition'
export type IdeLayout = 'sideBySide' | 'flat'
export type IdeView = 'editor' | 'file' | 'pdf' | 'history'
@@ -198,6 +199,15 @@ export const LayoutProvider: FC<React.PropsWithChildren> = ({ children }) => {
[setPdfLayout, setView]
)
// Force codemirror to reposition all tooltips to prevent an issue
// where tooltips would sometimes show on top of the pdf preview
// https://github.com/overleaf/internal/issues/23840
useEffect(() => {
if (view === 'pdf' && pdfLayout === 'flat') {
repositionAllTooltips()
}
}, [view, pdfLayout])
const {
reattach,
detach,