瀏覽代碼

:rotating_light:

Vanessa 2 年之前
父節點
當前提交
990b31dc00
共有 4 個文件被更改,包括 21 次插入16 次删除
  1. 2 2
      app/electron/main.js
  2. 18 12
      app/src/card/openCard.ts
  3. 0 1
      app/src/protyle/hint/index.ts
  4. 1 1
      app/src/util/globalShortcut.ts

+ 2 - 2
app/electron/main.js

@@ -760,9 +760,9 @@ app.whenReady().then(() => {
             },
             },
         });
         });
         win.loadURL(data.url);
         win.loadURL(data.url);
-        const targetScreen = screen.getDisplayNearestPoint(screen.getCursorScreenPoint())
+        const targetScreen = screen.getDisplayNearestPoint(screen.getCursorScreenPoint());
         if (mainScreen.id !== targetScreen.id) {
         if (mainScreen.id !== targetScreen.id) {
-            win.setBounds(targetScreen.workArea)
+            win.setBounds(targetScreen.workArea);
         }
         }
         require("@electron/remote/main").enable(win.webContents);
         require("@electron/remote/main").enable(win.webContents);
     });
     });

+ 18 - 12
app/src/card/openCard.ts

@@ -150,7 +150,7 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
                 type = "3";
                 type = "3";
             } else if (event.detail === " ") {
             } else if (event.detail === " ") {
                 type = "-1";
                 type = "-1";
-            }else if (event.detail === "p") {
+            } else if (event.detail === "p") {
                 type = "-2";
                 type = "-2";
             }
             }
         }
         }
@@ -167,6 +167,9 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
         event.stopPropagation();
         event.stopPropagation();
         hideElements(["toolbar", "hint", "util"], editor.protyle);
         hideElements(["toolbar", "hint", "util"], editor.protyle);
         if (type === "-1") {
         if (type === "-1") {
+            if (actionElements[0].classList.contains("fn__none")) {
+                return;
+            }
             editor.protyle.element.classList.remove("card__block--hide");
             editor.protyle.element.classList.remove("card__block--hide");
             actionElements[0].classList.add("fn__none");
             actionElements[0].classList.add("fn__none");
             actionElements[1].querySelectorAll(".b3-button").forEach((element, btnIndex) => {
             actionElements[1].querySelectorAll(".b3-button").forEach((element, btnIndex) => {
@@ -176,6 +179,9 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
             return;
             return;
         }
         }
         if (type === "-2") {
         if (type === "-2") {
+            if (actionElements[0].classList.contains("fn__none")) {
+                return;
+            }
             if (index > 0) {
             if (index > 0) {
                 index--;
                 index--;
                 editor.protyle.element.classList.add("card__block--hide");
                 editor.protyle.element.classList.add("card__block--hide");
@@ -185,11 +191,11 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
                     actionElements,
                     actionElements,
                     index,
                     index,
                     blocks
                     blocks
-                })
+                });
             }
             }
             return;
             return;
         }
         }
-        if (["0", "1", "2", "3"].includes(type)) {
+        if (["0", "1", "2", "3"].includes(type) && actionElements[0].classList.contains("fn__none")) {
             fetchPost("/api/riff/reviewRiffCard", {
             fetchPost("/api/riff/reviewRiffCard", {
                 deckID: blocks[index].deckID,
                 deckID: blocks[index].deckID,
                 cardID: blocks[index].cardID,
                 cardID: blocks[index].cardID,
@@ -202,10 +208,10 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
                         rootID: titleElement.getAttribute("data-id"),
                         rootID: titleElement.getAttribute("data-id"),
                         deckID: selectElement?.value
                         deckID: selectElement?.value
                     }, (treeCards) => {
                     }, (treeCards) => {
-                        index = 0
-                        blocks = treeCards.data
+                        index = 0;
+                        blocks = treeCards.data;
                         if (treeCards.data.length === 0) {
                         if (treeCards.data.length === 0) {
-                            allDone(countElement, editor, actionElements)
+                            allDone(countElement, editor, actionElements);
                         } else {
                         } else {
                             nextCard({
                             nextCard({
                                 countElement,
                                 countElement,
@@ -213,7 +219,7 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
                                 actionElements,
                                 actionElements,
                                 index,
                                 index,
                                 blocks
                                 blocks
-                            })
+                            });
                         }
                         }
                     });
                     });
                     return;
                     return;
@@ -224,7 +230,7 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
                     actionElements,
                     actionElements,
                     index,
                     index,
                     blocks
                     blocks
-                })
+                });
             });
             });
         }
         }
     });
     });
@@ -243,9 +249,9 @@ export const openCardByData = (cardsData: ICard[], html = "") => {
                     actionElements,
                     actionElements,
                     index,
                     index,
                     blocks
                     blocks
-                })
+                });
             } else {
             } else {
-                allDone(countElement, editor, actionElements)
+                allDone(countElement, editor, actionElements);
             }
             }
         });
         });
     });
     });
@@ -262,7 +268,7 @@ const nextCard = (options: {
     options.countElement.classList.remove("fn__none");
     options.countElement.classList.remove("fn__none");
     if (options.index === 0) {
     if (options.index === 0) {
         options.actionElements[0].firstElementChild.setAttribute("disabled", "disabled");
         options.actionElements[0].firstElementChild.setAttribute("disabled", "disabled");
-    } else{
+    } else {
         options.actionElements[0].firstElementChild.removeAttribute("disabled");
         options.actionElements[0].firstElementChild.removeAttribute("disabled");
     }
     }
     fetchPost("/api/filetree/getDoc", {
     fetchPost("/api/filetree/getDoc", {
@@ -272,7 +278,7 @@ const nextCard = (options: {
     }, (response) => {
     }, (response) => {
         onGet(response, options.editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
         onGet(response, options.editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]);
     });
     });
-}
+};
 
 
 const allDone = (countElement: Element, editor: Protyle, actionElements: NodeListOf<Element>) => {
 const allDone = (countElement: Element, editor: Protyle, actionElements: NodeListOf<Element>) => {
     countElement.classList.add("fn__none");
     countElement.classList.add("fn__none");

+ 0 - 1
app/src/protyle/hint/index.ts

@@ -21,7 +21,6 @@ import {hideElements} from "../ui/hideElements";
 import {fetchPost} from "../../util/fetch";
 import {fetchPost} from "../../util/fetch";
 import {getDisplayName, pathPosix} from "../../util/pathName";
 import {getDisplayName, pathPosix} from "../../util/pathName";
 import {addEmoji, filterEmoji, lazyLoadEmoji, lazyLoadEmojiImg, unicode2Emoji} from "../../emoji";
 import {addEmoji, filterEmoji, lazyLoadEmoji, lazyLoadEmojiImg, unicode2Emoji} from "../../emoji";
-import {escapeHtml} from "../../util/escape";
 import {blockRender} from "../markdown/blockRender";
 import {blockRender} from "../markdown/blockRender";
 import {uploadFiles} from "../upload";
 import {uploadFiles} from "../upload";
 /// #if !MOBILE
 /// #if !MOBILE

+ 1 - 1
app/src/util/globalShortcut.ts

@@ -88,7 +88,7 @@ const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => {
 };
 };
 
 
 export const globalShortcut = () => {
 export const globalShortcut = () => {
-    document.body.addEventListener("mouseleave", (event) => {
+    document.body.addEventListener("mouseleave", () => {
         window.siyuan.layout.leftDock.hideDock();
         window.siyuan.layout.leftDock.hideDock();
         window.siyuan.layout.rightDock.hideDock();
         window.siyuan.layout.rightDock.hideDock();
         window.siyuan.layout.bottomDock.hideDock();
         window.siyuan.layout.bottomDock.hideDock();