Ver código fonte

:rotating_light:

Vanessa 2 anos atrás
pai
commit
8705132850
2 arquivos alterados com 14 adições e 14 exclusões
  1. 6 6
      app/src/boot/onGetConfig.ts
  2. 8 8
      app/src/config/keymap.ts

+ 6 - 6
app/src/boot/onGetConfig.ts

@@ -99,23 +99,23 @@ const mergePluginHotkey = (app: App) => {
                         custom: command.hotkey,
                     }
                 };
-                return
+                return;
             }
             if (!window.siyuan.config.keymap.plugin[plugin.name][command.langKey]) {
                 command.customHotkey = command.hotkey;
                 window.siyuan.config.keymap.plugin[plugin.name][command.langKey] = {
                     default: command.hotkey,
                     custom: command.hotkey,
-                }
+                };
                 return;
             }
             if (window.siyuan.config.keymap.plugin[plugin.name][command.langKey]) {
                 command.customHotkey = window.siyuan.config.keymap.plugin[plugin.name][command.langKey].custom || command.hotkey;
-                window.siyuan.config.keymap.plugin[plugin.name][command.langKey]["default"] = command.hotkey
+                window.siyuan.config.keymap.plugin[plugin.name][command.langKey]["default"] = command.hotkey;
             }
-        })
-    })
-}
+        });
+    });
+};
 
 export const onGetConfig = (isStart: boolean, app: App) => {
     const matchKeymap1 = matchKeymap(Constants.SIYUAN_KEYMAP.general, "general");

+ 8 - 8
app/src/config/keymap.ts

@@ -33,9 +33,9 @@ export const keymap = {
         return html;
     },
     genHTML(app: App) {
-        let pluginHtml = ''
+        let pluginHtml = "";
         app.plugins.forEach(item => {
-            let commandHTML = ''
+            let commandHTML = "";
             item.commands.forEach(command => {
                 const keyValue = updateHotkeyTip(command.customHotkey);
                 commandHTML += `<label class="b3-list-item b3-list-item--narrow b3-list-item--hide-action">
@@ -61,9 +61,9 @@ export const keymap = {
     <div class="fn__none b3-list__panel">
         ${commandHTML}
     </div>
-</div>`
+</div>`;
             }
-        })
+        });
         if (pluginHtml) {
             pluginHtml = `<div class="b3-list b3-list--border b3-list--background">
     <div class="b3-list-item b3-list-item--narrow toggle">
@@ -73,7 +73,7 @@ export const keymap = {
         <span class="b3-list-item__text ft__on-surface">${window.siyuan.languages.plugin}</span>
     </div>
     ${pluginHtml}
-</div>`
+</div>`;
         }
         return `<label class="fn__flex b3-label config__item">
     <span class="fn__flex-center">${window.siyuan.languages.keymapTip}</span>
@@ -243,14 +243,14 @@ export const keymap = {
     },
     _getTip(element: HTMLElement) {
         const thirdElement = element.parentElement;
-        let tip = thirdElement.querySelector(".b3-list-item__text").textContent.trim()
+        let tip = thirdElement.querySelector(".b3-list-item__text").textContent.trim();
         const secondElement = thirdElement.parentElement.previousElementSibling;
         tip = secondElement.textContent.trim() + "-" + tip;
         const firstElement = secondElement.parentElement.previousElementSibling;
         if (firstElement.classList.contains("b3-list-item")) {
             tip = firstElement.textContent.trim() + "-" + tip;
         }
-        return tip
+        return tip;
     },
     bindEvent() {
         keymap.element.querySelector("#keymapRefreshBtn").addEventListener("click", () => {
@@ -372,7 +372,7 @@ export const keymap = {
                         showMessage(`${window.siyuan.languages.keymap} [${keymap._getTip(this)}] ${window.siyuan.languages.invalid}`);
                         return;
                     }
-                    const hasConflict = Array.from(keymap.element.querySelectorAll("label.b3-list-item input")).find(inputItem => {
+                    const hasConflict = Array.from(keymap.element.querySelectorAll("label.b3-list-item input")).find((inputItem: HTMLElement) => {
                         if (!inputItem.isSameNode(this) && inputItem.getAttribute("data-value") === keymapStr) {
                             const inputValueList = inputItem.getAttribute("data-key").split(Constants.ZWSP);
                             if (inputValueList[1] === "list") {