mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-13 17:52:38 +02:00
feat(web): add ElectronAPI type declaration for window.electronAPI
This commit is contained in:
parent
9e058e1329
commit
d6d4ebc75d
2 changed files with 15 additions and 1 deletions
|
|
@ -317,7 +317,7 @@ const Composer: FC = () => {
|
||||||
// Clipboard content
|
// Clipboard content
|
||||||
const [clipboardText, setClipboardText] = useState<string | undefined>();
|
const [clipboardText, setClipboardText] = useState<string | undefined>();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const api = (window as { electronAPI?: { getClipboardContent?: () => Promise<string> } }).electronAPI;
|
const api = window.electronAPI;
|
||||||
if (!api?.getClipboardContent) return;
|
if (!api?.getClipboardContent) return;
|
||||||
api.getClipboardContent().then((text) => {
|
api.getClipboardContent().then((text) => {
|
||||||
if (text) setClipboardText(text);
|
if (text) setClipboardText(text);
|
||||||
|
|
|
||||||
14
surfsense_web/types/window.d.ts
vendored
14
surfsense_web/types/window.d.ts
vendored
|
|
@ -1,7 +1,21 @@
|
||||||
import type { PostHog } from "posthog-js";
|
import type { PostHog } from "posthog-js";
|
||||||
|
|
||||||
|
interface ElectronAPI {
|
||||||
|
versions: {
|
||||||
|
electron: string;
|
||||||
|
node: string;
|
||||||
|
chrome: string;
|
||||||
|
platform: string;
|
||||||
|
};
|
||||||
|
openExternal: (url: string) => void;
|
||||||
|
getAppVersion: () => Promise<string>;
|
||||||
|
getClipboardContent: () => Promise<string>;
|
||||||
|
onDeepLink: (callback: (url: string) => void) => () => void;
|
||||||
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
interface Window {
|
interface Window {
|
||||||
posthog?: PostHog;
|
posthog?: PostHog;
|
||||||
|
electronAPI?: ElectronAPI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue