mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-15 21:04:46 +01:00
improve (orgmode): open link in same window, better policy
This commit is contained in:
parent
e6c2923e20
commit
8614d4492e
1 changed files with 10 additions and 2 deletions
|
|
@ -268,13 +268,21 @@ function toggleHandler(cm, e){
|
|||
const link = RegExp.$1;
|
||||
if(!link) return;
|
||||
|
||||
let open = "_blank";
|
||||
let isMobile = screen.availWidth < screen.availHeight;
|
||||
if(!document.querySelector('.component_fab img.component_icon[alt="save"]')){
|
||||
open = "_self";
|
||||
} else if(isMobile){
|
||||
open = "_self"
|
||||
}
|
||||
|
||||
if(/^https?\:\/\//.test(link)){
|
||||
window.open(link);
|
||||
window.open(link, open);
|
||||
}else{
|
||||
const root_path = dirname(window.location.pathname.replace(/^\/view/, ''));
|
||||
const share = currentShare();
|
||||
const url = share ? "/view"+pathBuilder(root_path, link)+"?share="+share : "/view"+pathBuilder(root_path, link)
|
||||
window.open(url);
|
||||
window.open(url, open);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue