From 358047dea0c68b6c235d74a4dc372cc03553a9dc Mon Sep 17 00:00:00 2001 From: Vanessa Date: Tue, 21 May 2024 00:24:54 +0800 Subject: [PATCH] :rotating_light: --- app/electron/main.js | 7 +------ app/src/boot/globalEvent/keydown.ts | 7 ++----- app/src/mobile/dock/MobileTags.ts | 1 - app/src/protyle/render/av/cell.ts | 8 ++++---- app/src/protyle/render/av/select.ts | 6 +++--- app/src/util/functions.ts | 2 +- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index c724ec7b9..29b66abe9 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -236,17 +236,12 @@ const isOpenAsHidden = function () { }; const initMainWindow = () => { - let windowStateInitialized = true; // 恢复主窗体状态 let oldWindowState = {}; try { oldWindowState = JSON.parse(fs.readFileSync(windowStatePath, "utf8")); - if (!oldWindowState.x) { - windowStateInitialized = false; - } } catch (e) { fs.writeFileSync(windowStatePath, "{}"); - windowStateInitialized = false; } let defaultWidth; let defaultHeight; @@ -270,7 +265,7 @@ const initMainWindow = () => { writeLog("windowStat [x=" + windowState.x + ", y=" + windowState.y + ", width=" + windowState.width + ", height=" + windowState.height + "], default [width=" + defaultWidth + ", height=" + defaultHeight + "], workArea [width=" + workArea.width + ", height=" + workArea.height + "]"); - let resetToCenter = false + let resetToCenter = false; let x = windowState.x; let y = windowState.y; if (workArea) { diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index 6479600b6..d8189b5c7 100644 --- a/app/src/boot/globalEvent/keydown.ts +++ b/app/src/boot/globalEvent/keydown.ts @@ -7,7 +7,6 @@ import { writeText } from "../../protyle/util/compatibility"; import {matchAuxiliaryHotKey, matchHotKey} from "../../protyle/util/hotKey"; -import {openSearch} from "../../search/spread"; import { hasClosestBlock, hasClosestByAttribute, @@ -18,7 +17,7 @@ import {newFile} from "../../util/newFile"; import {Constants} from "../../constants"; import {openSetting} from "../../config"; import {getInstanceById} from "../../layout/util"; -import {copyTab, getActiveTab, getDockByType, resizeTabs, switchTabByIndex} from "../../layout/tabUtil"; +import {getActiveTab, getDockByType, switchTabByIndex} from "../../layout/tabUtil"; import {Tab} from "../../layout/Tab"; import {Editor} from "../../editor"; import {setEditMode} from "../../protyle/util/setEditMode"; @@ -29,10 +28,9 @@ import {hideElements} from "../../protyle/ui/hideElements"; import {fetchPost} from "../../util/fetch"; import {goBack, goForward} from "../../util/backForward"; import {onGet} from "../../protyle/util/onGet"; -import {getDisplayName, getNotebookName, getTopPaths, movePathTo, moveToPath} from "../../util/pathName"; +import {getDisplayName, getNotebookName} from "../../util/pathName"; import {openFileById} from "../../editor/util"; import {getAllDocks, getAllModels, getAllTabs} from "../../layout/getAll"; -import {openGlobalSearch} from "../../search/util"; import {focusBlock, focusByOffset, focusByRange, getSelectionOffset} from "../../protyle/util/selection"; import {initFileMenu, initNavigationMenu} from "../../menus/navigation"; import {bindMenuKeydown} from "../../menus/Menu"; @@ -65,7 +63,6 @@ import {transaction} from "../../protyle/wysiwyg/transaction"; import {quickMakeCard} from "../../card/makeCard"; import {getContentByInlineHTML} from "../../protyle/wysiwyg/keydown"; import {searchKeydown} from "./searchKeydown"; -import {openNewWindow} from "../../window/openNewWindow"; import {historyKeydown} from "../../history/keydown"; import {zoomOut} from "../../menus/protyle"; import {getPlainText} from "../../protyle/util/paste"; diff --git a/app/src/mobile/dock/MobileTags.ts b/app/src/mobile/dock/MobileTags.ts index 42fc0e581..c54aad242 100644 --- a/app/src/mobile/dock/MobileTags.ts +++ b/app/src/mobile/dock/MobileTags.ts @@ -3,7 +3,6 @@ import {fetchPost} from "../../util/fetch"; import {hasClosestByClassName} from "../../protyle/util/hasClosest"; import {MenuItem} from "../../menus/Menu"; import {popSearch} from "../menu/search"; -import {Constants} from "../../constants"; import {App} from "../../index"; import {openTagMenu} from "../../menus/tag"; diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index 2c316dfdd..75725d6a0 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -574,12 +574,12 @@ export const updateCellsValue = (protyle: IProtyle, nodeElement: HTMLElement, va let link = protyle.lute.GetLinkDest(value); let name = ""; if (html) { - const tempElement = document.createElement("template") - tempElement.innerHTML = html - const aElement = tempElement.content.querySelector('[data-type~="a"]') + const tempElement = document.createElement("template"); + tempElement.innerHTML = html; + const aElement = tempElement.content.querySelector('[data-type~="a"]'); if (aElement) { link = aElement.getAttribute("data-href"); - name = aElement.textContent + name = aElement.textContent; } } if (!link && !name) { diff --git a/app/src/protyle/render/av/select.ts b/app/src/protyle/render/av/select.ts index 5ac5ce6d9..d872e7c33 100644 --- a/app/src/protyle/render/av/select.ts +++ b/app/src/protyle/render/av/select.ts @@ -583,7 +583,7 @@ export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID: } }); if (!needAdd) { - const newColor = ((column.options?.length || 0) % 13 + 1).toString() + const newColor = ((column.options?.length || 0) % 13 + 1).toString(); column.options.push({ name: item.content, color: newColor @@ -594,7 +594,7 @@ export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID: id: column.id, avID, data: column.options - }) + }); undoOperations.push({ action: "removeAttrViewColOption", id: column.id, @@ -607,4 +607,4 @@ export const mergeAddOption = (column: IAVColumn, cellValue: IAVCellValue, avID: doOperations, undoOperations }; -} +}; diff --git a/app/src/util/functions.ts b/app/src/util/functions.ts index 7481193ab..555a8418b 100644 --- a/app/src/util/functions.ts +++ b/app/src/util/functions.ts @@ -99,4 +99,4 @@ export const duplicateNameAddOne = (name:string) => { name = `${name} (1)`; } return name; -} +};