Skip to content

Commit

Permalink
fix: copy triggers page status updates
Browse files Browse the repository at this point in the history
  • Loading branch information
YangFong committed Dec 22, 2024
1 parent 6178ab2 commit 0061505
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/CodemirrorEditor/EditorHeader/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,9 @@ function copy() {
window.getSelection()!.removeAllRanges()
if (copyMode.value === `html`) {
await copyContent(clipboardDiv.innerHTML)
}
else {
const temp = clipboardDiv.innerHTML
if (copyMode.value === `txt`) {
const range = document.createRange()
range.setStartBefore(clipboardDiv.firstChild!)
range.setEndAfter(clipboardDiv.lastChild!)
Expand All @@ -151,6 +150,10 @@ function copy() {
nextTick(() => toggleDark())
}
if (copyMode.value === `html`) {
await copyContent(temp)
}
// 输出提示
toast.success(copyMode.value === `html` ? `已复制 HTML 源码,请进行下一步操作。` : `已复制渲染后的文章到剪贴板,可直接到公众号后台粘贴。`)
Expand Down

0 comments on commit 0061505

Please sign in to comment.