Moderation: Add keybinds for link copying and setting project status (#6716)

Add keybinds for link copying and setting project status
This commit is contained in:
coolbot
2026-07-14 10:21:40 +00:00
committed by GitHub
parent 13e6ebf4e0
commit cafe58dc3c
3 changed files with 66 additions and 0 deletions
@@ -1207,6 +1207,29 @@ function handleKeybinds(event: KeyboardEvent) {
tryWithhold: () => sendMessage('withheld'),
tryEditMessage: goBackToStages,
tryCopyLink: async (permalink: boolean, relative: boolean, page: boolean) => {
let url = ``
if (relative) {
url += `${globalThis.location.origin}`
} else {
url += `https://modrinth.com`
}
if (permalink) {
url += `/project/${projectV2.value.id}`
} else {
url += `/${projectV2.value.project_type}/${projectV2.value.slug}`
}
if (page) {
url += `/${globalThis.location.pathname.split('/').slice(3).join('/')}`
}
await navigator.clipboard.writeText(url)
},
tryCopyId: async () => await navigator.clipboard.writeText(projectV2.value.id),
tryToggleAction: (actionIndex: number) => {
const action = visibleActions.value[actionIndex]
if (action) {