diff --git a/app/src/history/doc.ts b/app/src/history/doc.ts index 68ced4c09..1a2957b33 100644 --- a/app/src/history/doc.ts +++ b/app/src/history/doc.ts @@ -1,8 +1,6 @@ import {Dialog} from "../dialog"; import {confirmDialog} from "../dialog/confirmDialog"; import {Constants} from "../constants"; -import {hasClosestByClassName} from "../protyle/util/hasClosest"; -import {renderAssetsPreview} from "../asset/renderAssets"; import {Protyle} from "../protyle"; import {disabledProtyle, onGet} from "../protyle/util/onGet"; import * as dayjs from "dayjs"; @@ -23,7 +21,7 @@ const renderDoc = (element: HTMLElement, currentPage: number, id: string) => { previousElement.setAttribute("disabled", "disabled"); } const opElement = element.querySelector('.b3-select[data-type="opselect"]') as HTMLSelectElement; - const listElement = element.querySelector('.b3-list--background') + const listElement = element.querySelector(".b3-list--background"); element.querySelector('.history__text[data-type="docPanel"]').classList.add("fn__none"); element.querySelector('.history__text[data-type="mdPanel"]').classList.remove("fn__none"); fetchPost("/api/history/searchHistory", { @@ -126,7 +124,7 @@ export const openDocHistory = (options: { while (target && !target.isEqualNode(dialog.element)) { const type = target.getAttribute("data-type"); if (type === "close") { - dialog.destroy() + dialog.destroy(); } else if (type === "rollback" && !isLoading) { getHistoryPath(target.parentElement, opElement.value, options.id, (dataPath) => { isLoading = false; @@ -181,7 +179,7 @@ export const openDocHistory = (options: { const getHistoryPath = (target: Element, op: string, id: string, cb: (path: string) => void) => { isLoading = true; - const path = target.getAttribute("data-path") + const path = target.getAttribute("data-path"); if (path) { cb(path); } @@ -191,6 +189,6 @@ const getHistoryPath = (target: Element, op: string, id: string, cb: (path: stri type: 3, created: target.getAttribute("data-created") }, (response) => { - cb(response.data.items[0].path) + cb(response.data.items[0].path); }); -} +}; diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.ts index ca623e598..5a44b5d5e 100644 --- a/app/src/layout/topBar.ts +++ b/app/src/layout/topBar.ts @@ -282,11 +282,11 @@ const openPlugin = (app: App, target: Element) => { click() { if (hasUnpin) { window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].splice(window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].indexOf(item.id), 1); - item.classList.remove("fn__none") + item.classList.remove("fn__none"); } else { window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].push(item.id); window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN] = Array.from(new Set(window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN])); - item.classList.add("fn__none") + item.classList.add("fn__none"); } setStorageVal(Constants.LOCAL_PLUGINTOPUNPIN, window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN]); } @@ -298,31 +298,31 @@ const openPlugin = (app: App, target: Element) => { click() { plugin.openSetting(); }, - }) + }); } const menuOption: IMenu = { icon: "iconInfo", label: item.getAttribute("aria-label"), click() { - item.dispatchEvent(new CustomEvent("click")) + item.dispatchEvent(new CustomEvent("click")); }, type: "submenu", submenu - } + }; if (item.querySelector("use")) { menuOption.icon = item.querySelector("use").getAttribute("xlink:href").replace("#", ""); } else { const svgElement = item.querySelector("svg").cloneNode(true) as HTMLElement; - svgElement.classList.add("b3-menu__icon") + svgElement.classList.add("b3-menu__icon"); menuOption.iconHTML = svgElement.outerHTML; } menu.addItem(menuOption); - hasPlugin = true - }) - }) + hasPlugin = true; + }); + }); if (hasPlugin) { - menu.addSeparator() + menu.addSeparator(); } menu.addItem({ icon: "iconSettings", @@ -336,5 +336,5 @@ const openPlugin = (app: App, target: Element) => { if (rect.width === 0) { rect = document.querySelector("#barMore").getBoundingClientRect(); } - menu.open({x: rect.right, y: rect.bottom, isLeft: true}) -} + menu.open({x: rect.right, y: rect.bottom, isLeft: true}); +}; diff --git a/app/src/plugin/Setting.ts b/app/src/plugin/Setting.ts index e91a69cab..407c1f9ec 100644 --- a/app/src/plugin/Setting.ts +++ b/app/src/plugin/Setting.ts @@ -43,7 +43,7 @@ export class Setting { }); const contentElement = dialog.element.querySelector(".b3-dialog__content"); this.items.forEach((item) => { - let html = "" + let html = ""; let actionElement = item.actionElement; if (!item.actionElement && item.createActionElement) { actionElement = item.createActionElement(); @@ -55,7 +55,7 @@ export class Setting { ${item.description ? `
${item.description}
` : ""}
-` +`; } else { html = `` +`; } contentElement.insertAdjacentHTML("beforeend", html); if (actionElement) { @@ -78,7 +78,7 @@ export class Setting { contentElement.lastElementChild.insertAdjacentElement("beforeend", actionElement); } } - }) + }); contentElement.querySelector("input")?.focus(); const btnsElement = dialog.element.querySelectorAll(".b3-dialog__action .b3-button"); btnsElement[0].addEventListener("click", () => { diff --git a/app/src/plugin/index.ts b/app/src/plugin/index.ts index e188efd75..0275e67c0 100644 --- a/app/src/plugin/index.ts +++ b/app/src/plugin/index.ts @@ -9,7 +9,6 @@ import {Tab} from "../layout/Tab"; import {getDockByType, setPanelFocus} from "../layout/util"; import {hasClosestByAttribute} from "../protyle/util/hasClosest"; import {BlockPanel} from "../block/Panel"; -import {genUUID} from "../util/genID"; import {Setting} from "./Setting"; export class Plugin {