diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index 0b3bd68ac..1430d8efa 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -28,7 +28,7 @@ export const initBlockPopover = (app: App) => { if (aElement.classList.contains("av__celltext")) { if (aElement.scrollWidth > aElement.parentElement.clientWidth - 11) { if (aElement.querySelector(".av__cellicon")) { - tip = `${aElement.firstChild.textContent} ➡️ ${aElement.lastChild.textContent}` + tip = `${aElement.firstChild.textContent} ➡️ ${aElement.lastChild.textContent}`; } else { tip = aElement.textContent; } diff --git a/app/src/boot/globalEvent/searchKeydown.ts b/app/src/boot/globalEvent/searchKeydown.ts index ab08d8c91..34b64da79 100644 --- a/app/src/boot/globalEvent/searchKeydown.ts +++ b/app/src/boot/globalEvent/searchKeydown.ts @@ -25,16 +25,16 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { if (hasClosestByClassName(range.startContainer, "protyle", true)) { return false; } - let element: HTMLElement - let dialog: Dialog - let edit - let config: ISearchOption + let element: HTMLElement; + let dialog: Dialog; + let edit; + let config: ISearchOption; window.siyuan.dialogs.find((item) => { if (item.element.contains(range.startContainer) && item.element.querySelector("#searchList")) { element = item.element.querySelector(".b3-dialog__body"); - dialog = item - config = dialog.data - edit = dialog.editor + dialog = item; + config = dialog.data; + edit = dialog.editor; return true; } }); @@ -43,7 +43,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { if (item.element.contains(range.startContainer)) { element = item.element; edit = item.edit; - config = item.config + config = item.config; return true; } }); @@ -52,7 +52,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { return false; } const assetsElement = element.querySelector("#searchAssets"); - const isAsset = !assetsElement.classList.contains("fn__none") + const isAsset = !assetsElement.classList.contains("fn__none"); const listElement = isAsset ? assetsElement.querySelector("#searchAssetList") : element.querySelector("#searchList"); let currentList: HTMLElement = listElement.querySelector(".b3-list-item--focus"); if (!currentList) { @@ -63,7 +63,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { newFileByName(app, searchInputElement.value); return true; } - const targetId = (event.target as HTMLElement).id + const targetId = (event.target as HTMLElement).id; const historyElement = element.querySelector("#searchHistoryList"); const replaceHistoryElement = element.querySelector("#replaceHistoryList"); const replaceInputElement = element.querySelector("#replaceInput") as HTMLInputElement; @@ -82,14 +82,14 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { } return true; } - const assetLocal = window.siyuan.storage[Constants.LOCAL_SEARCHASSET] as ISearchAssetOption + const assetLocal = window.siyuan.storage[Constants.LOCAL_SEARCHASSET] as ISearchAssetOption; let history; if (!historyElement.classList.contains("fn__none")) { - history = "history" + history = "history"; } else if (!replaceHistoryElement.classList.contains("fn__none")) { - history = "replaceHistory" + history = "replaceHistory"; } else if (isAsset && !assetHistoryElement.classList.contains("fn__none")) { - history = "assetHistory" + history = "assetHistory"; } if (history) { if (event.key === "Escape") { @@ -155,7 +155,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { }); return true; } - const id = currentList.getAttribute("data-node-id") + const id = currentList.getAttribute("data-node-id"); if (matchHotKey("⌘/", event)) { const currentRect = currentList.getBoundingClientRect(); initSearchMenu(id).popup({ @@ -215,12 +215,12 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { } } } - return true + return true; } if (Constants.KEYCODELIST[event.keyCode] === "PageDown") { if (isAsset) { if (!assetsElement.querySelector('[data-type="assetNext"]').getAttribute("disabled")) { - const assetPages = assetsElement.querySelector("#searchAssetResult .fn__flex-center").textContent.split("/") + const assetPages = assetsElement.querySelector("#searchAssetResult .fn__flex-center").textContent.split("/"); let currentPage = parseInt(assetPages[0]); if (currentPage < parseInt(assetPages[1])) { currentPage++; @@ -236,7 +236,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { } } } - return true + return true; } if (!window.siyuan.menus.menu.element.classList.contains("fn__none")) { return false; @@ -298,7 +298,7 @@ export const searchKeydown = (app: App, event: KeyboardEvent) => { edit, }); } - return true + return true; } if (event.key === "ArrowUp") { currentList.classList.remove("b3-list-item--focus"); diff --git a/app/src/card/openCard.ts b/app/src/card/openCard.ts index faaa1d21e..df46e3b8d 100644 --- a/app/src/card/openCard.ts +++ b/app/src/card/openCard.ts @@ -131,7 +131,7 @@ export const bindCardEvent = (options: { } let index = 0; if (typeof options.index === "number") { - index = options.index + index = options.index; } const editor = new Protyle(options.app, options.element.querySelector("[data-type='render']") as HTMLElement, { blockId: "", diff --git a/app/src/config/repos.ts b/app/src/config/repos.ts index 347d9a618..89c151c99 100644 --- a/app/src/config/repos.ts +++ b/app/src/config/repos.ts @@ -2,7 +2,6 @@ import {needLogin, needSubscribe} from "../util/needSubscribe"; import {fetchPost} from "../util/fetch"; import {showMessage} from "../dialog/message"; import {bindSyncCloudListEvent, getSyncCloudList} from "../sync/syncGuide"; -import {hasClosestByClassName} from "../protyle/util/hasClosest"; import {processSync} from "../dialog/processSystem"; import {getCloudURL} from "./util/about"; @@ -436,7 +435,7 @@ export const repos = { repos.element.firstElementChild.addEventListener("click", (event) => { let target = event.target as HTMLElement; while (target && target !== repos.element) { - const action = target.getAttribute("data-action") + const action = target.getAttribute("data-action"); if (action === "config") { if (syncConfigElement.classList.contains("fn__none")) { getSyncCloudList(syncConfigElement, true); @@ -444,7 +443,7 @@ export const repos = { } else { syncConfigElement.classList.add("fn__none"); } - break + break; } else if (action === "togglePassword") { const isEye = target.firstElementChild.getAttribute("xlink:href") === "#iconEye"; target.firstElementChild.setAttribute("xlink:href", isEye ? "#iconEyeoff" : "#iconEye"); @@ -453,10 +452,10 @@ export const repos = { } else if (action === "exportData") { fetchPost(target.getAttribute("data-type") === "s3" ? "/api/sync/exportSyncProviderS3" : "/api/sync/exportSyncProviderWebDAV", {}, response => { window.location.href = response.data.zip; - }) + }); break; } - target = target.parentElement + target = target.parentElement; } }); }, diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 069d19d1d..f38912b32 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -84,11 +84,11 @@ const renderAssetList = (element: Element, k: string, position: IPosition, exts: inputElement.select(); } }); -} +}; export const assetMenu = (protyle: IProtyle, position: IPosition, callback?: (url: string) => void, exts?: string[]) => { window.siyuan.menus.menu.remove(); - const menu = new Menu() + const menu = new Menu(); menu.addItem({ iconHTML: "", type: "readonly", @@ -185,8 +185,8 @@ export const assetMenu = (protyle: IProtyle, position: IPosition, callback?: (ur }); renderAssetList(element, "", position, exts); } - }) -} + }); +}; export const fileAnnotationRefMenu = (protyle: IProtyle, refElement: HTMLElement) => { const nodeElement = hasClosestBlock(refElement); diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts index a46e3b940..c73d319df 100644 --- a/app/src/protyle/toolbar/index.ts +++ b/app/src/protyle/toolbar/index.ts @@ -21,7 +21,7 @@ import {highlightRender} from "../render/highlightRender"; import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock"; import {processRender} from "../util/processCode"; import {BlockRef} from "./BlockRef"; -import {hintRenderAssets, hintRenderTemplate, hintRenderWidget} from "../hint/extend"; +import {hintRenderTemplate, hintRenderWidget} from "../hint/extend"; import {blockRender} from "../render/blockRender"; /// #if !BROWSER import {openBy} from "../../editor/util"; @@ -35,7 +35,6 @@ import * as dayjs from "dayjs"; import {insertEmptyBlock} from "../../block/util"; import {matchHotKey} from "../util/hotKey"; import {hideElements} from "../ui/hideElements"; -import {renderAssetsPreview} from "../../asset/renderAssets"; import {electronUndo} from "../undo"; import {previewTemplate} from "./util"; import {hideMessage, showMessage} from "../../dialog/message"; diff --git a/app/src/search/spread.ts b/app/src/search/spread.ts index 796d2a84c..1fe4bc823 100644 --- a/app/src/search/spread.ts +++ b/app/src/search/spread.ts @@ -110,7 +110,7 @@ export const openSearch = async (options: { sort: localData.sort, types: Object.assign({}, localData.types), page: options.key ? 1 : localData.page - } + }; const edit = genSearch(options.app, config, dialog.element.querySelector(".b3-dialog__body"), () => { dialog.destroy({focus: "false"}); });