Copy button notification (#9355)

Signed-off-by: Rostislav Nagimov <rostislav.nagimov@gmail.com>
This commit is contained in:
Rostislav Nagimov
2025-06-30 15:38:16 +07:00
committed by GitHub
parent d5950c33cf
commit 8fba1e3db1
24 changed files with 64 additions and 5 deletions
@@ -83,6 +83,9 @@
let title = ''
let innerWidth: number
let isCopied = false
let copyTimeout: ReturnType<typeof setTimeout>
let headings: Heading[] = []
let loadedDocumentContent = false
@@ -101,6 +104,7 @@
onDestroy(async () => {
void notificationClient.then((client) => client.readDoc(_id))
clearTimeout(copyTimeout)
})
const starredQuery = createQuery()
@@ -230,10 +234,17 @@
$: actions = [
{
icon: view.icon.CopyId,
label: document.string.CopyDocumentUrl,
label: isCopied ? document.string.DocumentUrlCopied : document.string.CopyDocumentUrl,
action: () => {
if (doc !== undefined) {
void copyTextToClipboard(getDocumentUrl(doc))
isCopied = true
clearTimeout(copyTimeout)
copyTimeout = setTimeout(() => {
isCopied = false
}, 2000)
}
}
},