From eb18429d6e4323715f14ffdfccbe6ceffd698d5b Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sun, 14 Jan 2024 16:38:45 +0800 Subject: [PATCH] :rotating_light: --- app/src/block/popover.ts | 10 +++++----- app/src/boot/onGetConfig.ts | 1 - app/src/config/util/about.ts | 6 +++--- app/src/protyle/breadcrumb/action.ts | 2 +- app/src/protyle/breadcrumb/index.ts | 2 +- app/src/protyle/render/av/cell.ts | 6 +++--- app/src/protyle/util/onGet.ts | 2 +- app/src/protyle/wysiwyg/index.ts | 10 +++++----- app/src/protyle/wysiwyg/keydown.ts | 2 +- 9 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index 91673d979..6fc5fd46f 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -27,12 +27,12 @@ export const initBlockPopover = (app: App) => { if (aElement.classList.contains("av__cell--header")) { const textElement = aElement.querySelector(".av__celltext"); if (textElement.scrollWidth > textElement.clientWidth + 2) { - tip = getCellText(aElement) + tip = getCellText(aElement); } } else if (aElement.dataset.wrap !== "true" && event.target.dataset.type !== "block-more" && !hasClosestByClassName(event.target, "block__icon")) { aElement.style.overflow = "auto"; if (aElement.scrollWidth > aElement.clientWidth + 2) { - tip = getCellText(aElement) + tip = getCellText(aElement); } aElement.style.overflow = ""; } @@ -115,7 +115,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => { return false; } - const avPanelElement = hasClosestByClassName(target, "av__panel") + const avPanelElement = hasClosestByClassName(target, "av__panel"); if (avPanelElement) { // 浮窗上点击 av 操作,浮窗不能消失 const blockPanel = window.siyuan.blockPanels.find((item) => { @@ -128,7 +128,7 @@ const hidePopover = (event: MouseEvent & { path: HTMLElement[] }) => { } } else { // 浮窗上点击菜单,浮窗不能消失 https://ld246.com/article/1632668091023 - const menuElement = hasClosestByClassName(target, "b3-menu") + const menuElement = hasClosestByClassName(target, "b3-menu"); if (menuElement) { const blockPanel = window.siyuan.blockPanels.find((item) => { if (item.element.style.zIndex < menuElement.style.zIndex) { @@ -213,7 +213,7 @@ const getTarget = (event: MouseEvent & { target: HTMLElement }, aElement: false if (aElement.getAttribute("data-href")?.startsWith("siyuan://blocks") && aElement.getAttribute("prevent-popover") !== "true") { popoverTargetElement = aElement; } else if (aElement.classList.contains("av__cell")) { - const textElement = aElement.querySelector(".av__celltext--url") as HTMLElement + const textElement = aElement.querySelector(".av__celltext--url") as HTMLElement; if (textElement && textElement.dataset.type === "url" && textElement.dataset.href?.startsWith("siyuan://blocks")) { popoverTargetElement = textElement; } diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.ts index 36be70ac0..734da944e 100644 --- a/app/src/boot/onGetConfig.ts +++ b/app/src/boot/onGetConfig.ts @@ -14,7 +14,6 @@ import {fetchPost, fetchSyncPost} from "../util/fetch"; import {addGA, initAssets, setInlineStyle} from "../util/assets"; import {renderSnippet} from "../config/util/snippets"; import {openFile, openFileById} from "../editor/util"; -import {focusByRange} from "../protyle/util/selection"; import {exitSiYuan} from "../dialog/processSystem"; import {isWindow} from "../util/functions"; import {initStatus} from "../layout/status"; diff --git a/app/src/config/util/about.ts b/app/src/config/util/about.ts index 09f22645d..d8b54ea6d 100644 --- a/app/src/config/util/about.ts +++ b/app/src/config/util/about.ts @@ -37,6 +37,6 @@ export const getCloudURL = (key: string) => { }; export const getIndexURL = (key: string) => { - const lang = 'zh_CN' === window.siyuan.config.lang ? "" : "/en"; - return 'https://b3log.org/siyuan' + `${lang}/${key}`; -} + const lang = "zh_CN" === window.siyuan.config.lang ? "" : "/en"; + return "https://b3log.org/siyuan" + `${lang}/${key}`; +}; diff --git a/app/src/protyle/breadcrumb/action.ts b/app/src/protyle/breadcrumb/action.ts index 7e77e06fe..68d8e6ef4 100644 --- a/app/src/protyle/breadcrumb/action.ts +++ b/app/src/protyle/breadcrumb/action.ts @@ -101,4 +101,4 @@ export const updateReadonly = (target: Element, protyle: IProtyle) => { }); } } -} +}; diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts index 78ea8923a..0a1ce8693 100644 --- a/app/src/protyle/breadcrumb/index.ts +++ b/app/src/protyle/breadcrumb/index.ts @@ -20,7 +20,7 @@ import {saveLayout, setPanelFocus} from "../../layout/util"; /// #if !BROWSER import {ipcRenderer} from "electron"; /// #endif -import {disabledProtyle, enableProtyle, onGet} from "../util/onGet"; +import {onGet} from "../util/onGet"; import {hideElements} from "../ui/hideElements"; import {confirmDialog} from "../../dialog/confirmDialog"; import {reloadProtyle} from "../util/reload"; diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index d62206189..c39ca85a2 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -26,7 +26,7 @@ export const getCellText = (cellElement: HTMLElement | false) => { } else if (item.getAttribute("data-type") !== "block-more") { cellText += item.textContent + ", "; } - }) + }); cellText = cellText.substring(0, cellText.length - 2); } else { cellText = cellElement.textContent; @@ -643,7 +643,7 @@ export const updateHeaderCell = (cellElement: HTMLElement, headerValue: { textElement.insertAdjacentHTML("afterend", ''); } } else { - cellElement.querySelector(".av__cellheadericon--pin")?.remove() + cellElement.querySelector(".av__cellheadericon--pin")?.remove(); } } }; @@ -664,4 +664,4 @@ export const getPositionByCellElement = (cellElement: HTMLElement) => { celIndex++; } return {rowIndex, celIndex}; -} +}; diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.ts index 5bb2551f0..082ffd91b 100644 --- a/app/src/protyle/util/onGet.ts +++ b/app/src/protyle/util/onGet.ts @@ -124,7 +124,7 @@ const setHTML = (options: { } protyle.block.showAll = options.action.includes(Constants.CB_GET_ALL); const REMOVED_OVER_HEIGHT = protyle.contentElement.clientHeight * 8; - const isUpdate = protyle.wysiwyg.element.innerHTML !== "" + const isUpdate = protyle.wysiwyg.element.innerHTML !== ""; if (options.action.includes(Constants.CB_GET_APPEND)) { // 动态加载移除 if (!protyle.wysiwyg.element.querySelector(".protyle-wysiwyg--select") && !protyle.scroll.keepLazyLoad && protyle.contentElement.scrollHeight > REMOVED_OVER_HEIGHT) { diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts index 5a564bf12..8805fd083 100644 --- a/app/src/protyle/wysiwyg/index.ts +++ b/app/src/protyle/wysiwyg/index.ts @@ -447,10 +447,10 @@ export class WYSIWYG { } nodeElement.querySelectorAll(".av__cell--select").forEach(item => { item.classList.remove("av__cell--select"); - }) + }); nodeElement.querySelectorAll(".av__drag-fill").forEach(item => { item.remove(); - }) + }); avCellElement.classList.add("av__cell--select"); const originIndex = getPositionByCellElement(avCellElement); let moveCellElement: HTMLElement; @@ -465,7 +465,7 @@ export class WYSIWYG { const newIndex = getPositionByCellElement(moveCellElement); nodeElement.querySelectorAll(".av__cell--active").forEach((item: HTMLElement) => { item.classList.remove("av__cell--active"); - }) + }); nodeElement.querySelectorAll(".av__row").forEach((rowElement: HTMLElement, index: number) => { if (index >= Math.min(originIndex.rowIndex, newIndex.rowIndex) && index <= Math.max(originIndex.rowIndex, newIndex.rowIndex)) { rowElement.querySelectorAll(".av__cell").forEach((cellElement: HTMLElement, cellIndex: number) => { @@ -475,7 +475,7 @@ export class WYSIWYG { } }); } - }) + }); } }; @@ -487,7 +487,7 @@ export class WYSIWYG { documentSelf.onselect = null; if (lastCellElement) { focusBlock(nodeElement); - lastCellElement.insertAdjacentHTML("beforeend", `
`) + lastCellElement.insertAdjacentHTML("beforeend", `
`); this.preventClick = true; } return false; diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index 66992d6ff..b3ab2c815 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -37,7 +37,7 @@ import {fontEvent} from "../toolbar/Font"; import {listIndent, listOutdent} from "./list"; import {newFileContentBySelect, rename, replaceFileName} from "../../editor/rename"; import {insertEmptyBlock, jumpToParentNext} from "../../block/util"; -import {isLocalPath, pathPosix} from "../../util/pathName"; +import {isLocalPath} from "../../util/pathName"; /// #if !MOBILE import {openBy, openFileById} from "../../editor/util"; /// #endif