background tab also when the user use ctrl or meta
This commit is contained in:
parent
d485946d56
commit
465cc71e9e
1 changed files with 16 additions and 8 deletions
|
@ -48,13 +48,7 @@
|
|||
|
||||
/* Open cards link */
|
||||
const openLink = (url) => {
|
||||
switch (event.button) {
|
||||
case 0:
|
||||
/* Left click */
|
||||
window.open(url, "_blank", "noreferrer");
|
||||
break;
|
||||
case 1:
|
||||
/* Middle click */
|
||||
const backgroundtab = () =>
|
||||
Object.assign(document.createElement("a"), {
|
||||
href: url,
|
||||
target: "_blank",
|
||||
|
@ -62,6 +56,20 @@
|
|||
}).dispatchEvent(
|
||||
new MouseEvent("click", { ctrlKey: true, metaKey: true })
|
||||
);
|
||||
|
||||
switch (event.button) {
|
||||
case 0:
|
||||
/* Left click */
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
backgroundtab();
|
||||
} else {
|
||||
window.open(url, "_blank", "noreferrer");
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
/* Middle click */
|
||||
backgroundtab();
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue