From f58c213edae4e98b4d8b025ce8cc2c68f31ce3d4 Mon Sep 17 00:00:00 2001 From: David <33458145+davidmcpowell@users.noreply.github.com> Date: Mon, 22 Sep 2025 10:05:56 +0100 Subject: [PATCH] Merge pull request #28608 from overleaf/mj-fix-redesign-css-in-detached-pdf [web] Use wrapping div for detached PDF when using redesigned editor GitOrigin-RevId: f8f7b395dbe5a627804da10218f4de9d5ac76348 --- .../components/pdf-preview-detached-root.tsx | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root.tsx b/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root.tsx index 4cded9970e..09c81c5820 100644 --- a/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root.tsx +++ b/services/web/frontend/js/features/pdf-preview/components/pdf-preview-detached-root.tsx @@ -2,6 +2,7 @@ import { createRoot } from 'react-dom/client' import PdfPreview from './pdf-preview' import useWaitForI18n from '../../../shared/hooks/use-wait-for-i18n' import { ReactContextRoot } from '@/features/ide-react/context/react-context-root' +import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils' function PdfPreviewDetachedRoot() { const { isReady } = useWaitForI18n() @@ -12,11 +13,23 @@ function PdfPreviewDetachedRoot() { return ( - + + + ) } +function EditorRedesignWrapper({ children }: { children: React.ReactNode }) { + const newEditorEnabled = useIsNewEditorEnabled() + if (!newEditorEnabled) { + return <>{children} + } + + // TODO ide-redesign-cleanup: this wrapper should not be required + return
{children}
+} + export default PdfPreviewDetachedRoot // for testing const element = document.getElementById('pdf-preview-detached-root')