@@ -173,6 +173,7 @@ import {
173173 type MarkdownFileLinkMeta ,
174174} from "../markdown-links" ;
175175import { isMarkdownFileLinkLabel } from "@t3tools/shared/markdownLinks" ;
176+ import { isElectron } from "../env" ;
176177import { readLocalApi } from "../localApi" ;
177178import { useAssetUrlRefresh , useAssetUrlState } from "../assets/assetUrls" ;
178179import { cn } from "../lib/utils" ;
@@ -3035,15 +3036,30 @@ const CHAT_MARKDOWN_COMPONENTS = {
30353036 // keeps the `_blank` the shell already handles; the in-app browser needs
30363037 // the click intercepted here. A modifier click is the way out of the
30373038 // in-app default, so it is left to the shell too.
3039+ if ( event . defaultPrevented ) return ;
30383040 if (
3039- event . defaultPrevented ||
30403041 resolveLinkTarget ( {
30413042 url : href ,
30423043 event,
30433044 preference : linkTargetPreference ,
30443045 canOpenInApp : canOpenInPreview ,
30453046 } ) !== "app"
30463047 ) {
3048+ // Chromium turns an Option/Alt-click into a download that never reaches the
3049+ // shell. On desktop, open the link here while the key is still down, so link
3050+ // routers such as Finicky can still read it.
3051+ if ( isElectron && event . altKey ) {
3052+ event . preventDefault ( ) ;
3053+ event . stopPropagation ( ) ;
3054+ void readLocalApi ( )
3055+ ?. shell . openExternal ( href )
3056+ . catch ( ( cause ) =>
3057+ reportMarkdownActionFailure (
3058+ { operation : "open-link-external" , target : href } ,
3059+ cause ,
3060+ ) ,
3061+ ) ;
3062+ }
30473063 return ;
30483064 }
30493065 event . preventDefault ( ) ;
0 commit comments