-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix opening in the browser links of the email message, closes #493
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
{ | ||
"name": "electron-mail", | ||
"description": "Unofficial ProtonMail Desktop App", | ||
"version": "4.13.4", | ||
"version": "4.13.5", | ||
"author": "Vladimir Yakovlev <[email protected]>", | ||
"license": "GPL-3.0", | ||
"homepage": "https://github.com/vladimiry/ElectronMail", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
diff --git a/packages/components/hooks/useLinkHandler.tsx b/packages/components/hooks/useLinkHandler.tsx | ||
index e65208ec9..6178f5aaf 100644 | ||
--- a/packages/components/hooks/useLinkHandler.tsx | ||
+++ b/packages/components/hooks/useLinkHandler.tsx | ||
@@ -4,7 +4,7 @@ import punycode from 'punycode.js'; | ||
|
||
import { getSecondLevelDomain } from '@proton/shared/lib/helpers/url'; | ||
import { MailSettings } from '@proton/shared/lib/interfaces'; | ||
-import { isIE11, isEdge } from '@proton/shared/lib/helpers/browser'; | ||
+import { isIE11, isEdge, openNewTab } from '@proton/shared/lib/helpers/browser'; | ||
import isTruthy from '@proton/shared/lib/helpers/isTruthy'; | ||
import { PROTON_DOMAINS } from '@proton/shared/lib/constants'; | ||
|
||
@@ -162,6 +162,10 @@ export const useLinkHandler: UseLinkHandler = ( | ||
return; | ||
} | ||
|
||
+ event.preventDefault(); | ||
+ event.stopPropagation(); // Required for Safari | ||
+ const encodedLink = await encoder(src); | ||
+ | ||
if ( | ||
askForConfirmation && | ||
isExternal(src.raw) && | ||
@@ -169,20 +173,17 @@ export const useLinkHandler: UseLinkHandler = ( | ||
.filter(isTruthy) // currentDomain can be null | ||
.some((domain) => isSubDomain(hostname, domain)) | ||
) { | ||
- event.preventDefault(); | ||
- event.stopPropagation(); // Required for Safari | ||
- | ||
- const link = await encoder(src); | ||
- | ||
const modalId = createModal( | ||
<LinkConfirmationModal | ||
- link={link} | ||
+ link={encodedLink} | ||
onClose={() => setConfirmationModalID(undefined)} | ||
isOutside={isOutside} | ||
/> | ||
); | ||
|
||
setConfirmationModalID(modalId); | ||
+ } else { | ||
+ openNewTab(encodedLink); | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters