Support relative url and anchor url in code

pull/1/head
yflory 2020-02-11 18:19:16 +01:00
parent bba769ef77
commit d58244b4c4
1 changed files with 8 additions and 0 deletions

View File

@ -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);
}
});