feat: add 'Open files in preview mode' setting (#988)
* feat: add 'Open files in preview mode' setting - Add defaultFileViewerPreview setting to persist user preference for file viewer default mode - Add checkbox in Settings → Sessions → Session Defaults to toggle the setting - Files now open in preview mode by default when setting is enabled - Respects per-file-type localStorage persistence for markdown/HTML/JSON files - Setting persists across sessions via /api/config/settings endpoint * fix: address PR review feedback - FilesView: respect HTML localStorage preference in file-change effect, falling back to global setting only when nothing stored - DefaultsSettings: read defaultFileViewerPreview directly from config store instead of redundant local state + separate fetch - DefaultsSettings: extract duplicated toggle logic into handleToggleFileViewerPreview callback * fix: honor default preview setting for markdown files Previously mdViewMode only read localStorage on mount (deps: []), so when settingsDefaultFileViewerPreview was enabled and no MD_VIEWER_MODE_KEY was stored, markdown files silently opened in edit mode — ignoring the setting for the very file type users most want to preview. Fold md init into the per-file-change effect, mirroring the html handling: localStorage preference wins, falling back to the setting-derived default. The saveMdViewMode callback stays untouched so user-initiated toggles still persist. --------- Co-authored-by: Bohdan Triapitsyn <artmore@protonmail.com>
This commit is contained in:
committed by
GitHub
co-authored by
Bohdan Triapitsyn
parent
bf110527a5
commit
4f60fce1e1
@@ -115,6 +115,7 @@ export type DesktopSettings = {
|
||||
autoCreateWorktree?: boolean;
|
||||
queueModeEnabled?: boolean;
|
||||
gitmojiEnabled?: boolean;
|
||||
defaultFileViewerPreview?: boolean;
|
||||
zenModel?: string;
|
||||
gitProviderId?: string;
|
||||
gitModelId?: string;
|
||||
|
||||
Reference in New Issue
Block a user