mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-05-16 20:57:12 +02:00
Split codebase (#455)
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