From d24f5ae3cfe9e9ae7a1acfec0043882ce21dcaf3 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 16 May 2023 00:05:18 +0800 Subject: [PATCH] :rotating_light: --- app/src/config/bazaar.ts | 2 +- app/src/menus/protyle.ts | 2 +- app/src/plugin/uninstall.ts | 28 ++++++++++++++-------------- app/src/protyle/breadcrumb/index.ts | 1 - app/src/protyle/scroll/saveScroll.ts | 12 ++++++------ app/src/protyle/util/onGet.ts | 2 +- app/src/sync/syncGuide.ts | 4 ++-- app/src/util/backForward.ts | 3 +-- 8 files changed, 26 insertions(+), 28 deletions(-) diff --git a/app/src/config/bazaar.ts b/app/src/config/bazaar.ts index cdfeeec44..7c5874d29 100644 --- a/app/src/config/bazaar.ts +++ b/app/src/config/bazaar.ts @@ -637,7 +637,7 @@ export const bazaar = { } else if (type === "plugin-enable") { const itemElement = hasClosestByClassName(target, "b3-card"); if (itemElement) { - const enabled = (target as HTMLInputElement).checked + const enabled = (target as HTMLInputElement).checked; fetchPost("/api/petal/setPetalEnabled", { packageName: dataObj.name, enabled, diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 03fe5ab52..b72c3dde6 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -493,7 +493,7 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB } /// #if !MOBILE if (protyle.model) { - const allModels = getAllModels() + const allModels = getAllModels(); allModels.outline.forEach(item => { if (item.blockId === protyle.block.rootID) { item.setCurrent(protyle.wysiwyg.element.querySelector(`[data-node-id="${focusId || id}"]`)); diff --git a/app/src/plugin/uninstall.ts b/app/src/plugin/uninstall.ts index 66095ae67..365d2d813 100644 --- a/app/src/plugin/uninstall.ts +++ b/app/src/plugin/uninstall.ts @@ -7,27 +7,27 @@ export const uninstall = (app: App, name: string) => { app.plugins.find((plugin: Plugin, index) => { if (plugin.name === name) { // rm tab - const modelsKeys = Object.keys(plugin.models) + const modelsKeys = Object.keys(plugin.models); getAllModels().custom.forEach(custom => { if (modelsKeys.includes(custom.type)) { - custom.parent.parent.removeTab(custom.parent.id) + custom.parent.parent.removeTab(custom.parent.id); } - }) + }); // rm topbar plugin.topBarIcons.forEach(item => { item.remove(); - }) + }); // rm dock - const docksKeys = Object.keys(plugin.docks) + const docksKeys = Object.keys(plugin.docks); docksKeys.forEach(key => { if (Object.keys(window.siyuan.layout.leftDock.data).includes(key)) { - window.siyuan.layout.leftDock.remove(key) + window.siyuan.layout.leftDock.remove(key); } else if (Object.keys(window.siyuan.layout.rightDock.data).includes(key)) { - window.siyuan.layout.rightDock.remove(key) + window.siyuan.layout.rightDock.remove(key); } else if (Object.keys(window.siyuan.layout.bottomDock.data).includes(key)) { - window.siyuan.layout.bottomDock.remove(key) + window.siyuan.layout.bottomDock.remove(key); } - }) + }); exportLayout({ reload: false, onlyData: false, @@ -39,10 +39,10 @@ export const uninstall = (app: App, name: string) => { item.remove(); return true; } - }) + }); // rm plugin - app.plugins.splice(index, 1) - return true + app.plugins.splice(index, 1); + return true; } - }) -} + }); +}; diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index 5d5731b5b..1ef178d9a 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -21,7 +21,6 @@ import {openFileById} from "../../editor/util"; import {getCurrentWindow, systemPreferences} from "@electron/remote"; /// #endif import {onGet} from "../util/onGet"; -import {saveScroll} from "../scroll/saveScroll"; import {hideElements} from "../ui/hideElements"; import {confirmDialog} from "../../dialog/confirmDialog"; import {reloadProtyle} from "../util/reload"; diff --git a/app/src/protyle/scroll/saveScroll.ts b/app/src/protyle/scroll/saveScroll.ts index 49c3ceef7..e1cf6116b 100644 --- a/app/src/protyle/scroll/saveScroll.ts +++ b/app/src/protyle/scroll/saveScroll.ts @@ -1,5 +1,5 @@ import {hasClosestBlock} from "../util/hasClosest"; -import {focusByOffset, getSelectionOffset} from "../util/selection"; +import {getSelectionOffset} from "../util/selection"; import {fetchPost} from "../../util/fetch"; import {onGet} from "../util/onGet"; import {Constants} from "../../constants"; @@ -50,12 +50,12 @@ export const getDocByScroll = (options: { cb?: () => void focus?: boolean }) => { - let actions: string[] = [] + let actions: string[] = []; if (options.mergedOptions) { - actions = options.mergedOptions.action + actions = options.mergedOptions.action; } else { if (options.focus) { - actions = [Constants.CB_GET_UNUNDO, Constants.CB_GET_FOCUS] + actions = [Constants.CB_GET_UNUNDO, Constants.CB_GET_FOCUS]; } else { actions = [Constants.CB_GET_UNUNDO]; } @@ -70,7 +70,7 @@ export const getDocByScroll = (options: { }, response => { onGet(response, options.protyle, actions, options.scrollAttr); if (options.cb) { - options.cb() + options.cb(); } }); } @@ -81,7 +81,7 @@ export const getDocByScroll = (options: { }, response => { onGet(response, options.protyle, actions, options.scrollAttr); if (options.cb) { - options.cb() + options.cb(); } }); }; diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index 01de5d2e7..98f412832 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -360,4 +360,4 @@ const focusElement = (protyle: IProtyle, options: { } /// #endif } -} +}; diff --git a/app/src/sync/syncGuide.ts b/app/src/sync/syncGuide.ts index d51459ffc..1064b90cf 100644 --- a/app/src/sync/syncGuide.ts +++ b/app/src/sync/syncGuide.ts @@ -306,7 +306,7 @@ export const setKey = (isSync:boolean, cb?:() => void) => { dialog.element.querySelector(".b3-button--cancel").addEventListener("click", () => { dialog.destroy(); }); - const genBtnElement = dialog.element.querySelector("#initKeyByPW") + const genBtnElement = dialog.element.querySelector("#initKeyByPW"); dialog.element.querySelector(".b3-switch").addEventListener("change", function () { if (this.checked) { genBtnElement.removeAttribute("disabled"); @@ -331,7 +331,7 @@ export const setKey = (isSync:boolean, cb?:() => void) => { fetchPost("/api/repo/initRepoKeyFromPassphrase", {pass: inputElements[0].value}, (response) => { window.siyuan.config.repo.key = response.data.key; if (cb) { - cb() + cb(); } if (isSync) { setSync(response.data.key, dialog); diff --git a/app/src/util/backForward.ts b/app/src/util/backForward.ts index 87c083a36..4bae18ea2 100644 --- a/app/src/util/backForward.ts +++ b/app/src/util/backForward.ts @@ -2,13 +2,12 @@ import {hasClosestBlock, hasClosestByAttribute} from "../protyle/util/hasClosest import {getContenteditableElement} from "../protyle/wysiwyg/getBlock"; import {focusByOffset, focusByRange, getSelectionOffset} from "../protyle/util/selection"; import {hideElements} from "../protyle/ui/hideElements"; -import {fetchPost, fetchSyncPost} from "./fetch"; +import {fetchSyncPost} from "./fetch"; import {Constants} from "../constants"; import {Wnd} from "../layout/Wnd"; import {getInstanceById, getWndByLayout} from "../layout/util"; import {Tab} from "../layout/Tab"; import {Editor} from "../editor"; -import {onGet} from "../protyle/util/onGet"; import {scrollCenter} from "./highlightById"; import {zoomOut} from "../menus/protyle"; import {showMessage} from "../dialog/message";