From b8eec1bd3419b309201de46248dc0348c3106d5b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Mon, 20 Nov 2023 12:28:20 +0800 Subject: [PATCH] :rotating_light: --- app/electron/main.js | 4 ++-- app/src/boot/globalEvent/event.ts | 2 +- app/src/boot/globalEvent/touch.ts | 4 ++-- app/src/menus/protyle.ts | 2 +- app/src/menus/tab.ts | 2 +- app/src/protyle/header/Background.ts | 2 +- app/src/protyle/render/av/cell.ts | 13 ++++++------- app/src/protyle/ui/initUI.ts | 1 - app/src/protyle/wysiwyg/enter.ts | 2 +- app/src/protyle/wysiwyg/keydown.ts | 2 +- 10 files changed, 16 insertions(+), 18 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index ec8b160c5..13a504b37 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -602,13 +602,13 @@ app.commandLine.appendSwitch("force_high_performance_gpu"); // Force using discr writeLog("app is packaged [" + app.isPackaged + "], command line args [" + process.argv.join(", ") + "]"); let argStart = 1; if (!app.isPackaged) { - argStart = 2 + argStart = 2; } for (let i = argStart; i < process.argv.length; i++) { let arg = process.argv[i]; if (arg.startsWith("--workspace=") || arg.startsWith("--port=") || arg.startsWith("siyuan://")) { // 跳过内置参数 - continue + continue; } app.commandLine.appendSwitch(arg); diff --git a/app/src/boot/globalEvent/event.ts b/app/src/boot/globalEvent/event.ts index f0cd6884e..93c77b246 100644 --- a/app/src/boot/globalEvent/event.ts +++ b/app/src/boot/globalEvent/event.ts @@ -78,7 +78,7 @@ export const initWindowEvent = (app: App) => { return; } // 触摸屏背景和嵌入块按钮显示 - const backgroundElement = hasClosestByClassName(target, "protyle-background") + const backgroundElement = hasClosestByClassName(target, "protyle-background"); if (backgroundElement) { if (!globalTouchStart(event)) { backgroundElement.classList.toggle("protyle-background--mobileshow"); diff --git a/app/src/boot/globalEvent/touch.ts b/app/src/boot/globalEvent/touch.ts index 0b2099ec8..836b69b37 100644 --- a/app/src/boot/globalEvent/touch.ts +++ b/app/src/boot/globalEvent/touch.ts @@ -15,7 +15,7 @@ import {hideTooltip} from "../../dialog/tooltip"; export const globalTouchStart = (event: TouchEvent) => { // 文档背景位置调整 const target = event.target as HTMLElement; - const backgroundElement = hasClosestByClassName(target, "protyle-background") + const backgroundElement = hasClosestByClassName(target, "protyle-background"); if (backgroundElement && target.tagName === "IMG" && backgroundElement.firstElementChild.querySelector(".protyle-icons").classList.contains("fn__none")) { const contentElement = hasClosestByClassName(target, "protyle-content", true); if (!contentElement) { @@ -45,7 +45,7 @@ export const globalTouchStart = (event: TouchEvent) => { return true; } return false; -} +}; export const globalTouchEnd = (event: TouchEvent, yDiff: number, time: number, app: App) => { const target = event.target as HTMLElement; diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index 3a968f9e8..04b1a0285 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -657,7 +657,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => { }).element); } else { // https://github.com/siyuan-note/siyuan/issues/9630 - const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN") + const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN"); if (inlineElement) { const inlineTypes = protyle.toolbar.getCurrentType(range); if (inlineTypes.includes("code") || inlineTypes.includes("kbd")) { diff --git a/app/src/menus/tab.ts b/app/src/menus/tab.ts index 639bafec7..77ee68184 100644 --- a/app/src/menus/tab.ts +++ b/app/src/menus/tab.ts @@ -238,4 +238,4 @@ const unsplitWnd = (target: Wnd | Layout, layout: Layout, onlyWnd: boolean) => { i--; } } -} +}; diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.ts index 50742831a..8b23c422c 100644 --- a/app/src/protyle/header/Background.ts +++ b/app/src/protyle/header/Background.ts @@ -1,5 +1,5 @@ import {hasClosestByClassName} from "../util/hasClosest"; -import {getRandom, isMobile, isTouchDevice} from "../../util/functions"; +import {getRandom, isMobile} from "../../util/functions"; import {hideElements} from "../ui/hideElements"; import {uploadFiles} from "../upload"; import {fetchPost} from "../../util/fetch"; diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index ff5ca7e8d..6c7908e17 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -1,7 +1,6 @@ import {transaction} from "../../wysiwyg/transaction"; import {hasClosestBlock, hasClosestByClassName} from "../../util/hasClosest"; import {openMenuPanel} from "./openMenuPanel"; -import {Menu} from "../../../plugin/Menu"; import {updateAttrViewCellAnimation} from "./action"; import {isNotCtrl} from "../../util/compatibility"; import {objEquals} from "../../../util/functions"; @@ -300,13 +299,13 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem inputValue.content = parseFloat(inputValue.content as string); inputValue.isNotEmpty = typeof inputValue.content === "number" && !isNaN(inputValue.content); } else if (type === "checkbox") { - const useElement = item.querySelector("use") - inputValue.checked = useElement.getAttribute("xlink:href") === "#iconUncheck" - oldValue.checked = !inputValue.checked - useElement.setAttribute("xlink:href", inputValue.checked ? "#iconCheck" : "#iconUncheck") + const useElement = item.querySelector("use"); + inputValue.checked = useElement.getAttribute("xlink:href") === "#iconUncheck"; + oldValue.checked = !inputValue.checked; + useElement.setAttribute("xlink:href", inputValue.checked ? "#iconCheck" : "#iconUncheck"); } else { - inputValue.content = (avMaskElement.querySelector(".b3-text-field") as HTMLInputElement).value - oldValue.content = type === "block" ? item.firstElementChild.textContent.trim() : item.textContent.trim() + inputValue.content = (avMaskElement.querySelector(".b3-text-field") as HTMLInputElement).value; + oldValue.content = type === "block" ? item.firstElementChild.textContent.trim() : item.textContent.trim(); } if (objEquals(inputValue, oldValue)) { return; diff --git a/app/src/protyle/ui/initUI.ts b/app/src/protyle/ui/initUI.ts index 8fc4a9d01..67d3668a8 100644 --- a/app/src/protyle/ui/initUI.ts +++ b/app/src/protyle/ui/initUI.ts @@ -2,7 +2,6 @@ import {setEditMode} from "../util/setEditMode"; import {scrollEvent} from "../scroll/event"; import {isMobile} from "../../util/functions"; import {Constants} from "../../constants"; -import {hasClosestByAttribute, hasClosestByClassName} from "../util/hasClosest"; import {isMac} from "../util/compatibility"; import {setInlineStyle} from "../../util/assets"; import {fetchPost} from "../../util/fetch"; diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts index f800227ca..530b49b70 100644 --- a/app/src/protyle/wysiwyg/enter.ts +++ b/app/src/protyle/wysiwyg/enter.ts @@ -353,7 +353,7 @@ export const enter = (blockElement: HTMLElement, range: Range, protyle: IProtyle removeEmptyNode(newElement); return true; } - const wbrElement = document.createElement("wbr") + const wbrElement = document.createElement("wbr"); range.insertNode(wbrElement); const html = blockElement.outerHTML; wbrElement.remove(); diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 22d27358d..fcbd09e44 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -861,7 +861,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { return; } // https://github.com/siyuan-note/siyuan/issues/9690 - const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN") + const inlineElement = hasClosestByMatchTag(range.startContainer, "SPAN"); if (position.start === 2 && inlineElement && getSelectionOffset(inlineElement, protyle.wysiwyg.element, range).start === 1 && inlineElement.textContent.startsWith(Constants.ZWSP)) {