mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #5902 from overleaf/ta-layout-local-storage
Fix pdf.layout value in local storage GitOrigin-RevId: 1ff6ab51f51d2895b6e7305a36af57fb205c0fa3
This commit is contained in:
parent
970fd27165
commit
411886ba94
1 changed files with 9 additions and 2 deletions
|
@ -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]
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue