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

Vanessa1d4380bb7502
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index b1dd6e9eac..86cc1c9081 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -853,8 +853,19 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
let nextSibling = hasNextSibling(range.startContainer) as Element;
if (nextSibling) {
if (nextSibling.nodeType === 3 && nextSibling.textContent === Constants.ZWSP) {
+ if (!nextSibling.nextSibling) {
+ // https://github.com/siyuan-note/siyuan/issues/13524
+ const nextBlockElement = getNextBlock(nodeElement)
+ if (nextBlockElement) {
+ removeBlock(protyle, nextBlockElement, range, "remove");
+ }
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
nextSibling = nextSibling.nextSibling as Element;
}
+
if (nextSibling.nodeType === 1 && nextSibling.classList.contains("img")) {
// 光标需在图片前 https://github.com/siyuan-note/siyuan/issues/12452
const textPosition = getSelectionOffset(range.startContainer, protyle.wysiwyg.element, range);