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

Function applyExportPrefs

apps/web/src/export-window.tsx:71–107  ·  view source on GitHub ↗
(prefs: ExportPrefs)

Source from the content-addressed store, hash-verified

69const PDF_PRINTABLE_WIDTH = '7.1in'
70
71function applyExportPrefs(prefs: ExportPrefs): void {
72 const html = document.documentElement
73 html.dataset.theme = 'github-light'
74 html.dataset.contentAlign = prefs.contentAlign
75 html.setAttribute('data-opaque', '')
76 html.style.colorScheme = 'light'
77 html.style.setProperty('--z-editor-font-size', `${prefs.editorFontSize}px`)
78 html.style.setProperty('--z-editor-line-height', String(prefs.editorLineHeight))
79 html.style.setProperty(
80 '--z-preview-max-width',
81 `min(${prefs.previewMaxWidth}px, ${PDF_PRINTABLE_WIDTH})`
82 )
83 html.style.setProperty(
84 '--z-editor-max-width',
85 `min(${prefs.editorMaxWidth}px, ${PDF_PRINTABLE_WIDTH})`
86 )
87
88 const setFont = (name: string, value: string | null, fallback: string): void => {
89 if (value) html.style.setProperty(name, `"${value}", ${fallback}`)
90 else html.style.removeProperty(name)
91 }
92 setFont(
93 '--z-interface-font',
94 prefs.interfaceFont,
95 '-apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif'
96 )
97 setFont(
98 '--z-text-font',
99 prefs.textFont,
100 '"SF Mono", "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace'
101 )
102 setFont(
103 '--z-mono-font',
104 prefs.monoFont,
105 '"SF Mono", "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace'
106 )
107}
108
109function ExportNoteWindow({ notePath }: { notePath: string }): JSX.Element {
110 const [note, setNote] = useState<NoteContent | null>(null)

Callers 1

ExportNoteWindowFunction · 0.70

Calls 1

setFontFunction · 0.70

Tested by

no test coverage detected