fix: copy html boundary error #470

pr675
Hufe921 2 years ago
parent 33a2dd8faa
commit 4e46afab68

@ -50,6 +50,11 @@ export function writeClipboardItem(
// add new range
const selection = window.getSelection()
const range = document.createRange()
// 增加尾行换行字符避免dom复制缺失
const br = document.createElement('span')
br.innerText = '\n'
fakeElement.append(br)
// 扩选选区并执行复制
range.selectNodeContents(fakeElement)
selection?.removeAllRanges()
selection?.addRange(range)

Loading…
Cancel
Save