diff --git a/.github/CONTRIBUTING_zh_CN.md b/.github/CONTRIBUTING_zh_CN.md index f33fba5a1..aba12db4b 100644 --- a/.github/CONTRIBUTING_zh_CN.md +++ b/.github/CONTRIBUTING_zh_CN.md @@ -14,7 +14,10 @@ 设置 Electron 镜像环境变量并安装 Electron: -* macOS/Linux: `ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@21.3.0 -D` +* macOS/Linux: + ``` + ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install electron@21.3.0 -D + ``` * Windows: * `SET ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/` * `pnpm install electron@21.3.0 -D` diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yaml index 719239048..1223b8de6 100644 --- a/app/pnpm-lock.yaml +++ b/app/pnpm-lock.yaml @@ -1906,10 +1906,10 @@ packages: resolution: {integrity: sha512-m0+M53+HYMzqKxwNQZT143K7WwXEGUy9LY31l8dJphXx2P/FQod615mVbxHyqbDCG4J5bHdWm21qZ0e2DVY6CQ==} engines: {node: '>=14.0.0'} dependencies: - 7zip-bin: 5.1.1 '@develar/schema-utils': 2.6.5 '@electron/universal': 1.2.1 '@malept/flatpak-bundler': 0.4.0 + 7zip-bin: 5.1.1 async-exit-hook: 2.0.1 bluebird-lst: 1.0.9 builder-util: 23.3.3 @@ -2193,9 +2193,9 @@ packages: /builder-util/23.3.3: resolution: {integrity: sha512-MJZlUiq2PY5hjYv9+XNaoYdsITqvLgRDoHSFg/4nzpInbNxNjLQOolL04Zsyp+hgfcbFvMC4h0KkR1CMPHLWbA==} dependencies: - 7zip-bin: 5.1.1 '@types/debug': 4.1.7 '@types/fs-extra': 9.0.13 + 7zip-bin: 5.1.1 app-builder-bin: 4.0.0 bluebird-lst: 1.0.9 builder-util-runtime: 9.0.3 diff --git a/app/src/config/account.ts b/app/src/config/account.ts index 72f21be14..028e11955 100644 --- a/app/src/config/account.ts +++ b/app/src/config/account.ts @@ -12,11 +12,11 @@ import {getEventName} from "../protyle/util/compatibility"; export const account = { element: undefined as Element, genHTML: () => { - let sponsor = 'https://ld246.com/sponsor' + let sponsor = "https://ld246.com/sponsor"; if ("zh_CN" !== window.siyuan.config.lang) { - sponsor = 'https://opencollective.com/b3log' + sponsor = "https://opencollective.com/b3log"; } - const payHTML = ` + const payHTML = " ${window.siyuan.languages.sponsor} diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts index ec60e229b..b2027966a 100644 --- a/app/src/menus/protyle.ts +++ b/app/src/menus/protyle.ts @@ -33,7 +33,6 @@ import {lineNumberRender} from "../protyle/markdown/highlightRender"; import * as dayjs from "dayjs"; import {blockRender} from "../protyle/markdown/blockRender"; import {renameAsset} from "../editor/rename"; -import {hasNextSibling, hasPreviousSibling} from "../protyle/wysiwyg/getBlock"; import {electronUndo} from "../protyle/undo"; import {pushBack} from "../mobile/util/MobileBackFoward"; import {exportAsset} from "./util"; @@ -636,7 +635,7 @@ export const imgMenu = (protyle: IProtyle, range: Range, assetElement: HTMLEleme label: window.siyuan.languages.alignLeft, accelerator: window.siyuan.config.keymap.editor.general.alignLeft.custom, click() { - alignImgLeft(protyle, nodeElement, [assetElement], id, html) + alignImgLeft(protyle, nodeElement, [assetElement], id, html); } }).element); const width = parseInt(assetElement.style.width || "0"); diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.ts index 3ea22ccc3..1bdb88225 100644 --- a/app/src/protyle/util/editorCommonEvent.ts +++ b/app/src/protyle/util/editorCommonEvent.ts @@ -21,15 +21,15 @@ import {isBrowser} from "../../util/functions"; import {hideElements} from "../ui/hideElements"; const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElement: Element, isSameDoc: boolean, position: InsertPosition) => { - let topSourceElement - const doOperations: IOperation[] = [] - const undoOperations: IOperation[] = [] - const foldHeadingIds: { id: string, parentID: string }[] = [] - const targetId = targetElement.getAttribute("data-node-id") - let tempTargetElement = targetElement + let topSourceElement; + const doOperations: IOperation[] = []; + const undoOperations: IOperation[] = []; + const foldHeadingIds: { id: string, parentID: string }[] = []; + const targetId = targetElement.getAttribute("data-node-id"); + let tempTargetElement = targetElement; sourceElements.reverse().forEach((item, index) => { const id = item.getAttribute("data-node-id"); - const parentID = item.parentElement.getAttribute("data-node-id") || protyle.block.rootID + const parentID = item.parentElement.getAttribute("data-node-id") || protyle.block.rootID; if (index === sourceElements.length - 1) { topSourceElement = getTopAloneElement(item); if (topSourceElement.isSameNode(item)) { @@ -66,7 +66,7 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemen if (position !== "afterend") { tempTargetElement = item; } - }) + }); undoOperations.reverse(); for (let j = 0; j < foldHeadingIds.length; j++) { const childrenItem = foldHeadingIds[j]; @@ -78,7 +78,7 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemen previousID: childrenItem.id, parentID: childrenItem.parentID, }); - }) + }); undoOperations.push({ action: "foldHeading", id: childrenItem.id, @@ -93,8 +93,8 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemen doOperations, undoOperations, topSourceElement, - } -} + }; +}; const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElement: Element, isBottom: boolean, direct: "col" | "row") => { const isSameDoc = protyle.element.contains(sourceElements[0]); @@ -184,11 +184,11 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen id: newSourceElement.getAttribute("data-node-id"), }); } else { - const foldHeadingIds: { id: string, parentID: string }[] = [] - let afterPreviousID + const foldHeadingIds: { id: string, parentID: string }[] = []; + let afterPreviousID; sourceElements.reverse().forEach((item, index) => { const id = item.getAttribute("data-node-id"); - const parentID = item.parentElement.getAttribute("data-node-id") || protyle.block.rootID + const parentID = item.parentElement.getAttribute("data-node-id") || protyle.block.rootID; if (index === sourceElements.length - 1) { topSourceElement = getTopAloneElement(item); if (topSourceElement.isSameNode(item)) { @@ -233,9 +233,9 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemen previousID: childrenItem.id, parentID: childrenItem.parentID, }); - }) + }); if (j === 0) { - afterPreviousID = headingIds.data[0] + afterPreviousID = headingIds.data[0]; } undoOperations.push({ action: "foldHeading", @@ -369,7 +369,7 @@ const dragSame = async (protyle: IProtyle, sourceElements: Element[], targetElem } let topSourceElement: Element; let oldSourceParentElement = sourceElements[0].parentElement; - const targetId = targetElement.getAttribute("data-node-id") + const targetId = targetElement.getAttribute("data-node-id"); if (isBottom) { if (newSourceElement) { targetElement.insertAdjacentElement("afterend", newSourceElement); @@ -680,7 +680,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => { insertHTML(protyle.lute.SpinBlockDOM(html), protyle, true); blockRender(protyle, protyle.wysiwyg.element); } else if (targetElement) { - hideElements(["gutter"], protyle) + hideElements(["gutter"], protyle); const targetClass = targetElement.className.split(" "); targetElement.classList.remove("dragover__bottom", "dragover__top", "dragover__left", "dragover__right", "protyle-wysiwyg--select"); if (targetElement.parentElement.getAttribute("data-type") === "NodeSuperBlock" && diff --git a/app/src/protyle/wysiwyg/commonHotkey.ts b/app/src/protyle/wysiwyg/commonHotkey.ts index fc5bb4256..02c63ab16 100644 --- a/app/src/protyle/wysiwyg/commonHotkey.ts +++ b/app/src/protyle/wysiwyg/commonHotkey.ts @@ -282,7 +282,7 @@ export const alignImgCenter = (protyle: IProtyle, nodeElement: Element, assetEle } }); updateTransaction(protyle, id, nodeElement.outerHTML, html); -} +}; export const alignImgLeft = (protyle: IProtyle, nodeElement: Element, assetElements: Element[], id: string, html: string) => { nodeElement.setAttribute("updated", dayjs().format("YYYYMMDDHHmmss")); @@ -296,4 +296,4 @@ export const alignImgLeft = (protyle: IProtyle, nodeElement: Element, assetEleme } }); updateTransaction(protyle, id, nodeElement.outerHTML, html); -} +}; diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts index efbb027dc..019cbf519 100644 --- a/app/src/protyle/wysiwyg/keydown.ts +++ b/app/src/protyle/wysiwyg/keydown.ts @@ -1042,7 +1042,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => { if (matchHotKey(window.siyuan.config.keymap.editor.general.alignLeft.custom, event)) { const imgSelectElements = nodeElement.querySelectorAll(".img--select"); if (imgSelectElements.length > 0) { - alignImgLeft(protyle, nodeElement, Array.from(imgSelectElements), nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML) + alignImgLeft(protyle, nodeElement, Array.from(imgSelectElements), nodeElement.getAttribute("data-node-id"), nodeElement.outerHTML); } else { let selectElements: HTMLElement[] = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select")); if (selectElements.length === 0) { diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 9e928e262..da049c619 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -479,7 +479,7 @@ export const onTransaction = (protyle: IProtyle, operation: IOperation, focus: b if (updateElements.length === 0) { // 页签拖入浮窗 https://github.com/siyuan-note/siyuan/issues/6647 window.siyuan.blockPanels.forEach((item) => { - const updateCloneElement = item.element.querySelector(`[data-node-id="${operation.id}"]`) + const updateCloneElement = item.element.querySelector(`[data-node-id="${operation.id}"]`); if (updateCloneElement) { updateElements.push(updateCloneElement.cloneNode(true) as Element); }