Van 5 år sedan
förälder
incheckning
0dafbc8273
1 ändrade filer med 2 tillägg och 6 borttagningar
  1. 2 6
      src/ts/wysiwyg/highlightToolbar.ts

+ 2 - 6
src/ts/wysiwyg/highlightToolbar.ts

@@ -669,13 +669,9 @@ export const highlightToolbar = (vditor: IVditor) => {
             input.className = "vditor-input";
             input.setAttribute("placeholder", "ID" + "<" + updateHotkeyTip("⌥-Enter") + ">");
             input.style.width = "120px";
-            input.value = headingElement.getAttribute("id");
+            input.value = headingElement.getAttribute("data-id") || "";
             input.oninput = () => {
-                if (input.value.trim() !== "") {
-                    headingElement.id = input.value;
-                } else {
-                    headingElement.removeAttribute("id");
-                }
+                headingElement.setAttribute("data-id", input.value);
             };
             input.onkeydown = (event) => {
                 if (event.isComposing) {