diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.ts index 9c953d78c..5cc2cc211 100644 --- a/app/src/boot/onGetConfig.ts +++ b/app/src/boot/onGetConfig.ts @@ -251,32 +251,32 @@ export const initWindow = (app: App) => { ipcRenderer.on(Constants.SIYUAN_OPENURL, (event, url) => { if (/^siyuan:\/\/plugins\//.test(url)) { // siyuan://plugins/plugin-samplecustom_tab?title=自定义页签&icon=iconFace&data={"text": "This is the custom plugin tab I opened via protocol."} - const pluginId = url.replace("siyuan://plugins/", "").split("?")[0] + const pluginId = url.replace("siyuan://plugins/", "").split("?")[0]; app.plugins.find(plugin => { const match = Object.keys(plugin.models).find(key => { if (key === pluginId) { - let data = getSearch("data", url) + let data = getSearch("data", url); try { data = JSON.parse(data || "{}"); } catch (e) { - console.log("Error open plugin tab with protocol:", e) + console.log("Error open plugin tab with protocol:", e); } openFile({ app, custom: { title: getSearch("title", url), icon: getSearch("icon", url), - data: JSON.parse(getSearch("data", url) || "{}"), + data, fn: plugin.models[key] }, }); - return true + return true; } - }) + }); if (match) { - return true + return true; } - }) + }); return; } if (isSYProtocol(url)) { diff --git a/app/src/config/repos.ts b/app/src/config/repos.ts index c079a5679..287820e70 100644 --- a/app/src/config/repos.ts +++ b/app/src/config/repos.ts @@ -360,11 +360,11 @@ export const repos = { }); const syncModeElement = repos.element.querySelector("#syncMode") as HTMLSelectElement; syncModeElement.addEventListener("change", () => { - fetchPost("/api/sync/setSyncMode", {mode: parseInt(syncModeElement.value, 10)}, (response) => { + fetchPost("/api/sync/setSyncMode", {mode: parseInt(syncModeElement.value, 10)}, () => { if (syncModeElement.value === "1") { - syncPerceptionElement.parentElement.classList.remove("fn__none") + syncPerceptionElement.parentElement.classList.remove("fn__none"); } else { - syncPerceptionElement.parentElement.classList.add("fn__none") + syncPerceptionElement.parentElement.classList.add("fn__none"); } window.siyuan.config.sync.mode = parseInt(syncModeElement.value, 10); }); diff --git a/app/src/constants.ts b/app/src/constants.ts index 1f7bf4025..221f8e015 100644 --- a/app/src/constants.ts +++ b/app/src/constants.ts @@ -204,7 +204,7 @@ export abstract class Constants { 220: "\\", 221: "]", 222: "'", - } + }; // 冲突不使用 "⌘S/Q" // "⌘", "⇧", "⌥", "⌃" // "⌘A", "⌘X", "⌘C", "⌘V", "⌘-", "⌘=", "⌘0", "⇧⌘V", "⌘/", "⇧↑", "⇧↓", "⇧→", "⇧←", "⇧⇥", "⇧⌘⇥", "⌃⇥", "⌘⇥", "⌃⌘⇥", "⇧⌘→", "⇧⌘←", diff --git a/app/src/dialog/tooltip.ts b/app/src/dialog/tooltip.ts index 1f10b41e3..e22797dc7 100644 --- a/app/src/dialog/tooltip.ts +++ b/app/src/dialog/tooltip.ts @@ -26,7 +26,7 @@ export const showTooltip = (message: string, target: Element, error = false) => messageElement.classList.add("tooltip--memo"); // 为行级备注添加 class https://github.com/siyuan-note/siyuan/issues/6161 } let left = targetRect.left; - let topSpace = 8 + let topSpace = 8; const position = target.getAttribute("data-position"); if (position === "right") { left = targetRect.right - messageElement.clientWidth; diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.ts index 4e2254f55..53fce6d1e 100644 --- a/app/src/layout/Wnd.ts +++ b/app/src/layout/Wnd.ts @@ -580,18 +580,18 @@ export class Wnd { Array.from(this.headersElement.children).forEach((item: HTMLElement) => { const iconElement = item.querySelector(".item__icon"); const graphicElement = item.querySelector(".item__graphic"); - let iconHTML = undefined + let iconHTML = undefined; if (iconElement) { if (iconElement.firstElementChild?.tagName === "IMG") { // 图标为图片的文档 - iconHTML = `` + iconHTML = ``; } else { // 有图标的文档 - iconHTML = `${iconElement.innerHTML}` + iconHTML = `${iconElement.innerHTML}`; } } else if (!graphicElement) { // 没有图标的文档 - iconHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE, "b3-menu__icon", true) + iconHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE, "b3-menu__icon", true); } window.siyuan.menus.menu.append(new MenuItem({ label: escapeHtml(item.querySelector(".item__text").textContent), diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.ts index 0a77cb360..07985a58c 100644 --- a/app/src/layout/dock/Outline.ts +++ b/app/src/layout/dock/Outline.ts @@ -106,12 +106,12 @@ export class Outline extends Model { click: (element: HTMLElement) => { const id = element.getAttribute("data-node-id"); if (this.isPreview) { - const headElement = document.getElementById(id) + const headElement = document.getElementById(id); if (headElement) { - const tabElement = hasTopClosestByClassName(headElement, "protyle") + const tabElement = hasTopClosestByClassName(headElement, "protyle"); if (tabElement) { - const tab = getInstanceById(tabElement.getAttribute("data-id")) as Tab - tab.parent.switchTab(tab.headElement) + const tab = getInstanceById(tabElement.getAttribute("data-id")) as Tab; + tab.parent.switchTab(tab.headElement); } headElement.scrollIntoView(); } else { @@ -337,7 +337,7 @@ export class Outline extends Model { if (this.isPreview) { this.tree.element.querySelectorAll(".popover__block").forEach(item => { item.classList.remove("popover__block"); - }) + }); } if (currentId) { diff --git a/app/src/layout/topBar.ts b/app/src/layout/topBar.ts index 67e477576..0e2265cb0 100644 --- a/app/src/layout/topBar.ts +++ b/app/src/layout/topBar.ts @@ -17,7 +17,6 @@ import {Constants} from "../constants"; import {isBrowser, isWindow} from "../util/functions"; import {Menu} from "../plugin/Menu"; import {fetchPost} from "../util/fetch"; -import {escapeAttr} from "../util/escape"; import {needSubscribe} from "../util/needSubscribe"; import * as dayjs from "dayjs"; @@ -236,30 +235,30 @@ export const initBar = (app: App) => { event.stopPropagation(); event.preventDefault(); fetchPost("/api/sync/getSyncInfo", {}, (response) => { - let html = "" + let html = ""; if (!window.siyuan.config.sync.enabled || (0 === window.siyuan.config.sync.provider && needSubscribe(""))) { html = response.data.stat; } else { - html = window.siyuan.languages._kernel[82].replace("%s", dayjs(response.data.synced).format("YYYY-MM-DD HH:mm")) + "
" + html = window.siyuan.languages._kernel[82].replace("%s", dayjs(response.data.synced).format("YYYY-MM-DD HH:mm")) + "
"; html += " " + response.data.stat; if (response.data.kernels.length > 0) { - html += "
" - html += window.siyuan.languages.currentKernel + "
" - html += " " + response.data.kernel + "/" + window.siyuan.config.system.kernelVersion + " (" + window.siyuan.config.system.os + "/" + window.siyuan.config.system.name + ")
" - html += window.siyuan.languages.otherOnlineKernels + "
" + html += "
"; + html += window.siyuan.languages.currentKernel + "
"; + html += " " + response.data.kernel + "/" + window.siyuan.config.system.kernelVersion + " (" + window.siyuan.config.system.os + "/" + window.siyuan.config.system.name + ")
"; + html += window.siyuan.languages.otherOnlineKernels + "
"; response.data.kernels.forEach((item: { os: string; ver: string; hostname: string; id: string; }) => { - html += ` ${item.id}/${item.ver} (${item.os}/${item.hostname})
` - }) + html += ` ${item.id}/${item.ver} (${item.os}/${item.hostname})
`; + }); } } barSyncElement.setAttribute("aria-label", html); - }) - }) + }); + }); barSyncElement.setAttribute("aria-label", window.siyuan.config.sync.stat || (window.siyuan.languages.syncNow + " " + updateHotkeyTip(window.siyuan.config.keymap.general.syncNow.custom))); }; diff --git a/app/src/menus/util.ts b/app/src/menus/util.ts index e6c5c6a7b..17f0381f4 100644 --- a/app/src/menus/util.ts +++ b/app/src/menus/util.ts @@ -126,4 +126,4 @@ export const copyPNG = (imgElement: HTMLImageElement) => { }; tempElement.src = imgElement.getAttribute("src"); } -} +}; diff --git a/app/src/plugin/loader.ts b/app/src/plugin/loader.ts index 9eaac8f6e..e35d1b730 100644 --- a/app/src/plugin/loader.ts +++ b/app/src/plugin/loader.ts @@ -139,7 +139,7 @@ export const afterLoadPlugin = (plugin: Plugin) => { } if (!isWindow() || isMobile()) { - const pluginMenu: IMenu[] = [] + const pluginMenu: IMenu[] = []; plugin.topBarIcons.forEach(element => { if (isMobile()) { if (window.siyuan.storage[Constants.LOCAL_PLUGINTOPUNPIN].includes(element.id)) { @@ -149,7 +149,7 @@ export const afterLoadPlugin = (plugin: Plugin) => { click() { element.dispatchEvent(new CustomEvent("click")); } - }) + }); } else { document.querySelector("#menuAbout").after(element); } @@ -161,17 +161,17 @@ export const afterLoadPlugin = (plugin: Plugin) => { } }); if (isMobile() && pluginMenu.length > 0) { - const pluginElement = document.createElement("div") - pluginElement.classList.add("b3-menu__item") - pluginElement.setAttribute("data-menu", "true") - pluginElement.innerHTML = `${window.siyuan.languages.plugin}` + const pluginElement = document.createElement("div"); + pluginElement.classList.add("b3-menu__item"); + pluginElement.setAttribute("data-menu", "true"); + pluginElement.innerHTML = `${window.siyuan.languages.plugin}`; pluginElement.addEventListener("click", () => { - const menu = new Menu() + const menu = new Menu(); pluginMenu.forEach(item => { - menu.addItem(item) - }) + menu.addItem(item); + }); menu.fullscreen(); - }) + }); document.querySelector("#menuAbout").after(pluginElement); } } diff --git a/app/src/protyle/toolbar/Font.ts b/app/src/protyle/toolbar/Font.ts index 9e16c1bf8..cb9152f32 100644 --- a/app/src/protyle/toolbar/Font.ts +++ b/app/src/protyle/toolbar/Font.ts @@ -1,7 +1,7 @@ import {setStorageVal, updateHotkeyTip} from "../util/compatibility"; import {ToolbarItem} from "./ToolbarItem"; import {setPosition} from "../../util/setPosition"; -import {focusBlock, focusByRange, getSelectionPosition} from "../util/selection"; +import {focusByRange, getSelectionPosition} from "../util/selection"; import {Constants} from "../../constants"; import {hasClosestBlock, hasClosestByAttribute} from "../util/hasClosest"; import {updateBatchTransaction} from "../wysiwyg/transaction"; diff --git a/app/src/search/menu.ts b/app/src/search/menu.ts index 5b5654f13..51485e223 100644 --- a/app/src/search/menu.ts +++ b/app/src/search/menu.ts @@ -227,7 +227,7 @@ export const saveCriterion = (config: ISearchOption, criteriaElement.firstElementChild.insertAdjacentHTML("beforeend", `
${criterion.name}
`); }); }); -} +}; export const moreMenu = async (config: ISearchOption, criteriaData: ISearchOption[],