From d58244b4c4fc46044d760e2f4ed5ef81c1329bec Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 11 Feb 2020 18:19:16 +0100 Subject: [PATCH] Support relative url and anchor url in code --- www/code/inner.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/www/code/inner.js b/www/code/inner.js index e933bd4bd..f9594c057 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -170,6 +170,14 @@ define([ e.preventDefault(); var $a = $t.is('a') ? $t : $t.parents('a').first(); var href = $a.attr('href'); + if (/^\/[^\/]/.test(href)) { + var privateData = common.getMetadataMgr().getPrivateData(); + href = privateData.origin + href; + } else if (/^#/.test(href)) { + var target = document.getElementById(href.slice(1)); + target.scrollIntoView(); + return; + } framework._.sfCommon.openUnsafeURL(href); } });