Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/15196

Vanessadbcd6df7f923
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 8524e7318d..5370064c6f 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -365,9 +365,10 @@ export class WYSIWYG {
const selectTypes = protyle.toolbar.getCurrentType(range);
const spanElement = hasClosestByTag(range.startContainer, "SPAN");
const headingElement = hasClosestByAttribute(range.startContainer, "data-type", "NodeHeading");
+ const matchHeading = headingElement && headingElement.textContent.replace(Constants.ZWSP, "") === range.toString();
if ((selectTypes.length > 0 && spanElement && spanElement.textContent.replace(Constants.ZWSP, "") === range.toString()) ||
- (headingElement && headingElement.textContent.replace(Constants.ZWSP, "") === range.toString())) {
- if (headingElement) {
+ matchHeading) {
+ if (matchHeading) {
// 复制标题 https://github.com/siyuan-note/insider/issues/297
tempElement.append(headingElement.cloneNode(true));
} else if (!["DIV", "TD", "TH", "TR"].includes(range.startContainer.parentElement.tagName)) {