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:
Vanessa2c36af78bc78
diff --git a/app/electron/main.js b/app/electron/main.jsindex 31f8049a00..8c16bae748 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -20,7 +20,7 @@ const {const path = require("path");const fs = require("fs");const gNet = require("net");-const remote = require('@electron/remote/main');+const remote = require("@electron/remote/main");process.noAsar = true;const appDir = path.dirname(app.getAppPath());@@ -657,7 +657,7 @@ app.whenReady().then(() => {resetTrayMenu(tray, lang, mainWindow);};const getWindowByContentId = (id) => {- return BrowserWindow.fromId(BrowserWindow.getAllWindows().find((win) => win.webContents.id === id).id)+ return BrowserWindow.fromId(BrowserWindow.getAllWindows().find((win) => win.webContents.id === id).id);};ipcMain.on("siyuan-open-folder", (event, filePath) => {@@ -702,7 +702,7 @@ app.whenReady().then(() => {return true;}});- return hasMatch+ return hasMatch;}});ipcMain.once("siyuan-event", (event) => {@@ -727,14 +727,14 @@ app.whenReady().then(() => {currentWindow.on("leave-full-screen", () => {event.sender.send("siyuan-event", "leave-full-screen");});- })+ });ipcMain.on("siyuan-cmd", (event, data) => {let cmd = data;- let webContentsId = event.sender.id+ let webContentsId = event.sender.id;if (typeof data !== "string") {cmd = data.cmd;if (data.webContentsId) {- webContentsId = data.webContentsId+ webContentsId = data.webContentsId;}}const currentWindow = getWindowByContentId(webContentsId);@@ -941,7 +941,7 @@ app.whenReady().then(() => {// 系统托盘tray = new Tray(path.join(appDir, "stage", "icon-large.png"));tray.setToolTip(`${path.basename(data.workspaceDir)} - SiYuan v${appVer}`);- const mainWindow = getWindowByContentId(event.sender.id)+ const mainWindow = getWindowByContentId(event.sender.id);resetTrayMenu(tray, data.languages, mainWindow);tray.on("click", () => {showHideWindow(tray, data.languages, mainWindow);diff --git a/app/src/boot/globalEvent/click.ts b/app/src/boot/globalEvent/click.tsindex f8f0a65943..e670c5a2f5 100644--- a/app/src/boot/globalEvent/click.ts+++ b/app/src/boot/globalEvent/click.ts@@ -41,7 +41,7 @@ export const globalClick = (event: MouseEvent & { target: HTMLElement }) => {const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");if (copyElement) {- let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd()+ let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd();text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382writeText(text);showMessage(window.siyuan.languages.copied, 2000);diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.tsindex 334ba91228..1c8795d901 100644--- a/app/src/boot/onGetConfig.ts+++ b/app/src/boot/onGetConfig.ts@@ -196,7 +196,7 @@ export const initWindow = async (app: App) => {});};- ipcRenderer.send(Constants.SIYUAN_EVENT, "onEvent")+ ipcRenderer.send(Constants.SIYUAN_EVENT, "onEvent");ipcRenderer.on(Constants.SIYUAN_EVENT, (event, cmd) => {if (cmd === "focus") {if (getSelection().rangeCount > 0) {@@ -227,7 +227,7 @@ export const initWindow = async (app: App) => {document.getElementById("toolbar").style.paddingLeft = "0";}} else {- winOnMaxRestore()+ winOnMaxRestore();}} else if (cmd === "leave-full-screen") {if ("darwin" === window.siyuan.config.system.os) {diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex 6f1ed73af6..3b046729f2 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -178,7 +178,7 @@ export const openFile = async (options: IOpenFileOptions) => {hasMatch = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: Constants.SIYUAN_OPEN_FILE,options: optionsClone,- })+ });if (hasMatch) {if (options.afterOpen) {options.afterOpen();diff --git a/app/src/emoji/index.ts b/app/src/emoji/index.tsindex 8d94bb06b4..607ad237f4 100644--- a/app/src/emoji/index.ts+++ b/app/src/emoji/index.ts@@ -232,7 +232,7 @@ export const openEmojiPanel = (id: string, type: "doc" | "notebook" | "av", posi</div>`});dialog.element.querySelector(".b3-dialog__container").setAttribute("data-menu", "true");- const dialogElement = dialog.element.querySelector(".b3-dialog") as HTMLElement+ const dialogElement = dialog.element.querySelector(".b3-dialog") as HTMLElement;dialogElement.style.justifyContent = "inherit";dialogElement.style.alignItems = "inherit";setPosition(dialog.element.querySelector(".b3-dialog__container"), position.x, position.y, position.h, position.w);@@ -405,7 +405,7 @@ ${unicode2Emoji(emoji.unicode)}</button>`;if (emojiElement) {unicode = emojiElement.getAttribute("data-unicode");if (type !== "av") {- dialog.destroy()+ dialog.destroy();}} else {// 随机diff --git a/app/src/mobile/index.ts b/app/src/mobile/index.tsindex 259b703211..3aff5636a0 100644--- a/app/src/mobile/index.ts+++ b/app/src/mobile/index.ts@@ -64,7 +64,7 @@ class App {}const copyElement = hasTopClosestByClassName(event.target, "protyle-action__copy");if (copyElement) {- let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd()+ let text = copyElement.parentElement.nextElementSibling.textContent.trimEnd();text = text.replace(/\u00A0/g, " "); // Replace non-breaking spaces with normal spaces when copying https://github.com/siyuan-note/siyuan/issues/9382writeText(text);showMessage(window.siyuan.languages.copied, 2000);diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.tsindex 0530a8bce9..f69deaa452 100644--- a/app/src/protyle/breadcrumb/index.ts+++ b/app/src/protyle/breadcrumb/index.ts@@ -271,12 +271,12 @@ export class Breadcrumb {click: async () => {/// #if !BROWSERif (window.siyuan.config.system.os === "darwin") {- const status = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: "getMicrophone"})+ const status = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: "getMicrophone"});if (["denied", "restricted", "unknown"].includes(status)) {showMessage(window.siyuan.languages.microphoneDenied);return;} else if (status === "not-determined") {- const isAccess = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: "askMicrophone"})+ const isAccess = await ipcRenderer.invoke(Constants.SIYUAN_GET, {cmd: "askMicrophone"});if (!isAccess) {showMessage(window.siyuan.languages.microphoneNotAccess);return;diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.tsindex 334e544884..eb2a415383 100644--- a/app/src/protyle/render/av/action.ts+++ b/app/src/protyle/render/av/action.ts@@ -278,15 +278,15 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: amenu.addSeparator();const editAttrSubmenu: IMenu[] = [];rowElement.parentElement.querySelectorAll(".av__row--header .av__cell").forEach((cellElement: HTMLElement) => {- let hideBlock = false- const selectElements: HTMLElement[] = Array.from(blockElement.querySelectorAll(`.av__row--select:not(.av__row--header) .av__cell[data-col-id="${cellElement.dataset.colId}"]`))+ let hideBlock = false;+ const selectElements: HTMLElement[] = Array.from(blockElement.querySelectorAll(`.av__row--select:not(.av__row--header) .av__cell[data-col-id="${cellElement.dataset.colId}"]`));if (cellElement.dataset.dtype === "block") {selectElements.find(item => {if (!item.dataset.detached) {hideBlock = true;return true;}- })+ });}if (!hideBlock) {editAttrSubmenu.push({diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.tsindex 8138658d80..2acf889055 100644--- a/app/src/protyle/render/av/blockAttr.ts+++ b/app/src/protyle/render/av/blockAttr.ts@@ -9,7 +9,7 @@ export const genAVValueHTML = (value: IAVCellValue) => {let html = "";switch (value.type) {case "text":- html = `<textarea rows="${value.text.content.split('\n').length}" class="b3-text-field b3-text-field--text fn__flex-1">${value.text.content}</textarea>`;+ html = `<textarea rows="${value.text.content.split("\n").length}" class="b3-text-field b3-text-field--text fn__flex-1">${value.text.content}</textarea>`;break;case "number":html = `<input value="${value.number.content}" type="number" class="b3-text-field b3-text-field--text fn__flex-1">`;diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.tsindex d63ed6eab2..fcea23b6f9 100644--- a/app/src/protyle/render/av/col.ts+++ b/app/src/protyle/render/av/col.ts@@ -424,7 +424,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemendata: cellElement.dataset.icon,}]);iconElement.setAttribute("data-icon", unicode);- iconElement.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(type)}"></use></svg>`+ iconElement.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(type)}"></use></svg>`;updateAttrViewCellAnimation(cellElement);});event.preventDefault();diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.tsindex c6828fa732..0406a6fcf6 100644--- a/app/src/protyle/render/av/openMenuPanel.ts+++ b/app/src/protyle/render/av/openMenuPanel.ts@@ -522,8 +522,8 @@ export const openMenuPanel = (options: {avID,data: target.dataset.icon,}]);- target.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(target.dataset.colType as TAVCol)}"></use></svg>`- updateAttrViewCellAnimation(options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`))+ target.innerHTML = unicode ? unicode2Emoji(unicode) : `<svg><use xlink:href="#${getColIconByType(target.dataset.colType as TAVCol)}"></use></svg>`;+ updateAttrViewCellAnimation(options.blockElement.querySelector(`.av__row--header .av__cell[data-col-id="${colId}"]`));});event.preventDefault();event.stopPropagation();diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.tsindex ae83923c45..4b1d09b7d4 100644--- a/app/src/protyle/util/selection.ts+++ b/app/src/protyle/util/selection.ts@@ -534,7 +534,7 @@ export const focusBlock = (element: Element, parentElement?: HTMLElement, toStarreturn false;}} else if (element.classList.contains("av")) {- const avTitleElement = element.querySelector(".av__title")+ const avTitleElement = element.querySelector(".av__title");if (avTitleElement) {const range = document.createRange();range.selectNodeContents(avTitleElement);diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex d8d3b7742a..34b3d1a183 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -53,7 +53,6 @@ import {upSelect} from "./commonHotkey";import {enterBack, fileAnnotationRefMenu, linkMenu, refMenu, setFold, tagMenu, zoomOut} from "../../menus/protyle";-import {removeEmbed} from "./removeEmbed";import {openAttr} from "../../menus/commonMenuItem";import {Constants} from "../../constants";import {fetchPost} from "../../util/fetch";diff --git a/app/src/window/index.ts b/app/src/window/index.tsindex 3c30c6c0b7..492a5de216 100644--- a/app/src/window/index.ts+++ b/app/src/window/index.ts@@ -7,7 +7,7 @@ import {addScript, addScriptSync} from "../protyle/util/addScript";import {genUUID} from "../util/genID";import {fetchGet, fetchPost} from "../util/fetch";import {addBaseURL, setNoteBook} from "../util/pathName";-import {openFile, openFileById} from "../editor/util";+import {openFileById} from "../editor/util";import {processSync, progressBackgroundTask,progressLoading,