diff --git a/app/src/protyle/export/index.ts b/app/src/protyle/export/index.ts index 2c8053e4b..8b524963d 100644 --- a/app/src/protyle/export/index.ts +++ b/app/src/protyle/export/index.ts @@ -381,7 +381,7 @@ const renderPDF = (id: string) => { webSecurity: false, }, }); - window.siyuan.printWin.webContents.userAgent = `SiYuan/${app.getVersion()} https://b3log.org/siyuan Electron` + window.siyuan.printWin.webContents.userAgent = `SiYuan/${app.getVersion()} https://b3log.org/siyuan Electron`; fetchPost("/api/export/exportTempContent", {content: html}, (response) => { window.siyuan.printWin.loadURL(response.data.url); }); diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.ts index 92d667f3f..ccd953d17 100644 --- a/app/src/protyle/gutter/index.ts +++ b/app/src/protyle/gutter/index.ts @@ -1176,22 +1176,22 @@ export class Gutter { window.siyuan.menus.menu.append(new MenuItem({type: "separator"}).element); const headingSubMenu = []; if (subType !== "h1") { - headingSubMenu.push(this.genHeadingTransform(protyle, id, 1)) + headingSubMenu.push(this.genHeadingTransform(protyle, id, 1)); } if (subType !== "h2") { - headingSubMenu.push(this.genHeadingTransform(protyle, id, 2)) + headingSubMenu.push(this.genHeadingTransform(protyle, id, 2)); } if (subType !== "h3") { - headingSubMenu.push(this.genHeadingTransform(protyle, id, 3)) + headingSubMenu.push(this.genHeadingTransform(protyle, id, 3)); } if (subType !== "h4") { - headingSubMenu.push(this.genHeadingTransform(protyle, id, 4)) + headingSubMenu.push(this.genHeadingTransform(protyle, id, 4)); } if (subType !== "h5") { - headingSubMenu.push(this.genHeadingTransform(protyle, id, 5)) + headingSubMenu.push(this.genHeadingTransform(protyle, id, 5)); } if (subType !== "h6") { - headingSubMenu.push(this.genHeadingTransform(protyle, id, 6)) + headingSubMenu.push(this.genHeadingTransform(protyle, id, 6)); } window.siyuan.menus.menu.append(new MenuItem({ type: "submenu", @@ -1205,7 +1205,7 @@ export class Gutter { click() { fetchPost("/api/block/getHeadingChildrenDOM", {id}, (response) => { writeText(response.data + Constants.ZWSP); - }) + }); } }).element); } @@ -1338,10 +1338,10 @@ export class Gutter { mathRender(itemElement); }); }); - transaction(protyle, response.data.doOperations, response.data.undoOperations) + transaction(protyle, response.data.doOperations, response.data.undoOperations); }); } - } + }; } private genClick(nodeElements: Element[], protyle: IProtyle, cb: (e: HTMLElement) => void) { diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index e3325765f..3bf51624d 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -16,7 +16,6 @@ import {Tab} from "../../layout/Tab"; import {getAllModels} from "../../layout/getAll"; import {updatePanelByEditor} from "../../editor/util"; /// #endif -import * as path from "path"; import {Editor} from "../../editor"; import {blockRender} from "../markdown/blockRender"; import {processRender} from "./processCode"; diff --git a/app/src/protyle/util/paste.ts b/app/src/protyle/util/paste.ts index b37b3eb54..673e279ce 100644 --- a/app/src/protyle/util/paste.ts +++ b/app/src/protyle/util/paste.ts @@ -4,7 +4,6 @@ import {processPasteCode, processRender} from "./processCode"; import {writeText} from "./compatibility"; /// #if !BROWSER import {clipboard} from "electron"; -import * as path from "path"; /// #endif import {hasClosestBlock} from "./hasClosest"; import {focusByWbr, getEditorRange} from "./selection"; @@ -111,7 +110,7 @@ export const paste = async (protyle: IProtyle, event: (ClipboardEvent | DragEven } // 复制标题及其下方块使用 writeText,需将 textPLain 转换为 textHTML if (textPlain.endsWith(Constants.ZWSP) && !textHTML) { - textHTML = textPlain + textHTML = textPlain; } /// #if !MOBILE if (!textHTML && !textPlain && ("clipboardData" in event)) { diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.ts index 6a3660c45..96ab26990 100644 --- a/app/src/protyle/util/selection.ts +++ b/app/src/protyle/util/selection.ts @@ -525,7 +525,7 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStar cursorElement = cellElements[cellElements.length - 1]; } } - let range + let range; if (toStart) { // 需要定位到第一个 child https://github.com/siyuan-note/siyuan/issues/5930 range = setFirstNodeRange(cursorElement, getEditorRange(cursorElement)); diff --git a/app/src/protyle/util/table.ts b/app/src/protyle/util/table.ts index 13a738775..addd134ba 100644 --- a/app/src/protyle/util/table.ts +++ b/app/src/protyle/util/table.ts @@ -69,7 +69,7 @@ export const setTableAlign = (protyle: IProtyle, cellElements: HTMLElement[], no }; export const insertRow = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => { - const wbrElement = document.createElement("wbr") + const wbrElement = document.createElement("wbr"); range.insertNode(wbrElement); const html = nodeElement.outerHTML; wbrElement.remove(); @@ -98,7 +98,7 @@ export const insertRow = (protyle: IProtyle, range: Range, cellElement: HTMLElem }; export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTMLElement, nodeElement: Element) => { - const wbrElement = document.createElement("wbr") + const wbrElement = document.createElement("wbr"); range.insertNode(wbrElement); const html = nodeElement.outerHTML; wbrElement.remove(); @@ -131,10 +131,10 @@ export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTM previousTrElement = previousTrElement.previousElementSibling; } } - let newRowElememt: HTMLTableRowElement + let newRowElememt: HTMLTableRowElement; if (cellElement.parentElement.parentElement.tagName === "THEAD" && !cellElement.parentElement.previousElementSibling) { cellElement.parentElement.parentElement.insertAdjacentHTML("beforebegin", `${rowHTML}`); - newRowElememt = nodeElement.querySelector("thead tr") + newRowElememt = nodeElement.querySelector("thead tr"); cellElement.parentElement.parentElement.nextElementSibling.insertAdjacentHTML("afterbegin", cellElement.parentElement.parentElement.innerHTML); cellElement.parentElement.parentElement.remove(); } else { @@ -147,15 +147,15 @@ export const insertRowAbove = (protyle: IProtyle, range: Range, cellElement: HTM }; export const insertColumn = (protyle: IProtyle, nodeElement: Element, cellElement: HTMLElement, type: InsertPosition, range: Range) => { - const wbrElement = document.createElement("wbr") + const wbrElement = document.createElement("wbr"); range.insertNode(wbrElement); const html = nodeElement.outerHTML; wbrElement.remove(); const index = getColIndex(cellElement); const tableElement = nodeElement.querySelector("table"); for (let i = 0; i < tableElement.rows.length; i++) { - const colCellElement = tableElement.rows[i].cells[index] - const newCellElement = document.createElement(colCellElement.tagName) + const colCellElement = tableElement.rows[i].cells[index]; + const newCellElement = document.createElement(colCellElement.tagName); if (colCellElement.isSameNode(cellElement)) { newCellElement.innerHTML = " "; } else { diff --git a/app/src/protyle/wysiwyg/enter.ts b/app/src/protyle/wysiwyg/enter.ts index e64348690..82fa2c3e0 100644 --- a/app/src/protyle/wysiwyg/enter.ts +++ b/app/src/protyle/wysiwyg/enter.ts @@ -9,7 +9,6 @@ import { } from "./getBlock"; import {transaction, updateTransaction} from "./transaction"; import {breakList, genListItemElement, listOutdent, updateListOrder} from "./list"; -import {hasClosestByMatchTag} from "../util/hasClosest"; import {highlightRender} from "../markdown/highlightRender"; import {Constants} from "../../constants"; import {scrollCenter} from "../../util/highlightById"; diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.ts index 758744728..a1437f3e8 100644 --- a/app/src/util/pathName.ts +++ b/app/src/util/pathName.ts @@ -38,18 +38,18 @@ export const isLocalPath = (link: string) => { return false; } - link = link.trim() + link = link.trim(); if (1 > link.length) { return false; } - link = link.toLowerCase() + link = link.toLowerCase(); if (link.startsWith("assets/") || link.startsWith("file://") || link.startsWith("\\\\") /* Windows 网络共享路径 */) { - return true + return true; } - const colonIdx = link.indexOf(":") - return 1 === colonIdx // 冒号前面只有一个字符认为是 Windows 盘符而不是网络协议 + const colonIdx = link.indexOf(":"); + return 1 === colonIdx; // 冒号前面只有一个字符认为是 Windows 盘符而不是网络协议 }; export const pathPosix = () => {