MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / loadExportPrefs

Function loadExportPrefs

apps/desktop/src/renderer/export-window.tsx:67–97  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

65}
66
67function loadExportPrefs(): ExportPrefs {
68 try {
69 const raw = window.localStorage.getItem(PREFS_KEY)
70 if (!raw) return DEFAULT_EXPORT_PREFS
71 const parsed = JSON.parse(raw) as Record<string, unknown>
72 const contentAlign = parsed.contentAlign === 'left' ? 'left' : 'center'
73 const themeMode: ExportThemeMode =
74 parsed.themeMode === 'light' || parsed.themeMode === 'dark' || parsed.themeMode === 'auto'
75 ? parsed.themeMode
76 : DEFAULT_EXPORT_PREFS.themeMode
77 return {
78 editorFontSize: safeNumber(parsed.editorFontSize, DEFAULT_EXPORT_PREFS.editorFontSize),
79 editorLineHeight: safeNumber(parsed.editorLineHeight, DEFAULT_EXPORT_PREFS.editorLineHeight),
80 previewMaxWidth: safeNumber(parsed.previewMaxWidth, DEFAULT_EXPORT_PREFS.previewMaxWidth),
81 editorMaxWidth: safeNumber(parsed.editorMaxWidth, DEFAULT_EXPORT_PREFS.editorMaxWidth),
82 contentAlign,
83 interfaceFont: safeString(parsed.interfaceFont),
84 textFont: safeString(parsed.textFont),
85 monoFont: safeString(parsed.monoFont),
86 pdfExportUseTheme:
87 typeof parsed.pdfExportUseTheme === 'boolean'
88 ? parsed.pdfExportUseTheme
89 : DEFAULT_EXPORT_PREFS.pdfExportUseTheme,
90 themeId: safeString(parsed.themeId) ?? DEFAULT_EXPORT_PREFS.themeId,
91 themeFamily: (safeString(parsed.themeFamily) ?? DEFAULT_EXPORT_PREFS.themeFamily) as ThemeFamily,
92 themeMode
93 }
94 } catch {
95 return DEFAULT_EXPORT_PREFS
96 }
97}
98
99// The PDF page is US Letter with 0.7in @page margins (see the <style> block
100// below), so the printable column is 8.5in - 2 * 0.7in = 7.1in. Cap the export

Callers

nothing calls this directly

Calls 2

safeNumberFunction · 0.70
safeStringFunction · 0.70

Tested by

no test coverage detected