add context menu item to open link in new tab

This commit is contained in:
Athou
2023-02-27 07:39:38 +01:00
parent ffbb85df43
commit 69fb11eee0
32 changed files with 368 additions and 38 deletions

View File

@@ -51,3 +51,16 @@ export const scrollToWithCallback = ({
element.scrollTo(options)
}
export const openLinkInBackgroundTab = (url: string) => {
// simulate ctrl+click to open tab in background
const a = document.createElement("a")
a.href = url
a.rel = "noreferrer"
a.dispatchEvent(
new MouseEvent("click", {
ctrlKey: true,
metaKey: true,
})
)
}