diff --git a/app/electron/main.js b/app/electron/main.js index 4352bce98..e424d43de 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -760,9 +760,9 @@ app.whenReady().then(() => { }, }); win.loadURL(data.url); - const targetScreen = screen.getDisplayNearestPoint(screen.getCursorScreenPoint()) + const targetScreen = screen.getDisplayNearestPoint(screen.getCursorScreenPoint()); if (mainScreen.id !== targetScreen.id) { - win.setBounds(targetScreen.workArea) + win.setBounds(targetScreen.workArea); } require("@electron/remote/main").enable(win.webContents); }); diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.ts index d859bc035..c21246183 100644 --- a/app/src/card/openCard.ts +++ b/app/src/card/openCard.ts @@ -150,7 +150,7 @@ export const openCardByData = (cardsData: ICard[], html = "") => { type = "3"; } else if (event.detail === " ") { type = "-1"; - }else if (event.detail === "p") { + } else if (event.detail === "p") { type = "-2"; } } @@ -167,6 +167,9 @@ export const openCardByData = (cardsData: ICard[], html = "") => { event.stopPropagation(); hideElements(["toolbar", "hint", "util"], editor.protyle); if (type === "-1") { + if (actionElements[0].classList.contains("fn__none")) { + return; + } editor.protyle.element.classList.remove("card__block--hide"); actionElements[0].classList.add("fn__none"); actionElements[1].querySelectorAll(".b3-button").forEach((element, btnIndex) => { @@ -176,6 +179,9 @@ export const openCardByData = (cardsData: ICard[], html = "") => { return; } if (type === "-2") { + if (actionElements[0].classList.contains("fn__none")) { + return; + } if (index > 0) { index--; editor.protyle.element.classList.add("card__block--hide"); @@ -185,11 +191,11 @@ export const openCardByData = (cardsData: ICard[], html = "") => { actionElements, index, blocks - }) + }); } 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", { deckID: blocks[index].deckID, cardID: blocks[index].cardID, @@ -202,10 +208,10 @@ export const openCardByData = (cardsData: ICard[], html = "") => { rootID: titleElement.getAttribute("data-id"), deckID: selectElement?.value }, (treeCards) => { - index = 0 - blocks = treeCards.data + index = 0; + blocks = treeCards.data; if (treeCards.data.length === 0) { - allDone(countElement, editor, actionElements) + allDone(countElement, editor, actionElements); } else { nextCard({ countElement, @@ -213,7 +219,7 @@ export const openCardByData = (cardsData: ICard[], html = "") => { actionElements, index, blocks - }) + }); } }); return; @@ -224,7 +230,7 @@ export const openCardByData = (cardsData: ICard[], html = "") => { actionElements, index, blocks - }) + }); }); } }); @@ -243,9 +249,9 @@ export const openCardByData = (cardsData: ICard[], html = "") => { actionElements, index, blocks - }) + }); } else { - allDone(countElement, editor, actionElements) + allDone(countElement, editor, actionElements); } }); }); @@ -262,7 +268,7 @@ const nextCard = (options: { options.countElement.classList.remove("fn__none"); if (options.index === 0) { options.actionElements[0].firstElementChild.setAttribute("disabled", "disabled"); - } else{ + } else { options.actionElements[0].firstElementChild.removeAttribute("disabled"); } fetchPost("/api/filetree/getDoc", { @@ -272,7 +278,7 @@ const nextCard = (options: { }, (response) => { onGet(response, options.editor.protyle, [Constants.CB_GET_ALL, Constants.CB_GET_HTML]); }); -} +}; const allDone = (countElement: Element, editor: Protyle, actionElements: NodeListOf) => { countElement.classList.add("fn__none"); diff --git a/app/src/protyle/hint/index.ts b/app/src/protyle/hint/index.ts index befd15a7c..bf0e37ffd 100644 --- a/app/src/protyle/hint/index.ts +++ b/app/src/protyle/hint/index.ts @@ -21,7 +21,6 @@ import {hideElements} from "../ui/hideElements"; import {fetchPost} from "../../util/fetch"; import {getDisplayName, pathPosix} from "../../util/pathName"; import {addEmoji, filterEmoji, lazyLoadEmoji, lazyLoadEmojiImg, unicode2Emoji} from "../../emoji"; -import {escapeHtml} from "../../util/escape"; import {blockRender} from "../markdown/blockRender"; import {uploadFiles} from "../upload"; /// #if !MOBILE diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.ts index 58edc6455..44d6acae2 100644 --- a/app/src/util/globalShortcut.ts +++ b/app/src/util/globalShortcut.ts @@ -88,7 +88,7 @@ const switchDialogEvent = (event: MouseEvent, switchDialog: Dialog) => { }; export const globalShortcut = () => { - document.body.addEventListener("mouseleave", (event) => { + document.body.addEventListener("mouseleave", () => { window.siyuan.layout.leftDock.hideDock(); window.siyuan.layout.rightDock.hideDock(); window.siyuan.layout.bottomDock.hideDock();