Przeglądaj źródła

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

Vanessa 1 rok temu
rodzic
commit
7e4dcebde2

+ 2 - 2
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);
             }
         }

+ 3 - 1
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);