Skip to content

Commit

Permalink
fix: copy html boundary error #470
Browse files Browse the repository at this point in the history
  • Loading branch information
Hufe921 committed Mar 15, 2024
1 parent 33a2dd8 commit 4e46afa
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/editor/utils/clipboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4e46afa

Please sign in to comment.