mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02: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:
committed by
GitHub
parent
ac7121c21a
commit
972ebbae2f
@@ -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}
|
||||
|
Reference in New Issue
Block a user