mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-05-18 18:10:43 +08:00
This commit is contained in:
parent
9945bb3c75
commit
dc7ccce10a
@ -416,15 +416,13 @@ export class WYSIWYG {
|
|||||||
}
|
}
|
||||||
// 不能使用 commonAncestorContainer https://ld246.com/article/1643282894693
|
// 不能使用 commonAncestorContainer https://ld246.com/article/1643282894693
|
||||||
const codeBlockElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeCodeBlock");
|
const codeBlockElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeCodeBlock");
|
||||||
|
textPlain = tempElement.textContent;
|
||||||
if (codeBlockElement) {
|
if (codeBlockElement) {
|
||||||
textPlain = tempElement.textContent.replace(Constants.ZWSP, "");
|
|
||||||
if (range.endContainer.textContent.length === range.endOffset &&
|
if (range.endContainer.textContent.length === range.endOffset &&
|
||||||
(range.endContainer.parentElement.getAttribute("spellcheck") ? !range.endContainer.nextSibling : !range.endContainer.parentElement.nextSibling)) {
|
(range.endContainer.parentElement.getAttribute("spellcheck") ? !range.endContainer.nextSibling : !range.endContainer.parentElement.nextSibling)) {
|
||||||
textPlain = textPlain.replace(/\n$/, "");
|
textPlain = textPlain.replace(/\n$/, "");
|
||||||
}
|
}
|
||||||
} else if (hasClosestByMatchTag(range.startContainer, "CODE")) {
|
} else if (!hasClosestByMatchTag(range.startContainer, "CODE")) {
|
||||||
textPlain = tempElement.textContent.replace(Constants.ZWSP, "");
|
|
||||||
} else {
|
|
||||||
textPlain = range.toString();
|
textPlain = range.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user