mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-06 00:38:49 +01:00
This commit is contained in:
parent
d663064b39
commit
9945bb3c75
1 changed files with 7 additions and 2 deletions
|
|
@ -415,8 +415,13 @@ export class WYSIWYG {
|
|||
html = tempElement.innerHTML;
|
||||
}
|
||||
// 不能使用 commonAncestorContainer https://ld246.com/article/1643282894693
|
||||
if (hasClosestByAttribute(range.startContainer, "data-type", "NodeCodeBlock")) {
|
||||
textPlain = tempElement.textContent.replace(Constants.ZWSP, "").replace(/\n$/, "");
|
||||
const codeBlockElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeCodeBlock");
|
||||
if (codeBlockElement) {
|
||||
textPlain = tempElement.textContent.replace(Constants.ZWSP, "");
|
||||
if (range.endContainer.textContent.length === range.endOffset &&
|
||||
(range.endContainer.parentElement.getAttribute("spellcheck") ? !range.endContainer.nextSibling : !range.endContainer.parentElement.nextSibling)) {
|
||||
textPlain = textPlain.replace(/\n$/, "");
|
||||
}
|
||||
} else if (hasClosestByMatchTag(range.startContainer, "CODE")) {
|
||||
textPlain = tempElement.textContent.replace(Constants.ZWSP, "");
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue