mirror of
https://github.com/docmost/docmost.git
synced 2026-05-20 00:14:10 +08:00
82d065669d
The header edit/read toggle now controls only the current session's mode without saving it as the user's preference. The saved preference (set in profile settings) is applied once on initial load and sticks across page navigations within the session, so navigating to a new page no longer resets the mode mid-session. Fixes #1693
20 lines
695 B
TypeScript
20 lines
695 B
TypeScript
import { atom } from "jotai";
|
|
import { Editor } from "@tiptap/core";
|
|
import { PageEditMode } from "@/features/user/types/user.types.ts";
|
|
|
|
export const pageEditorAtom = atom<Editor | null>(null);
|
|
|
|
export const titleEditorAtom = atom<Editor | null>(null);
|
|
|
|
export const readOnlyEditorAtom = atom<Editor | null>(null);
|
|
|
|
export const yjsConnectionStatusAtom = atom<string>("");
|
|
|
|
export const showAiMenuAtom = atom(false);
|
|
|
|
export const showLinkMenuAtom = atom(false);
|
|
|
|
// Current page's edit mode — initialized from the user's saved preference on
|
|
// first load, can be toggled locally without persisting to the server.
|
|
export const currentPageEditModeAtom = atom<PageEditMode>(PageEditMode.Edit);
|