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/9032
Vanessa336eaef0000e
diff --git a/app/electron/main.js b/app/electron/main.jsindex 73c9e1af5b..aa7ba2695a 100644--- a/app/electron/main.js+++ b/app/electron/main.js@@ -699,10 +699,9 @@ app.whenReady().then(() => {const win = new BrowserWindow({show: true,trafficLightPosition: {x: 8, y: 13},- width: mainScreen.size.width * 0.7,- height: mainScreen.size.height * 0.9,+ width: data.width || mainScreen.size.width * 0.7,+ height: data.height || mainScreen.size.height * 0.9,minWidth: 493,- center: true,minHeight: 376,fullscreenable: true,frame: "darwin" === process.platform,@@ -716,6 +715,11 @@ app.whenReady().then(() => {autoplayPolicy: "user-gesture-required" // 桌面端禁止自动播放多媒体 https://github.com/siyuan-note/siyuan/issues/7587},});+ if (data.position) {+ win.setPosition(data.position.x, data.position.y);+ } else {+ win.center();+ }win.loadURL(data.url);const targetScreen = screen.getDisplayNearestPoint(screen.getCursorScreenPoint());if (mainScreen.id !== targetScreen.id) {diff --git a/app/src/plugin/API.ts b/app/src/plugin/API.tsindex 5579ec2752..33977b6581 100644--- a/app/src/plugin/API.ts+++ b/app/src/plugin/API.ts@@ -27,17 +27,23 @@ openWindow = () => {};/// #elseopenWindow = (options: {+ position?: {+ x: number,+ y: number,+ },+ height?: number,+ width?: number,tab?: Tab,doc?: {id: string, // 块 id},}) => {if (options.doc.id) {- openNewWindowById(options.doc.id);+ openNewWindowById(options.doc.id, {position: options.position, width: options.width, height: options.height});return;}if (options.tab) {- openNewWindow(options.tab)+ openNewWindow(options.tab, {position: options.position, width: options.width, height: options.height});return;}};diff --git a/app/src/window/openNewWindow.ts b/app/src/window/openNewWindow.tsindex d00b9fc62e..f1195f4eb1 100644--- a/app/src/window/openNewWindow.ts+++ b/app/src/window/openNewWindow.ts@@ -8,11 +8,23 @@ import {Tab} from "../layout/Tab";import {fetchPost} from "../util/fetch";import {showMessage} from "../dialog/message";-export const openNewWindow = (tab: Tab) => {+interface windowOptions {+ position?: {+ x: number,+ y: number,+ },+ width?: number,+ height?: number+}++export const openNewWindow = (tab: Tab, options: windowOptions = {}) => {const json = {};layoutToJSON(tab, json);/// #if !BROWSERipcRenderer.send(Constants.SIYUAN_OPENWINDOW, {+ position: options.position,+ width: options.width,+ height: options.height,id: getCurrentWindow().id,url: `${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`});@@ -20,7 +32,7 @@ export const openNewWindow = (tab: Tab) => {tab.parent.removeTab(tab.id);};-export const openNewWindowById = (id: string) => {+export const openNewWindowById = (id: string, options: windowOptions = {}) => {fetchPost("/api/block/getBlockInfo", {id}, (response) => {if (response.code === 3) {showMessage(response.msg);@@ -50,6 +62,9 @@ export const openNewWindowById = (id: string) => {}/// #if !BROWSERipcRenderer.send(Constants.SIYUAN_OPENWINDOW, {+ position: options.position,+ width: options.width,+ height: options.height,id: getCurrentWindow().id,url: `${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`});@@ -62,6 +77,9 @@ export const openNewWindowById = (id: string) => {};/// #if !BROWSERipcRenderer.send(Constants.SIYUAN_OPENWINDOW, {+ position: options.position,+ width: options.width,+ height: options.height,id: getCurrentWindow().id,url: `${window.location.protocol}//${window.location.host}/stage/build/app/window.html?v=${Constants.SIYUAN_VERSION}&json=${JSON.stringify(json)}`});