mirror of
https://github.com/usememos/memos.git
synced 2025-10-01 10:04:41 +08:00
fix: compact mode storage (#4279)
fix #4274 now when checkbox is toggled the memo remembers the compact state Co-authored-by: root <root@DESKTOP-G3MCU14>
This commit is contained in:
parent
ac7121c21a
commit
972ebbae2f
1 changed files with 5 additions and 0 deletions
|
@ -72,6 +72,10 @@ const MemoContent: React.FC<Props> = (props: Props) => {
|
|||
SNIPPET: { text: t("memo.show-less"), nextState: "ALL" },
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
sessionStorage.getItem(`${memoName}`) && setShowCompactMode(sessionStorage.getItem(`${memoName}`) as ContentCompactView);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<RendererContext.Provider
|
||||
value={{
|
||||
|
@ -113,6 +117,7 @@ const MemoContent: React.FC<Props> = (props: Props) => {
|
|||
className="w-auto flex flex-row justify-start items-center cursor-pointer text-sm text-blue-600 dark:text-blue-400 hover:opacity-80"
|
||||
onClick={() => {
|
||||
setShowCompactMode(compactStates[showCompactMode].nextState as ContentCompactView);
|
||||
sessionStorage.setItem(`${memoName}`, compactStates[showCompactMode].nextState);
|
||||
}}
|
||||
>
|
||||
{compactStates[showCompactMode].text}
|
||||
|
|
Loading…
Add table
Reference in a new issue