mirror of
https://github.com/sky-systems/sky_phone.git
synced 2026-09-04 17:23:25 +00:00
ENH - add DarkChat media attachments
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
export function copyText(value: string): boolean {
|
||||
const activeElement =
|
||||
document.activeElement instanceof HTMLElement
|
||||
? document.activeElement
|
||||
: undefined
|
||||
const textarea = document.createElement('textarea')
|
||||
|
||||
textarea.value = value
|
||||
textarea.readOnly = true
|
||||
textarea.style.position = 'fixed'
|
||||
textarea.style.left = '-9999px'
|
||||
textarea.style.opacity = '0'
|
||||
document.body.appendChild(textarea)
|
||||
textarea.select()
|
||||
textarea.setSelectionRange(0, value.length)
|
||||
|
||||
try {
|
||||
return document.execCommand('copy')
|
||||
} finally {
|
||||
textarea.remove()
|
||||
activeElement?.focus({ preventScroll: true })
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user