diff --git a/app/src/protyle/wysiwyg/input.ts b/app/src/protyle/wysiwyg/input.ts index a984c39b0..549f3b9a2 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 01378509e..5c16332d3 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);