Skip to content

Commit

Permalink
🎨 #14002
Browse files Browse the repository at this point in the history
  • Loading branch information
Vanessa219 committed Feb 3, 2025
1 parent 3a5a3b4 commit 60c47a5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/src/protyle/wysiwyg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,9 @@ export class WYSIWYG {
}
// 不能使用 commonAncestorContainer https://ld246.com/article/1643282894693
if (hasClosestByAttribute(range.startContainer, "data-type", "NodeCodeBlock")) {
textPlain = tempElement.textContent.replace(new RegExp(Constants.ZWSP, "g"), "").replace(/\n$/, "");
textPlain = tempElement.textContent.replace(Constants.ZWSP, "").replace(/\n$/, "");
} else if (hasClosestByMatchTag(range.startContainer, "CODE")) {
textPlain = tempElement.textContent.replace(new RegExp(Constants.ZWSP, "g"), "");
textPlain = tempElement.textContent.replace(Constants.ZWSP, "");
} else {
textPlain = range.toString();
}
Expand All @@ -428,8 +428,9 @@ export class WYSIWYG {
html = getEnableHTML(html);
}
textPlain = textPlain || protyle.lute.BlockDOM2StdMd(html).trimEnd();
textPlain = textPlain.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
textPlain = textPlain.replace(new RegExp(Constants.ZWSP, "g"), ""); // Remove ZWSP when copying inline elements https://github.com/siyuan-note/siyuan/issues/13882
textPlain = textPlain.replace(/\u00A0/g, " ") // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382
// Remove ZWSP when copying inline elements https://github.com/siyuan-note/siyuan/issues/13882
.replace(new RegExp(Constants.ZWSP, "g"), "");
event.clipboardData.setData("text/plain", textPlain);
event.clipboardData.setData("text/html", selectTableElement ? html : protyle.lute.BlockDOM2HTML(selectAVElement ? textPlain : html));
event.clipboardData.setData("text/siyuan", selectTableElement ? protyle.lute.HTML2BlockDOM(html) : html);
Expand Down

0 comments on commit 60c47a5

Please sign in to comment.