An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: https://github.com/siyuan-note/siyuan/issues/9368
Vanessa0ee6f5299e63
diff --git a/app/electron/main.js b/app/electron/main.jsindex d9fb18dcd4..534379824c 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -664,12 +664,15 @@ app.whenReady().then(() => {ipcMain.on("siyuan-first-quit", () => {app.exit();});- ipcMain.on("siyuan-show", (event) => {- showWindow(getWindowByContentId(event.sender.id));- });ipcMain.on("siyuan-cmd", (event, cmd) => {console.log(cmd)switch (cmd) {+ case "openDevTools":+ event.sender.openDevTools({mode: "bottom"});+ break;+ case "show":+ showWindow(getWindowByContentId(event.sender.id));+ break;case "hide":getWindowByContentId(event.sender.id).hide();break;diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.tsindex 79d768d194..93baec7805 100644--- a/app/src/boot/onGetConfig.ts+++ b/app/src/boot/onGetConfig.ts@@ -282,7 +282,7 @@ export const initWindow = (app: App) => {action: [Constants.CB_GET_FOCUS, Constants.CB_GET_CONTEXT, Constants.CB_GET_ROOTSCROLL],zoomIn: focus,});- ipcRenderer.send(Constants.SIYUAN_SHOW);+ ipcRenderer.send(Constants.SIYUAN_CMD, "show");}app.plugins.forEach(plugin => {plugin.eventBus.emit("open-siyuan-url-block", {diff --git a/app/src/constants.ts b/app/src/constants.tsindex 2186ce79a5..7ec6d68917 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -24,7 +24,6 @@ export abstract class Constants {public static readonly SIYUAN_DROP_EDITOR: string = "application/siyuan-editor";// 渲染进程调主进程- public static readonly SIYUAN_SHOW: string = "siyuan-show";public static readonly SIYUAN_CMD: string = "siyuan-cmd";public static readonly SIYUAN_CONFIG_TRAY: string = "siyuan-config-tray";diff --git a/app/src/layout/status.ts b/app/src/layout/status.tsindex 629193a087..6a63657f6c 100644--- a/app/src/layout/status.ts+++ b/app/src/layout/status.ts@@ -4,7 +4,7 @@ import {hasClosestByClassName} from "../protyle/util/hasClosest";import {fetchPost} from "../util/fetch";import {mountHelp} from "../util/mount";/// #if !BROWSER-import {getCurrentWindow} from "@electron/remote";+import { ipcRenderer } from "electron";/// #endif/// #endifimport {MenuItem} from "../menus/Menu";@@ -87,7 +87,7 @@ export const initStatus = (isWindow = false) => {label: window.siyuan.languages.debug,icon: "iconBug",click: () => {- getCurrentWindow().webContents.openDevTools({mode: "bottom"});+ ipcRenderer.send(Constants.SIYUAN_CMD, "openDevTools");}}).element);/// #endifdiff --git a/app/src/protyle/header/Title.ts b/app/src/protyle/header/Title.tsindex f3d5ce62e8..c5b8b7b58b 100644--- a/app/src/protyle/header/Title.ts+++ b/app/src/protyle/header/Title.ts@@ -9,9 +9,6 @@ import {MenuItem} from "../../menus/Menu";import {openFileAttr,} from "../../menus/commonMenuItem";-/// #if !BROWSER-import { ipcRenderer } from "electron";-/// #endifimport {Constants} from "../../constants";import {matchHotKey} from "../util/hotKey";import {readText, writeText} from "../util/compatibility";@@ -27,6 +24,7 @@ import {transaction} from "../wysiwyg/transaction";import {hideTooltip} from "../../dialog/tooltip";import {commonClick} from "../wysiwyg/commonClick";import {openTitleMenu} from "./openTitleMenu";+import {electronUndo} from "../undo";export class Title {public element: HTMLElement;@@ -97,20 +95,9 @@ export class Title {event.stopPropagation();return;}- /// #if !BROWSER- if (matchHotKey(window.siyuan.config.keymap.editor.general.undo.custom, event)) {- ipcRenderer.send(Constants.SIYUAN_CMD, "undo");- event.preventDefault();- event.stopPropagation();- return;- }- if (matchHotKey(window.siyuan.config.keymap.editor.general.redo.custom, event)) {- ipcRenderer.send(Constants.SIYUAN_CMD, "redo");- event.preventDefault();- event.stopPropagation();+ if (electronUndo(event)) {return;}- /// #endifif (event.key === "ArrowDown") {const noContainerElement = getNoContainerElement(protyle.wysiwyg.element.firstElementChild);// https://github.com/siyuan-note/siyuan/issues/4923diff --git a/app/src/protyle/undo/index.ts b/app/src/protyle/undo/index.tsindex e3c39689b9..24441342fe 100644--- a/app/src/protyle/undo/index.ts+++ b/app/src/protyle/undo/index.ts@@ -3,10 +3,8 @@ import {preventScroll} from "../scroll/preventScroll";import {Constants} from "../../constants";import {hideElements} from "../ui/hideElements";import {scrollCenter} from "../../util/highlightById";-/// #if !BROWSER-import {getCurrentWindow} from "@electron/remote";-/// #endifimport {matchHotKey} from "../util/hotKey";+import { ipcRenderer } from "electron";interface IOperations {doOperations: IOperation[],@@ -99,13 +97,13 @@ export class Undo {export const electronUndo = (event: KeyboardEvent) => {/// #if !BROWSERif (matchHotKey(window.siyuan.config.keymap.editor.general.undo.custom, event)) {- getCurrentWindow().webContents.undo();+ ipcRenderer.send(Constants.SIYUAN_CMD, "undo");event.preventDefault();event.stopPropagation();return true;}if (matchHotKey(window.siyuan.config.keymap.editor.general.redo.custom, event)) {- getCurrentWindow().webContents.redo();+ ipcRenderer.send(Constants.SIYUAN_CMD, "redo");event.preventDefault();event.stopPropagation();return true;