diff --git a/ui/desktop/src/components/LinkPreview.tsx b/ui/desktop/src/components/LinkPreview.tsx index e20197a1..71b33417 100644 --- a/ui/desktop/src/components/LinkPreview.tsx +++ b/ui/desktop/src/components/LinkPreview.tsx @@ -116,38 +116,35 @@ export default function LinkPreview({ url }: LinkPreviewProps) { } return ( - { - window.electron.openInChrome(url); - }} - > - {metadata.favicon && ( - Site favicon { - e.currentTarget.style.display = 'none'; - }} - /> - )} -
-

{metadata.title || url}

- {metadata.description && ( -

{metadata.description}

+ + + {metadata.favicon && ( + Site favicon { + e.currentTarget.style.display = 'none'; + }} + /> )} -
- {metadata.image && ( - Preview { - e.currentTarget.style.display = 'none'; - }} - /> - )} -
+
+

{metadata.title || url}

+ {metadata.description && ( +

{metadata.description}

+ )} +
+ {metadata.image && ( + Preview { + e.currentTarget.style.display = 'none'; + }} + /> + )} + +
); } diff --git a/ui/desktop/src/components/settings/Settings.tsx b/ui/desktop/src/components/settings/Settings.tsx index 7391aaed..f1a77d46 100644 --- a/ui/desktop/src/components/settings/Settings.tsx +++ b/ui/desktop/src/components/settings/Settings.tsx @@ -234,12 +234,14 @@ export default function Settings() { Add - + diff --git a/ui/desktop/src/main.ts b/ui/desktop/src/main.ts index 9fc43811..003e3f41 100644 --- a/ui/desktop/src/main.ts +++ b/ui/desktop/src/main.ts @@ -171,6 +171,16 @@ const createChat = async (app, query?: string, dir?: string, version?: string) = }, }); + // Handle new window creation for links + mainWindow.webContents.setWindowOpenHandler(({ url }) => { + // Open all links in external browser + if (url.startsWith('http:') || url.startsWith('https:')) { + require('electron').shell.openExternal(url); + return { action: 'deny' }; + } + return { action: 'allow' }; + }); + // Load the index.html of the app. const queryParam = query ? `?initialQuery=${encodeURIComponent(query)}` : ''; const { screen } = require('electron');