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/17532

Vanessaf4dba0382885
diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts
index 33332d4f07..bfd834702f 100644
--- a/app/src/protyle/util/selection.ts
+++ b/app/src/protyle/util/selection.ts
@@ -547,13 +547,13 @@ export const setInsertWbrHTML = (nodeElement: HTMLElement, range: Range, protyle
const offset = getSelectionOffset(cellElement, nodeElement, range);
cellElement.classList.add("range");
const cloneNode = nodeElement.cloneNode(true) as HTMLElement;
- cellElement.classList.remove("range");
+ cellElement.removeAttribute("class");
const cloneCellElement = cloneNode.querySelector(".range");
const cloneRange = focusByOffset(cloneCellElement, offset.end, offset.end, false);
if (cloneRange) {
cloneRange.insertNode(document.createElement("wbr"));
}
- cloneCellElement.classList.remove("range");
+ cloneCellElement.removeAttribute("class");
protyle.wysiwyg.lastHTMLs[nodeElement.getAttribute("data-node-id")] = cloneNode.outerHTML;
}
} else {
diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts
index e5dbb1b658..44a2496309 100644
--- a/app/src/protyle/wysiwyg/input.ts
+++ b/app/src/protyle/wysiwyg/input.ts
@@ -241,6 +241,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
realElement = protyle.wysiwyg.element.querySelector(`[data-node-id="${tempId}"]`);
}
const realType = realElement.getAttribute("data-type");
+ let itemHTML = "";
if (realType === "NodeCodeBlock") {
const languageElement = realElement.querySelector(".protyle-action__language");
if (languageElement) {
@@ -283,6 +284,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
currentWbrElement.insertAdjacentText("beforebegin", Constants.ZWSP);
}
}
+ itemHTML = realElement.outerHTML;
focusByWbr(protyle.wysiwyg.element, range);
protyle.hint.render(protyle);
// 表格出现滚动条,输入数字会向前滚 https://github.com/siyuan-note/siyuan/issues/3650
@@ -292,7 +294,7 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
}
}
// https://github.com/siyuan-note/siyuan/issues/14766
- html += realElement.outerHTML;
+ html += itemHTML || realElement.outerHTML;
});
} else if (blockElement.getAttribute("data-type") === "NodeCodeBlock") {
editElement.parentElement.removeAttribute("data-render");