mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-22 04:26:23 +08:00
fix(electron): create doc shortcut should follow default type in settings (#14678)
This commit is contained in:
@@ -2,13 +2,21 @@ import '@sentry/electron/preload';
|
||||
|
||||
import { contextBridge } from 'electron';
|
||||
|
||||
import { isInternalUrl } from '../shared/internal-origin';
|
||||
import { apis, appInfo, events } from './electron-api';
|
||||
import { sharedStorage } from './shared-storage';
|
||||
import { listenWorkerApis } from './worker';
|
||||
|
||||
contextBridge.exposeInMainWorld('__appInfo', appInfo);
|
||||
contextBridge.exposeInMainWorld('__apis', apis);
|
||||
contextBridge.exposeInMainWorld('__events', events);
|
||||
contextBridge.exposeInMainWorld('__sharedStorage', sharedStorage);
|
||||
const locationLike = (globalThis as { location?: { href?: unknown } }).location;
|
||||
|
||||
listenWorkerApis();
|
||||
const currentUrl =
|
||||
typeof locationLike?.href === 'string' ? locationLike.href : null;
|
||||
|
||||
if (currentUrl && isInternalUrl(currentUrl)) {
|
||||
contextBridge.exposeInMainWorld('__appInfo', appInfo);
|
||||
contextBridge.exposeInMainWorld('__apis', apis);
|
||||
contextBridge.exposeInMainWorld('__events', events);
|
||||
contextBridge.exposeInMainWorld('__sharedStorage', sharedStorage);
|
||||
|
||||
listenWorkerApis();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user