Browse Source

:art: https://github.com/siyuan-note/siyuan/issues/9320

Vanessa 1 year ago
parent
commit
82bed847e6
1 changed files with 3 additions and 3 deletions
  1. 3 3
      app/src/mobile/util/keyboardToolbar.ts

+ 3 - 3
app/src/mobile/util/keyboardToolbar.ts

@@ -21,10 +21,10 @@ const getSlashItem = (value: string, icon: string, text: string, focus = "false"
     } else {
     } else {
         iconHTML = icon;
         iconHTML = icon;
     }
     }
-    return `<div class="keyboard__slash-item" data-focus="${focus}" data-value="${encodeURIComponent(value)}">
+    return `<button class="keyboard__slash-item" data-focus="${focus}" data-value="${encodeURIComponent(value)}">
     ${iconHTML}
     ${iconHTML}
     <span class="keyboard__slash-text">${text}</span>
     <span class="keyboard__slash-text">${text}</span>
-</div>`;
+</button>`;
 };
 };
 
 
 export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => {
 export const renderTextMenu = (protyle: IProtyle, toolbarElement: Element) => {
@@ -500,9 +500,9 @@ export const initKeyboardToolbar = () => {
 </div>
 </div>
 <div class="keyboard__util"></div>`;
 <div class="keyboard__util"></div>`;
     toolbarElement.addEventListener("click", (event) => {
     toolbarElement.addEventListener("click", (event) => {
+        const protyle = getCurrentEditor()?.protyle;
         const target = event.target as HTMLElement;
         const target = event.target as HTMLElement;
         const slashBtnElement = hasClosestByClassName(event.target as HTMLElement, "keyboard__slash-item");
         const slashBtnElement = hasClosestByClassName(event.target as HTMLElement, "keyboard__slash-item");
-        const protyle = getCurrentEditor()?.protyle;
         if (slashBtnElement && !slashBtnElement.getAttribute("data-type")) {
         if (slashBtnElement && !slashBtnElement.getAttribute("data-type")) {
             const dataValue = decodeURIComponent(slashBtnElement.getAttribute("data-value"));
             const dataValue = decodeURIComponent(slashBtnElement.getAttribute("data-value"));
             protyle.hint.fill(dataValue, protyle, false);   // 点击后 range 会改变
             protyle.hint.fill(dataValue, protyle, false);   // 点击后 range 会改变