forked from github/dataease
Merge pull request #13009 from dataease/pr@dev-v2@refactor_table_multi_copy_wrap
refactor(图表): 表格单元格多选复制换行优化
This commit is contained in:
commit
6d737af26f
@ -555,14 +555,13 @@ export const copyString = (content: string, notify = false) => {
|
|||||||
const clipboard = navigator.clipboard || {
|
const clipboard = navigator.clipboard || {
|
||||||
writeText: data => {
|
writeText: data => {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
const inputDom = document.createElement('input')
|
const textareaDom = document.createElement('textarea')
|
||||||
inputDom.setAttribute('style', 'z-index: -1;position: fixed;opacity: 0;')
|
textareaDom.setAttribute('style', 'z-index: -1;position: fixed;opacity: 0;')
|
||||||
inputDom.setAttribute('type', 'text')
|
textareaDom.value = data
|
||||||
inputDom.setAttribute('value', data)
|
document.body.appendChild(textareaDom)
|
||||||
document.body.appendChild(inputDom)
|
textareaDom.select()
|
||||||
inputDom.select()
|
|
||||||
document.execCommand('copy')
|
document.execCommand('copy')
|
||||||
inputDom.remove()
|
textareaDom.remove()
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user