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:
Vanessab2ba9ace0745
diff --git a/app/src/config/about.ts b/app/src/config/about.tsindex 557b281fda..7a50d29fbb 100644--- a/app/src/config/about.ts+++ b/app/src/config/about.ts@@ -391,13 +391,13 @@ export const about = {});about.element.querySelector("#aboutConfirm").addEventListener("click", () => {const scheme = (about.element.querySelector("#aboutScheme") as HTMLInputElement).value;- const host = (about.element.querySelector("#aboutHost") as HTMLInputElement).value+ const host = (about.element.querySelector("#aboutHost") as HTMLInputElement).value;const port = (about.element.querySelector("#aboutPort") as HTMLInputElement).value;fetchPost("/api/system/setNetworkProxy", {scheme, host, port}, () => {- window.siyuan.config.system.networkProxy.scheme = scheme- window.siyuan.config.system.networkProxy.host = host- window.siyuan.config.system.networkProxy.port = port- setProxy()+ window.siyuan.config.system.networkProxy.scheme = scheme;+ window.siyuan.config.system.networkProxy.host = host;+ window.siyuan.config.system.networkProxy.port = port;+ setProxy();});});}diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex 243527effe..19d0ff6f38 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -45,7 +45,6 @@ import {exportAsset} from "./util";import {removeLink} from "../protyle/toolbar/Link";import {alignImgCenter, alignImgLeft} from "../protyle/wysiwyg/commonHotkey";import {getEnableHTML} from "../protyle/wysiwyg/removeEmbed";-import {getContenteditableElement} from "../protyle/wysiwyg/getBlock";export const refMenu = (protyle: IProtyle, element: HTMLElement) => {const nodeElement = hasClosestBlock(element);@@ -319,7 +318,7 @@ export const contentMenu = (protyle: IProtyle, nodeElement: Element) => {}});if (protyle.disabled) {- html = getEnableHTML(html)+ html = getEnableHTML(html);}const tempElement = document.createElement("template");tempElement.innerHTML = protyle.lute.BlockDOM2HTML(html);diff --git a/app/src/protyle/gutter/index.ts b/app/src/protyle/gutter/index.tsindex 098c6747d3..f210a3c214 100644--- a/app/src/protyle/gutter/index.ts+++ b/app/src/protyle/gutter/index.ts@@ -608,7 +608,7 @@ export class Gutter {html += item.outerHTML;});if (protyle.disabled) {- html = getEnableHTML(html)+ html = getEnableHTML(html);}writeText(protyle.lute.BlockDOM2HTML(html));}@@ -983,9 +983,9 @@ export class Gutter {}, {label: window.siyuan.languages.copy + " HTML",click() {- let html = nodeElement.outerHTML+ let html = nodeElement.outerHTML;if (protyle.disabled) {- html = getEnableHTML(html)+ html = getEnableHTML(html);}writeText(protyle.lute.BlockDOM2HTML(html));}diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.tsindex 01513d6571..7a8e5deb13 100644--- a/app/src/protyle/toolbar/index.ts+++ b/app/src/protyle/toolbar/index.ts@@ -21,7 +21,7 @@ import {highlightRender} from "../markdown/highlightRender";import {getContenteditableElement, hasNextSibling, hasPreviousSibling} from "../wysiwyg/getBlock";import {processRender} from "../util/processCode";import {BlockRef} from "./BlockRef";-import {hintMoveBlock, hintRenderAssets, hintRenderTemplate, hintRenderWidget} from "../hint/extend";+import {hintRenderAssets, hintRenderTemplate, hintRenderWidget} from "../hint/extend";import {blockRender} from "../markdown/blockRender";/// #if !BROWSERimport {clipboard, nativeImage, NativeImage} from "electron";@@ -33,8 +33,6 @@ import {isArrayEqual, isBrowser, isMobile} from "../../util/functions";import * as dayjs from "dayjs";import {insertEmptyBlock} from "../../block/util";import {matchHotKey} from "../util/hotKey";-import {unicode2Emoji} from "../../emoji";-import {escapeHtml} from "../../util/escape";import {hideElements} from "../ui/hideElements";import {renderAssetsPreview} from "../../asset/renderAssets";import {electronUndo} from "../undo";diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex 2c42a201f8..ec6a32ccaa 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -24,7 +24,7 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:isSameDoc: boolean, isBottom: boolean, isCopy: boolean) => {let topSourceElement;const targetId = targetElement.getAttribute("data-node-id");- const newSourceId = newSourceElement.getAttribute("data-node-id")+ const newSourceId = newSourceElement.getAttribute("data-node-id");const doOperations: IOperation[] = [];const undoOperations: IOperation[] = [];targetElement.insertAdjacentElement(isBottom ? "afterend" : "beforebegin", newSourceElement);@@ -34,24 +34,24 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:data: newSourceElement.outerHTML,id: newSourceId,previousID: targetId,- })+ });} else {doOperations.push({action: "insert",data: newSourceElement.outerHTML,id: newSourceId,nextID: targetId,- })+ });}sourceElements.reverse().forEach((item, index) => {- const itemId = item.getAttribute("data-node-id")+ const itemId = item.getAttribute("data-node-id");if (index === sourceElements.length - 1) {topSourceElement = getTopAloneElement(item);if (topSourceElement.isSameNode(item)) {topSourceElement = undefined;}}- const copyId = Lute.NewNodeID()+ const copyId = Lute.NewNodeID();if (isCopy) {undoOperations.push({action: "delete",@@ -119,7 +119,7 @@ const moveToNew = (protyle: IProtyle, sourceElements: Element[], targetElement:undoOperations,topSourceElement,};-}+};const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElement: Element,isSameDoc: boolean, position: InsertPosition, isCopy: boolean) => {@@ -147,8 +147,8 @@ const moveTo = async (protyle: IProtyle, sourceElements: Element[], targetElemenfoldHeadingIds.push({id, parentID});}}- let copyId- let copyElement+ let copyId;+ let copyElement;if (isCopy) {copyId = Lute.NewNodeID();undoOperations.push({@@ -262,7 +262,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElemenparentID: sbElement.parentElement.getAttribute("data-node-id") || protyle.block.parentID || protyle.block.rootID}];if (newSourceElement) {- const newSourceId = newSourceElement.getAttribute("data-node-id")+ const newSourceId = newSourceElement.getAttribute("data-node-id");sbElement.insertAdjacentElement("afterbegin", targetElement);doOperations.push({action: "move",@@ -293,7 +293,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElementopSourceElement = undefined;}}- const copyId = Lute.NewNodeID()+ const copyId = Lute.NewNodeID();if (isCopy) {undoOperations.push({action: "delete",@@ -355,7 +355,7 @@ const dragSb = async (protyle: IProtyle, sourceElements: Element[], targetElementopSourceElement = undefined;}}- const copyId = Lute.NewNodeID()+ const copyId = Lute.NewNodeID();if (index === 0) {afterPreviousID = isCopy ? copyId : id;}diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex d454d469fe..93f8f8a12d 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -278,7 +278,7 @@ export class WYSIWYG {}}if (protyle.disabled) {- html = getEnableHTML(html)+ html = getEnableHTML(html);}event.clipboardData.setData("text/plain", textPlain || protyle.lute.BlockDOM2StdMd(html).trimEnd());event.clipboardData.setData("text/html", html + Constants.ZWSP);diff --git a/app/src/protyle/wysiwyg/removeEmbed.ts b/app/src/protyle/wysiwyg/removeEmbed.tsindex 4a1a970642..a07bb90df9 100644--- a/app/src/protyle/wysiwyg/removeEmbed.ts+++ b/app/src/protyle/wysiwyg/removeEmbed.ts@@ -23,4 +23,4 @@ export const getEnableHTML = (html: string) => {}});return tempElement.innerHTML;-}+};diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.tsindex 8c8db22bd2..de12770503 100644--- a/app/src/util/globalShortcut.ts+++ b/app/src/util/globalShortcut.ts@@ -804,9 +804,9 @@ const editKeydown = (event: KeyboardEvent) => {if (protyle.title?.editElement.contains(range.startContainer)) {movePathTo([protyle.path], range);} else if (nodeElement && range && protyle.element.contains(range.startContainer)) {- let selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"))+ let selectElements = Array.from(protyle.wysiwyg.element.querySelectorAll(".protyle-wysiwyg--select"));if (selectElements.length === 0) {- selectElements = [nodeElement]+ selectElements = [nodeElement];}movePathTo([], undefined, (toPath) => {hintMoveBlock(toPath, selectElements, protyle);diff --git a/app/src/util/onGetConfig.ts b/app/src/util/onGetConfig.tsindex 2bb638644a..f13422bf58 100644--- a/app/src/util/onGetConfig.ts+++ b/app/src/util/onGetConfig.ts@@ -92,12 +92,12 @@ export const setProxy = () => {/// #if !BROWSERif ("" === window.siyuan.config.system.networkProxy.scheme) {console.log("network proxy [system]");- return+ return;}const session = getCurrentWindow().webContents.session;session.closeAllConnections().then(() => {- const proxyURL = `${window.siyuan.config.system.networkProxy.scheme}://${window.siyuan.config.system.networkProxy.host}:${window.siyuan.config.system.networkProxy.port}`+ const proxyURL = `${window.siyuan.config.system.networkProxy.scheme}://${window.siyuan.config.system.networkProxy.host}:${window.siyuan.config.system.networkProxy.port}`;session.setProxy({proxyRules: proxyURL}).then(() => console.log("network proxy [" + proxyURL + "]"),);diff --git a/app/src/util/pathName.ts b/app/src/util/pathName.tsindex b687b3f5bf..b041284225 100644--- a/app/src/util/pathName.ts+++ b/app/src/util/pathName.ts@@ -119,7 +119,7 @@ export const movePathTo = (paths?: string[], range?: Range, cb?: (toPath:string)});if (paths.length) {fetchPost("/api/filetree/getHPathsByPaths", {paths}, (response) => {- dialog.element.querySelector(".b3-dialog__header .ft__smaller").innerHTML = escapeHtml(response.data.join(", "))+ dialog.element.querySelector(".b3-dialog__header .ft__smaller").innerHTML = escapeHtml(response.data.join(", "));});}const searchListElement = dialog.element.querySelector("#foldList");@@ -151,7 +151,7 @@ export const movePathTo = (paths?: string[], range?: Range, cb?: (toPath:string)}searchTreeElement.classList.add("fn__none");searchListElement.classList.remove("fn__none");- searchListElement.scrollTo(0, 0)+ searchListElement.scrollTo(0, 0);fetchPost("/api/filetree/searchDocs", {k: inputElement.value}, (data) => {@@ -352,14 +352,14 @@ export const movePathTo = (paths?: string[], range?: Range, cb?: (toPath:string)return;}currentItemElement.classList.remove("b3-list-item--focus");- target.classList.add("b3-list-item--focus")+ target.classList.add("b3-list-item--focus");event.preventDefault();event.stopPropagation();break;}target = target.parentElement;}- inputElement.focus()+ inputElement.focus();});};@@ -378,7 +378,7 @@ const getLeaf = (liElement: HTMLElement) => {return;}- const notebookId = liElement.getAttribute("data-box")+ const notebookId = liElement.getAttribute("data-box");fetchPost("/api/filetree/listDocsByPath", {notebook: notebookId,path: liElement.getAttribute("data-path"),@@ -418,7 +418,7 @@ data-box="${notebookId}" class="b3-list-item" data-path="${item.path}">}, 120);}, 2);});-}+};export const getNotebookName = (id: string) => {let rootPath = "";