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

Function loadExportPrefs

apps/web/src/export-window.tsx:40–59  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40function loadExportPrefs(): ExportPrefs {
41 try {
42 const raw = window.localStorage.getItem(PREFS_KEY)
43 if (!raw) return DEFAULT_EXPORT_PREFS
44 const parsed = JSON.parse(raw) as Record<string, unknown>
45 const contentAlign = parsed.contentAlign === 'left' ? 'left' : 'center'
46 return {
47 editorFontSize: safeNumber(parsed.editorFontSize, DEFAULT_EXPORT_PREFS.editorFontSize),
48 editorLineHeight: safeNumber(parsed.editorLineHeight, DEFAULT_EXPORT_PREFS.editorLineHeight),
49 previewMaxWidth: safeNumber(parsed.previewMaxWidth, DEFAULT_EXPORT_PREFS.previewMaxWidth),
50 editorMaxWidth: safeNumber(parsed.editorMaxWidth, DEFAULT_EXPORT_PREFS.editorMaxWidth),
51 contentAlign,
52 interfaceFont: safeString(parsed.interfaceFont),
53 textFont: safeString(parsed.textFont),
54 monoFont: safeString(parsed.monoFont)
55 }
56 } catch {
57 return DEFAULT_EXPORT_PREFS
58 }
59}
60
61// The PDF page is US Letter with 0.7in @page margins (see the <style> block
62// below), so the printable column is 8.5in - 2 * 0.7in = 7.1in. Cap the export

Callers 1

ExportNoteWindowFunction · 0.70

Calls 2

safeNumberFunction · 0.70
safeStringFunction · 0.70

Tested by

no test coverage detected