mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-02 12:17:43 +08:00
[Fix][UI Next][V1.0.0-Beta] Fix bug where name copy is invalid (#9684)
This commit is contained in:
parent
29a0ea32c6
commit
99678c097c
@ -16,16 +16,14 @@
|
||||
*/
|
||||
|
||||
export const copy = (text: string): boolean => {
|
||||
const range = document.createRange()
|
||||
const node = document.createTextNode(text)
|
||||
document.body.append(node)
|
||||
range.selectNode(node)
|
||||
window.getSelection()?.addRange(range)
|
||||
const inp = document.createElement('input')
|
||||
document.body.appendChild(inp)
|
||||
inp.value = text
|
||||
inp.select()
|
||||
let result = false
|
||||
try {
|
||||
result = document.execCommand('copy')
|
||||
} catch (err) {}
|
||||
window.getSelection()?.removeAllRanges()
|
||||
document.body.removeChild(node)
|
||||
inp.remove()
|
||||
return result
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user