fix: save documents maxWidth to local storage (#7184)

Signed-off-by: Alexander Onnikov <Alexander.Onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2024-11-18 14:35:38 +07:00 committed by GitHub
parent dd8ba84a9b
commit 017353ece3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -70,6 +70,9 @@
$: locked = doc?.lockedBy != null $: locked = doc?.lockedBy != null
$: readonly = $restrictionStore.readonly || locked $: readonly = $restrictionStore.readonly || locked
let useMaxWidth = getUseMaxWidth()
$: saveUseMaxWidth(useMaxWidth)
export function canClose (): boolean { export function canClose (): boolean {
return false return false
} }
@ -179,6 +182,15 @@
} }
} }
function getUseMaxWidth (): boolean {
const useMaxWidth = localStorage.getItem('document.useMaxWidth')
return useMaxWidth === 'true'
}
function saveUseMaxWidth (useMaxWidth: boolean): void {
localStorage.setItem('document.useMaxWidth', useMaxWidth.toString())
}
onMount(() => { onMount(() => {
dispatch('open', { ignoreKeys: ['comments', 'name'] }) dispatch('open', { ignoreKeys: ['comments', 'name'] })
}) })
@ -245,7 +257,7 @@
isHeader={false} isHeader={false}
isCustomAttr={false} isCustomAttr={false}
isSub={false} isSub={false}
useMaxWidth={false} bind:useMaxWidth
printHeader={false} printHeader={false}
{embedded} {embedded}
adaptive={'default'} adaptive={'default'}