🎨 Support click to open hyperlinks like www.foo.com https://github.com/siyuan-note/siyuan/issues/9986

This commit is contained in:
Daniel 2023-12-28 23:29:24 +08:00
parent 9c512e5a56
commit 796d312965
No known key found for this signature in database
GPG key ID: 86211BA83DF03017

View file

@ -1852,7 +1852,7 @@ export class WYSIWYG {
if (aElement && !event.altKey) {
event.stopPropagation();
event.preventDefault();
const linkAddress = Lute.UnEscapeHTMLStr(aLink);
let linkAddress = Lute.UnEscapeHTMLStr(aLink);
/// #if MOBILE
openByMobile(linkAddress);
/// #else
@ -1882,6 +1882,10 @@ export class WYSIWYG {
}
} else if (linkAddress) {
/// #if !BROWSER
if (0 > linkAddress.indexOf("://")) {
// Support click to open hyperlinks like `www.foo.com` https://github.com/siyuan-note/siyuan/issues/9986
linkAddress = `https://${linkAddress}`;
}
shell.openExternal(linkAddress).catch((e) => {
showMessage(e);
});