(prefs: ExportPrefs)
| 170 | } |
| 171 | |
| 172 | function applyExportPrefs(prefs: ExportPrefs): void { |
| 173 | const html = document.documentElement |
| 174 | html.dataset.contentAlign = prefs.contentAlign |
| 175 | html.setAttribute('data-opaque', '') |
| 176 | applyExportTheme(prefs) |
| 177 | html.style.setProperty('--z-editor-font-size', `${prefs.editorFontSize}px`) |
| 178 | html.style.setProperty('--z-editor-line-height', String(prefs.editorLineHeight)) |
| 179 | html.style.setProperty( |
| 180 | '--z-preview-max-width', |
| 181 | `min(${prefs.previewMaxWidth}px, ${PDF_PRINTABLE_WIDTH})` |
| 182 | ) |
| 183 | html.style.setProperty( |
| 184 | '--z-editor-max-width', |
| 185 | `min(${prefs.editorMaxWidth}px, ${PDF_PRINTABLE_WIDTH})` |
| 186 | ) |
| 187 | |
| 188 | const setFont = (name: string, value: string | null, fallback: string): void => { |
| 189 | if (value) html.style.setProperty(name, `"${value}", ${fallback}`) |
| 190 | else html.style.removeProperty(name) |
| 191 | } |
| 192 | setFont( |
| 193 | '--z-interface-font', |
| 194 | prefs.interfaceFont, |
| 195 | '-apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif' |
| 196 | ) |
| 197 | setFont( |
| 198 | '--z-text-font', |
| 199 | prefs.textFont, |
| 200 | '"SF Mono", "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace' |
| 201 | ) |
| 202 | setFont( |
| 203 | '--z-mono-font', |
| 204 | prefs.monoFont, |
| 205 | '"SF Mono", "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace' |
| 206 | ) |
| 207 | } |
| 208 | |
| 209 | function ExportNoteWindow({ notePath }: { notePath: string }): JSX.Element { |
| 210 | const [prefs] = useState(loadExportPrefs) |
no test coverage detected