mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-06 06:12:40 +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
|
||||
const [clipboardText, setClipboardText] = useState<string | undefined>();
|
||||
useEffect(() => {
|
||||
const api = (window as { electronAPI?: { getClipboardContent?: () => Promise<string> } }).electronAPI;
|
||||
const api = window.electronAPI;
|
||||
if (!api?.getClipboardContent) return;
|
||||
api.getClipboardContent().then((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";
|
||||
|
||||
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 {
|
||||
interface Window {
|
||||
posthog?: PostHog;
|
||||
electronAPI?: ElectronAPI;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue