mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-30 22:22:02 +02:00
Fix performance related to having 100s of requests (#123)
This commit is contained in:
16
src-web/hooks/useSyncFontSizeSetting.ts
Normal file
16
src-web/hooks/useSyncFontSizeSetting.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { useEffect } from 'react';
|
||||
import { useSettings } from './useSettings';
|
||||
|
||||
export function useSyncFontSizeSetting() {
|
||||
const settings = useSettings();
|
||||
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