diff --git a/services/web/frontend/js/shared/context/layout-context.js b/services/web/frontend/js/shared/context/layout-context.js index 69390822a5..a83639a429 100644 --- a/services/web/frontend/js/shared/context/layout-context.js +++ b/services/web/frontend/js/shared/context/layout-context.js @@ -28,6 +28,13 @@ LayoutContext.Provider.propTypes = { }).isRequired, } +function setLayoutInLocalStorage(pdfLayout) { + localStorage.setItem( + 'pdf.layout', + pdfLayout === 'sideBySide' ? 'split' : 'flat' + ) +} + export function LayoutProvider({ children }) { const { $scope } = useIdeContext() @@ -68,7 +75,7 @@ export function LayoutProvider({ children }) { const newLayout = layout === 'sideBySide' ? 'flat' : 'sideBySide' setView(newLayout === 'sideBySide' ? 'editor' : 'pdf') setPdfLayout(newLayout) - localStorage.setItem('pdf.layout', newLayout) + setLayoutInLocalStorage(newLayout) }) }, [setPdfLayout, setView]) @@ -76,7 +83,7 @@ export function LayoutProvider({ children }) { (newLayout, newView) => { setPdfLayout(newLayout) setView(newLayout === 'sideBySide' ? 'editor' : newView) - localStorage.setItem('pdf.layout', newLayout) + setLayoutInLocalStorage(newLayout) }, [setPdfLayout, setView] )