From 796d3129658302dab39e4c6d4791285d7b21a702 Mon Sep 17 00:00:00 2001 From: Daniel <845765@qq.com> Date: Thu, 28 Dec 2023 23:29:24 +0800 Subject: [PATCH] :art: Support click to open hyperlinks like `www.foo.com` https://github.com/siyuan-note/siyuan/issues/9986 --- app/src/protyle/wysiwyg/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 137b64f50..41219f7ae 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -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); });