()
| 38 | } |
| 39 | |
| 40 | function 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 |
no test coverage detected