From 3925d5d1c4537cacf69b003d6d30b3d3fc96b5ec Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 17 Sep 2023 22:27:55 +0800 Subject: [PATCH] :rotating_light: --- app/src/block/popover.ts | 2 +- app/src/boot/globalEvent/keydown.ts | 10 +++++----- app/src/dialog/index.ts | 2 +- app/src/dialog/tooltip.ts | 3 +-- app/src/layout/util.ts | 2 +- app/src/protyle/breadcrumb/index.ts | 3 +-- app/src/protyle/undo/index.ts | 2 +- app/src/protyle/util/selection.ts | 10 +++++----- app/src/protyle/wysiwyg/index.ts | 2 +- app/src/search/util.ts | 8 ++++---- app/src/window/closeWin.ts | 2 +- 11 files changed, 22 insertions(+), 24 deletions(-) diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index 9c55c3ca7..bff6c9b75 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -45,7 +45,7 @@ export const initBlockPopover = (app: App) => { return; } } else if (!aElement) { - const tipElement = hasClosestByAttribute(event.target, "id", "tooltip", true) + const tipElement = hasClosestByAttribute(event.target, "id", "tooltip", true); if (!tipElement || ( tipElement && (tipElement.clientHeight >= tipElement.scrollHeight && tipElement.clientWidth >= tipElement.scrollWidth) )) { diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index 24105e455..45afb2b53 100644 --- a/app/src/boot/globalEvent/keydown.ts +++ b/app/src/boot/globalEvent/keydown.ts @@ -165,7 +165,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { protyle = item.editor.protyle; return true; } - }) + }); } if (!protyle && activeTabElement) { const tab = getInstanceById(activeTabElement.getAttribute("data-id")) as Tab; @@ -187,11 +187,11 @@ const editKeydown = (app: App, event: KeyboardEvent) => { protyle = editorItem.protyle; return true; } - }) + }); if (protyle) { - return true + return true; } - }) + }); } if (!protyle) { models.backlink.find(item => { @@ -209,7 +209,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => { } return true; } - }) + }); } if (!protyle) { models.editor.find(item => { diff --git a/app/src/dialog/index.ts b/app/src/dialog/index.ts index 6135fee52..3807ea9d2 100644 --- a/app/src/dialog/index.ts +++ b/app/src/dialog/index.ts @@ -11,7 +11,7 @@ export class Dialog { public element: HTMLElement; private id: string; private disableClose: boolean; - public editor: Protyle + public editor: Protyle; constructor(options: { title?: string, diff --git a/app/src/dialog/tooltip.ts b/app/src/dialog/tooltip.ts index 203e015bd..ef6ccf27d 100644 --- a/app/src/dialog/tooltip.ts +++ b/app/src/dialog/tooltip.ts @@ -1,4 +1,3 @@ -import {setPosition} from "../util/setPosition"; import {isMobile} from "../util/functions"; export const showTooltip = (message: string, target: Element, error = false) => { @@ -29,7 +28,7 @@ export const showTooltip = (message: string, target: Element, error = false) => } let left = targetRect.left; let top = targetRect.bottom; - const position = target.getAttribute("data-position") + const position = target.getAttribute("data-position"); const parentRect = target.parentElement.getBoundingClientRect(); if (position === "right") { // block icon diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts index 77dd610fa..621ae32f9 100644 --- a/app/src/layout/util.ts +++ b/app/src/layout/util.ts @@ -667,7 +667,7 @@ export const resizeTabs = () => { }); models.search.forEach(item => { item.edit.resize(); - }) + }); models.custom.forEach(item => { if (item.resize) { item.resize(); diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index c2064557b..1cae6721e 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -3,7 +3,7 @@ import {fetchPost} from "../../util/fetch"; import {Constants} from "../../constants"; import {MenuItem} from "../../menus/Menu"; import {fullscreen, netImg2LocalAssets} from "./action"; -import {exportMd, openFileAttr} from "../../menus/commonMenuItem"; +import {openFileAttr} from "../../menus/commonMenuItem"; import {setEditMode} from "../util/setEditMode"; import {RecordMedia} from "../util/RecordMedia"; import {hideMessage, showMessage} from "../../dialog/message"; @@ -24,7 +24,6 @@ import {onGet} from "../util/onGet"; import {hideElements} from "../ui/hideElements"; import {confirmDialog} from "../../dialog/confirmDialog"; import {reloadProtyle} from "../util/reload"; -import {deleteFile} from "../../editor/deleteFile"; import {Menu} from "../../plugin/Menu"; import {getNoContainerElement} from "../wysiwyg/getBlock"; import {openTitleMenu} from "../header/openTitleMenu"; diff --git a/app/src/protyle/undo/index.ts b/app/src/protyle/undo/index.ts index 7208a3b95..e3c39689b 100644 --- a/app/src/protyle/undo/index.ts +++ b/app/src/protyle/undo/index.ts @@ -70,7 +70,7 @@ export class Undo { public replace(doOperations: IOperation[]) { // undo 引发 replace 导致 stack 错误 https://github.com/siyuan-note/siyuan/issues/9178 if (this.hasUndo && this.redoStack.length > 0) { - this.undoStack.push(this.redoStack.pop()) + this.undoStack.push(this.redoStack.pop()); this.redoStack = []; this.hasUndo = false; } diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts index 39e08f6d6..b162a4d10 100644 --- a/app/src/protyle/util/selection.ts +++ b/app/src/protyle/util/selection.ts @@ -560,18 +560,18 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar range = setFirstNodeRange(cursorElement, getEditorRange(cursorElement)); range.collapse(true); } else { - let focusHljs = false + let focusHljs = false; // 定位到末尾 https://github.com/siyuan-note/siyuan/issues/5982 if (cursorElement.classList.contains("hljs")) { // 代码块末尾定位需在 /n 之前 https://github.com/siyuan-note/siyuan/issues/9141,https://github.com/siyuan-note/siyuan/issues/9189 - let lastNode = cursorElement.lastChild + let lastNode = cursorElement.lastChild; if (lastNode.textContent === "" && lastNode.nodeType === 3) { - lastNode = hasPreviousSibling(cursorElement.lastChild) as HTMLElement + lastNode = hasPreviousSibling(cursorElement.lastChild) as HTMLElement; } if (lastNode && lastNode.textContent.endsWith("\n")) { range = getEditorRange(cursorElement); - range.setStart(lastNode, lastNode.textContent.length - 1) - focusHljs = true + range.setStart(lastNode, lastNode.textContent.length - 1); + focusHljs = true; } } if (!focusHljs) { diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index bd2815425..a12366dd4 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -1488,7 +1488,7 @@ export class WYSIWYG { } }); - let timeout: number + let timeout: number; this.element.addEventListener("input", (event: InputEvent) => { const target = event.target as HTMLElement; if (target.tagName === "VIDEO" || target.tagName === "AUDIO" || event.inputType === "historyRedo") { diff --git a/app/src/search/util.ts b/app/src/search/util.ts index b0b3cbfd8..8d3287c62 100644 --- a/app/src/search/util.ts +++ b/app/src/search/util.ts @@ -736,11 +736,11 @@ export const genSearch = (app: App, config: ISearchOption, element: Element, clo newFileByName(app, searchInputElement.value); } else if (type === "search-item") { const isAsset = target.dataset.id; - let isClick = event.detail === 1 - let isDblClick = event.detail === 2 + let isClick = event.detail === 1; + let isDblClick = event.detail === 2; /// #if BROWSER - const newDate = new Date().getTime() - isClick = newDate - lastClickTime > Constants.TIMEOUT_DBLCLICK + const newDate = new Date().getTime(); + isClick = newDate - lastClickTime > Constants.TIMEOUT_DBLCLICK; isDblClick = !isClick; lastClickTime = newDate; /// #endif diff --git a/app/src/window/closeWin.ts b/app/src/window/closeWin.ts index 09e2fe799..19b4ee00e 100644 --- a/app/src/window/closeWin.ts +++ b/app/src/window/closeWin.ts @@ -6,4 +6,4 @@ export const closeWindow = async (app: App) => { await app.plugins[i].onunload(); } getCurrentWindow().destroy(); -} +};