Browse Source

:bug: 为空时显示 placeholder

Liyuan Li 5 years ago
parent
commit
28b410024f
2 changed files with 2 additions and 2 deletions
  1. 1 1
      src/ts/sv/index.ts
  2. 1 1
      src/ts/sv/processKeydown.ts

+ 1 - 1
src/ts/sv/index.ts

@@ -87,7 +87,7 @@ class Editor {
             }
             if ((event.key === "Backspace" || event.key === "Delete") &&
                 vditor.sv.element.innerHTML !== "" && vditor.sv.element.childNodes.length === 1 &&
-                vditor.sv.element.firstElementChild && vditor.sv.element.firstElementChild.tagName === "SPAN"
+                vditor.sv.element.firstElementChild && vditor.sv.element.firstElementChild.tagName === "DIV"
                 && vditor.sv.element.firstElementChild.childElementCount === 2
                 && (vditor.sv.element.firstElementChild.textContent === "" || vditor.sv.element.textContent === "\n")) {
                 // 为空时显示 placeholder

+ 1 - 1
src/ts/sv/processKeydown.ts

@@ -119,7 +119,7 @@ export const processKeydown = (vditor: IVditor, event: KeyboardEvent) => {
         if (textElement) {
             newLineText += processPreviousMarkers(textElement);
         } else {
-            let codeMarkerElement = hasClosestByAttribute(startContainer, "data-type", "code-block-open-marker")
+            let codeMarkerElement = hasClosestByAttribute(startContainer, "data-type", "code-block-open-marker");
             if (!codeMarkerElement) {
                 codeMarkerElement = hasClosestByAttribute(startContainer, "data-type", "code-block-info");
                 if (codeMarkerElement) {