An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:rotating_light:
Vanessae354fcd39c5d
diff --git a/.github/CONTRIBUTING_zh_CN.md b/.github/CONTRIBUTING_zh_CN.mdindex f33fba5a12..aba12db4b8 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 [email protected] -D`+* macOS/Linux:+ ```+ ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/ pnpm install [email protected] -D+ ```* Windows:* `SET ELECTRON_MIRROR=https://cnpmjs.org/mirrors/electron/`* `pnpm install [email protected] -D`diff --git a/app/pnpm-lock.yaml b/app/pnpm-lock.yamlindex 7192390486..1223b8de6b 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.1async-exit-hook: 2.0.1bluebird-lst: 1.0.9builder-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.1app-builder-bin: 4.0.0bluebird-lst: 1.0.9builder-util-runtime: 9.0.3diff --git a/app/src/config/account.ts b/app/src/config/account.tsindex 72f21be140..028e119558 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 = `<a href="` + sponsor + `" target="_blank" class="b3-chip b3-chip--secondary">+ const payHTML = "<a href=\"" + sponsor + `" target="_blank" class="b3-chip b3-chip--secondary"><svg version='1.1' xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'><path fill='#ffe43c' d='M6.4 0h19.2c4.268 0 6.4 2.132 6.4 6.4v19.2c0 4.268-2.132 6.4-6.4 6.4h-19.2c-4.268 0-6.4-2.132-6.4-6.4v-19.2c0-4.268 2.135-6.4 6.4-6.4z'></path> <path fill='#00f5d4' d='M25.6 0h-8.903c-7.762 1.894-14.043 7.579-16.697 15.113v10.487c0 3.533 2.867 6.4 6.4 6.4h19.2c3.533 0 6.4-2.867 6.4-6.4v-19.2c0-3.537-2.863-6.4-6.4-6.4z'></path> <path fill='#01beff' d='M25.6 0h-0.119c-12.739 2.754-20.833 15.316-18.079 28.054 0.293 1.35 0.702 2.667 1.224 3.946h16.974c3.533 0 6.4-2.867 6.4-6.4v-19.2c0-3.537-2.863-6.4-6.4-6.4z'></path> <path fill='#9a5ce5' d='M31.005 2.966c-0.457-0.722-1.060-1.353-1.784-1.849-8.342 3.865-13.683 12.223-13.679 21.416-0.003 3.256 0.67 6.481 1.978 9.463h8.081c0.602 0 1.185-0.084 1.736-0.238-2.1-3.189-3.401-7.624-3.401-12.526 0-7.337 2.921-13.628 7.070-16.266z'></path> <path fill='#f15bb5' d='M32 25.6v-19.2c0-1.234-0.354-2.419-0.998-3.43-4.149 2.638-7.067 8.928-7.067 16.266 0 4.902 1.301 9.334 3.401 12.526 2.693-0.757 4.664-3.231 4.664-6.162z'></path> <path fill='#fff' opacity='0.2' d='M26.972 22.415c-2.889 0.815-4.297 2.21-6.281 3.182 1.552 0.348 3.105 0.461 4.902 0.461 2.644 0 5.363-1.449 6.406-2.519v-1.085c-1.598-0.399-2.664-0.705-5.028-0.039zM4.773 21.612c-0.003 0-0.006-0.003-0.006-0.003-1.726-0.863-3.382-1.205-4.767-1.301v2.487c0.779-0.341 2.396-0.921 4.773-1.182zM17.158 26.599c1.472-0.158 2.57-0.531 3.533-1.002-1.063-0.238-2.126-0.583-3.269-1.079-2.767-1.205-5.63-3.092-10.491-3.034-0.779 0.010-1.495 0.058-2.158 0.132 4.503 2.248 7.882 5.463 12.384 4.983z'></path> <path fill='#fff' opacity='0.2' d='M20.691 25.594c-0.963 0.47-2.061 0.844-3.533 1.002-4.503 0.483-7.882-2.731-12.381-4.983-2.38 0.261-3.994 0.841-4.773 1.179v2.809c0 4.268 2.132 6.4 6.4 6.4h19.197c4.268 0 6.4-2.132 6.4-6.4v-2.065c-1.044 1.069-3.762 2.519-6.406 2.519-1.797 0-3.35-0.113-4.902-0.461z'></path> <path fill='#fff' opacity='0.5' d='M3.479 19.123c0 0.334 0.271 0.606 0.606 0.606s0.606-0.271 0.606-0.606v0c0-0.334-0.271-0.606-0.606-0.606s-0.606 0.271-0.606 0.606v0z'></path> <path fill='#fff' opacity='0.5' d='M29.027 14.266c0 0.334 0.271 0.606 0.606 0.606s0.606-0.271 0.606-0.606v0c0-0.334-0.271-0.606-0.606-0.606s-0.606 0.271-0.606 0.606v0z'></path> <path fill='#fff' d='M9.904 1.688c0 0.167 0.136 0.303 0.303 0.303s0.303-0.136 0.303-0.303v0c0-0.167-0.136-0.303-0.303-0.303s-0.303 0.136-0.303 0.303v0z'></path> <path fill='#fff' d='M2.673 10.468c0 0.167 0.136 0.303 0.303 0.303s0.303-0.136 0.303-0.303v0c0-0.167-0.136-0.303-0.303-0.303s-0.303 0.136-0.303 0.303v0z'></path> <path fill='#fff' opacity='0.6' d='M30.702 9.376c0 0.167 0.136 0.303 0.303 0.303s0.303-0.136 0.303-0.303v0c0-0.167-0.136-0.303-0.303-0.303s-0.303 0.136-0.303 0.303v0z'></path> <path fill='#fff' opacity='0.8' d='M29.236 20.881c0 0.276 0.224 0.499 0.499 0.499s0.499-0.224 0.499-0.499v0c0-0.276-0.224-0.499-0.499-0.499s-0.499 0.224-0.499 0.499v0z'></path> <path fill='#fff' opacity='0.8' d='M15.38 1.591c0.047 0.016 0.101 0.026 0.158 0.026 0.276 0 0.499-0.224 0.499-0.499 0-0.219-0.141-0.406-0.338-0.473l-0.004-0.001c-0.047-0.016-0.101-0.026-0.158-0.026-0.276 0-0.499 0.224-0.499 0.499 0 0.219 0.141 0.406 0.338 0.473l0.004 0.001z'></path> <path fill='#ffdeeb' d='M25.732 8.268c-2.393-2.371-6.249-2.371-8.642 0l-1.089 1.085-1.079-1.089c-2.38-2.39-6.249-2.393-8.639-0.013s-2.393 6.249-0.013 8.639l2.158 2.158 6.474 6.464c0.596 0.593 1.562 0.593 2.158 0l6.474-6.464 2.193-2.158c2.384-2.383 2.384-6.242 0.003-8.622z'></path> <path fill='#fff' d='M17.081 8.268l-1.079 1.085-1.079-1.089c-2.38-2.39-6.249-2.393-8.639-0.013s-2.393 6.249-0.013 8.639l2.158 2.158 2.548 2.487c4.097-1.044 7.627-3.646 9.837-7.254 1.424-2.271 2.284-4.848 2.503-7.518-2.193-0.715-4.606-0.132-6.236 1.504z'></path> </svg>${window.siyuan.languages.sponsor}</a>diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex ec60e229b0..b2027966af 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: HTMLElemelabel: 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.tsindex 3ea22ccc39..1bdb88225e 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[], targetElemenif (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[], targetElemenpreviousID: childrenItem.id,parentID: childrenItem.parentID,});- })+ });undoOperations.push({action: "foldHeading",id: childrenItem.id,@@ -93,8 +93,8 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemendoOperations,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[], targetElemenid: 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[], targetElemenpreviousID: 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.tsindex fc5bb42561..02c63ab16e 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.tsindex efbb027dc7..019cbf5199 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.tsindex 9e928e262e..da049c619d 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: bif (updateElements.length === 0) {// 页签拖入浮窗 https://github.com/siyuan-note/siyuan/issues/6647window.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);}