use browser extension to open tab in background (#1074)

This commit is contained in:
Athou
2023-06-10 22:16:02 +02:00
parent e2eeba90ef
commit 22e0f1f382
37 changed files with 717 additions and 325 deletions

View File

@@ -52,17 +52,4 @@ 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,
})
)
}
export const truncate = (str: string, n: number) => (str.length > n ? `${str.slice(0, n - 1)}\u2026` : str)