Ver Fonte

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

Vanessa há 3 anos atrás
pai
commit
79960b2c86
1 ficheiros alterados com 6 adições e 1 exclusões
  1. 6 1
      app/src/protyle/wysiwyg/input.ts

+ 6 - 1
app/src/protyle/wysiwyg/input.ts

@@ -79,12 +79,15 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
     }
     }
     let html = blockElement.outerHTML;
     let html = blockElement.outerHTML;
     let todoOldHTML = "";
     let todoOldHTML = "";
+    let focusHR = false
     if (editElement.textContent === "---" && !blockElement.classList.contains("code-block")) {
     if (editElement.textContent === "---" && !blockElement.classList.contains("code-block")) {
-        html = `<div data-node-id="${id}" data-type="NodeThematicBreak" class="hr"><div><wbr></div></div>`;
+        html = `<div data-node-id="${id}" data-type="NodeThematicBreak" class="hr"><div></div></div>`;
         const nextBlockElement = getNextBlock(editElement);
         const nextBlockElement = getNextBlock(editElement);
         if (nextBlockElement) {
         if (nextBlockElement) {
             if (!isNotEditBlock(nextBlockElement)) {
             if (!isNotEditBlock(nextBlockElement)) {
                 focusBlock(nextBlockElement);
                 focusBlock(nextBlockElement);
+            } else {
+                focusHR = true;
             }
             }
         } else {
         } else {
             html += genEmptyBlock(false, true);
             html += genEmptyBlock(false, true);
@@ -166,6 +169,8 @@ export const input = async (protyle: IProtyle, blockElement: HTMLElement, range:
                 blockRender(protyle, realElement);
                 blockRender(protyle, realElement);
                 protyle.toolbar.showRender(protyle, realElement);
                 protyle.toolbar.showRender(protyle, realElement);
                 hideElements(["hint"], protyle);
                 hideElements(["hint"], protyle);
+            } else if (realType === "NodeThematicBreak" && focusHR) {
+                focusBlock(blockElement);
             } else {
             } else {
                 mathRender(realElement);
                 mathRender(realElement);
                 if (index === tempElement.content.childElementCount - 1) {
                 if (index === tempElement.content.childElementCount - 1) {