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

Vanessa7e4dcebde269
diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts
index a984c39b0a..549f3b9a2c 100644
--- a/app/src/protyle/wysiwyg/input.ts
+++ b/app/src/protyle/wysiwyg/input.ts
@@ -56,8 +56,8 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
if (event && event.inputType === "deleteContentForward") {
const wbrNextElement = hasNextSibling(wbrElement) as HTMLElement;
if (wbrNextElement && wbrNextElement.nodeType === 1 && !wbrNextElement.textContent.startsWith(Constants.ZWSP)) {
- const type = wbrNextElement.getAttribute("data-type").split(" ");
- if (type.includes("code") || type.includes("kbd") || type.includes("tag")) {
+ const nextType = (wbrNextElement.getAttribute("data-type") || "").split(" ");
+ if (nextType.includes("code") || nextType.includes("kbd") || nextType.includes("tag")) {
wbrNextElement.insertAdjacentElement("afterbegin", wbrElement);
}
}
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 01378509ee..5c16332d39 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -774,7 +774,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
const position = getSelectionOffset(editElement, protyle.wysiwyg.element, range);
if (event.key === "Delete" || matchHotKey("⌃D", event)) {
// 段末反向删除 https://github.com/siyuan-note/insider/issues/274
- if (position.end === editElement.textContent.length) {
+ if (position.end === editElement.textContent.length ||
+ // 软换行后删除 https://github.com/siyuan-note/siyuan/issues/11118
+ (position.end === editElement.textContent.length - 1 && editElement.textContent.endsWith("\n"))) {
const nextElement = getNextBlock(getTopAloneElement(nodeElement));
if (nextElement) {
const nextRange = focusBlock(nextElement);