13
0
forked from github/dataease

Merge pull request from dataease/pr@dev-v2@refactor_table_multi_copy_wrap

refactor(图表): 表格单元格多选复制换行优化
This commit is contained in:
wisonic-s 2024-10-30 15:00:33 +08:00 committed by GitHub
commit 6d737af26f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -555,14 +555,13 @@ export const copyString = (content: string, notify = false) => {
const clipboard = navigator.clipboard || {
writeText: data => {
return new Promise(resolve => {
const inputDom = document.createElement('input')
inputDom.setAttribute('style', 'z-index: -1;position: fixed;opacity: 0;')
inputDom.setAttribute('type', 'text')
inputDom.setAttribute('value', data)
document.body.appendChild(inputDom)
inputDom.select()
const textareaDom = document.createElement('textarea')
textareaDom.setAttribute('style', 'z-index: -1;position: fixed;opacity: 0;')
textareaDom.value = data
document.body.appendChild(textareaDom)
textareaDom.select()
document.execCommand('copy')
inputDom.remove()
textareaDom.remove()
resolve()
})
}