mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-28 20:45:00 +02:00
Copy button notification (#9355)
Signed-off-by: Rostislav Nagimov <rostislav.nagimov@gmail.com>
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -72,6 +72,7 @@ export default mergeIds(documentId, document, {
|
||||
Star: '' as IntlString,
|
||||
Unstar: '' as IntlString,
|
||||
CopyDocumentUrl: '' as IntlString,
|
||||
DocumentUrlCopied: '' as IntlString,
|
||||
|
||||
Lock: '' as IntlString,
|
||||
Unlock: '' as IntlString,
|
||||
|
||||
Reference in New Issue
Block a user