* feat: hide markdown front matter by default with per-file toggle (#4468) Front matter in the markdown preview was always visible above the rendered body, which clutters reading for files where the metadata is incidental. Default the card to hidden and let users opt in per file via a small switch in the section header. * Add a per-file markdownFrontmatterVisible flag in EditorSlice, mirroring the editorViewMode pattern (absent entry = hidden; storing only explicit true values keeps the record minimal). * Clean the entry up on closeFile, preview-tab replacement, and worktree removal; reset on runtime switch. * Render the existing front-matter card unchanged when the toggle is on, hide only the <pre> body when it is off, and keep the section header + SettingsSwitch visible so the affordance stays discoverable. * Add 4 regression cases in editor.test.ts mirroring the editorViewMode tests. * fix: persist markdown front matter visibility Co-authored-by: Orca <help@stably.ai> --------- Co-authored-by: Jinwoo-H <jinwoo0825@gmail.com> Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
co-authored by
Orca
Jinwoo-H
parent
c6293c8050
commit
13f062d093
@@ -431,6 +431,7 @@ export function getDefaultWorkspaceSession(): WorkspaceSessionState {
|
||||
tabsByWorktree: {},
|
||||
terminalLayoutsByTabId: {},
|
||||
openFilesByWorktree: {},
|
||||
markdownFrontmatterVisible: {},
|
||||
browserTabsByWorktree: {},
|
||||
browserPagesByWorkspace: {},
|
||||
activeBrowserTabIdByWorktree: {},
|
||||
|
||||
@@ -684,6 +684,8 @@ export type WorkspaceSessionState = {
|
||||
openFilesByWorktree?: Record<string, PersistedOpenFile[]>
|
||||
/** Per-worktree active editor file ID (filePath) at shutdown. */
|
||||
activeFileIdByWorktree?: Record<string, string | null>
|
||||
/** Per-file markdown preview front-matter visibility. Absent entry means hidden. */
|
||||
markdownFrontmatterVisible?: Record<string, boolean>
|
||||
/** Persisted browser workspaces, keyed by worktree ID. */
|
||||
browserTabsByWorktree?: Record<string, BrowserWorkspace[]>
|
||||
/** Persisted browser pages, keyed by workspace ID. */
|
||||
|
||||
@@ -218,6 +218,7 @@ export const workspaceSessionStateSchema: z.ZodType<WorkspaceSessionState> = z.o
|
||||
activeWorktreeIdsOnShutdown: z.array(z.string()).optional(),
|
||||
openFilesByWorktree: z.record(z.string(), z.array(persistedOpenFileSchema)).optional(),
|
||||
activeFileIdByWorktree: z.record(z.string(), z.string().nullable()).optional(),
|
||||
markdownFrontmatterVisible: z.record(z.string(), z.boolean()).optional(),
|
||||
browserTabsByWorktree: z.record(z.string(), z.array(browserWorkspaceSchema)).optional(),
|
||||
browserPagesByWorkspace: z.record(z.string(), z.array(browserPageSchema)).optional(),
|
||||
activeBrowserTabIdByWorktree: z.record(z.string(), z.string().nullable()).optional(),
|
||||
|
||||
Reference in New Issue
Block a user