forked from akai/readest
This commit is contained in:
@@ -15,6 +15,7 @@ import { useSettingsStore } from '@/store/settingsStore';
|
||||
import { useDeviceControlStore } from '@/store/deviceStore';
|
||||
import { useScreenWakeLock } from '@/hooks/useScreenWakeLock';
|
||||
import { eventDispatcher } from '@/utils/event';
|
||||
import { interceptGlobalOpen } from '@/utils/open';
|
||||
import { mountAdditionalFonts } from '@/utils/style';
|
||||
import { setSystemUIVisibility } from '@/utils/bridge';
|
||||
import { AboutWindow } from '@/components/AboutWindow';
|
||||
@@ -39,6 +40,7 @@ const Reader: React.FC<{ ids?: string }> = ({ ids }) => {
|
||||
|
||||
useEffect(() => {
|
||||
mountAdditionalFonts(document);
|
||||
interceptGlobalOpen();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import { openUrl } from '@tauri-apps/plugin-opener';
|
||||
import { isTauriAppPlatform } from '@/services/environment';
|
||||
|
||||
export const interceptGlobalOpen = () => {
|
||||
const windowOpen = window.open;
|
||||
globalThis.open = function (
|
||||
url?: string | URL,
|
||||
target?: string,
|
||||
features?: string,
|
||||
): Window | null {
|
||||
if (isTauriAppPlatform()) {
|
||||
openUrl(url?.toString() || '');
|
||||
return null;
|
||||
} else {
|
||||
return windowOpen(url, target, features);
|
||||
}
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user