mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-27 02:58:34 +02:00
Refactor desktop app into separate client and proxy apps
This commit is contained in:
17
apps/yaak-client/hooks/useSyncFontSizeSetting.ts
Normal file
17
apps/yaak-client/hooks/useSyncFontSizeSetting.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { settingsAtom } from '@yaakapp-internal/models';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function useSyncFontSizeSetting() {
|
||||
const settings = useAtomValue(settingsAtom);
|
||||
useEffect(() => {
|
||||
if (settings == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const { interfaceScale, editorFontSize } = settings;
|
||||
getCurrentWebviewWindow().setZoom(interfaceScale).catch(console.error);
|
||||
document.documentElement.style.setProperty('--editor-font-size', `${editorFontSize}px`);
|
||||
}, [settings]);
|
||||
}
|
||||
Reference in New Issue
Block a user