15 lines
371 B
TypeScript
15 lines
371 B
TypeScript
/**
|
|
* Copies a given string to the clipboard using
|
|
* the legacy exec method
|
|
*
|
|
* @param content The content to be copied
|
|
*/
|
|
export function copyToClipboard(content: string) {
|
|
const dummy = document.createElement("input")
|
|
document.body.appendChild(dummy)
|
|
dummy.value = content
|
|
dummy.select()
|
|
document.execCommand("copy")
|
|
document.body.removeChild(dummy)
|
|
}
|