Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/6309

Vanessaef5d7d5755f3
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 7fe0d88471..4b3729d627 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -737,15 +737,17 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
const imgSelectElement = protyle.wysiwyg.element.querySelector(".img--select");
if (imgSelectElement) {
- imgSelectElement.insertAdjacentHTML("afterend", "<wbr>");
imgSelectElement.classList.remove("img--select");
- const oldHTML = nodeElement.outerHTML;
- imgSelectElement.remove();
- updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML);
- focusByWbr(nodeElement, range);
- event.stopPropagation();
- event.preventDefault();
- return;
+ if (nodeElement.contains(imgSelectElement)) {
+ imgSelectElement.insertAdjacentHTML("afterend", "<wbr>");
+ const oldHTML = nodeElement.outerHTML;
+ imgSelectElement.remove();
+ updateTransaction(protyle, nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML, oldHTML);
+ focusByWbr(nodeElement, range);
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
} else if (selectText === "") {
const editElement = getContenteditableElement(nodeElement);
if (!editElement) {