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/16879
Vanessa3be88c7b9fcd
diff --git a/app/src/boot/globalEvent/command/global.ts b/app/src/boot/globalEvent/command/global.tsindex 753a6439ce..ccd6de44e8 100644--- a/app/src/boot/globalEvent/command/global.ts+++ b/app/src/boot/globalEvent/command/global.ts@@ -42,6 +42,7 @@ import {Wnd} from "../../../layout/Wnd";import {unsplitWnd} from "../../../menus/tab";import {openFile} from "../../../editor/util";import {fetchPost} from "../../../util/fetch";+import {setStorageVal} from "../../../protyle/util/compatibility";export const globalCommand = (command: string, app: App) => {/// #if MOBILE@@ -151,8 +152,9 @@ export const globalCommand = (command: string, app: App) => {openRecentDocs();return true;case "recentClosed":- if (window.siyuan.closedTabs.length > 0) {- const closeData = window.siyuan.closedTabs.pop();+ if (window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].length > 0) {+ const closeData = window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].pop();+ setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]);const childData = closeData.children as ILayoutJSON;if (childData.instance === "Search") {openFile({diff --git a/app/src/constants.ts b/app/src/constants.tsindex 421bcc222a..40cff2d3f7 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -168,6 +168,7 @@ export abstract class Constants {public static readonly LOCAL_EMOJIS = "local-emojis";public static readonly LOCAL_MOVE_PATH = "local-move-path";public static readonly LOCAL_RECENT_DOCS = "local-recent-docs";+ public static readonly LOCAL_CLOSED_TABS = "local-closed-tabs";// dialogpublic static readonly DIALOG_CONFIRM = "dialog-confirm";diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.tsindex 489b1f09b0..c5f0885f00 100644--- a/app/src/layout/Wnd.ts+++ b/app/src/layout/Wnd.ts@@ -52,6 +52,7 @@ import {setPadding} from "../protyle/ui/initUI";import {setPosition} from "../util/setPosition";import {clearOBG} from "./dock/util";import {recordBeforeResizeTop} from "../protyle/util/resize";+import {setStorageVal} from "../protyle/util/compatibility";export class Wnd {private app: App;@@ -783,13 +784,13 @@ export class Wnd {clearCounter();this.children.find((item, index) => {if (item.id === id) {- if (window.siyuan.closedTabs.length > Constants.SIZE_UNDO) {- window.siyuan.closedTabs.pop();+ if (window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].length > Constants.SIZE_UNDO) {+ window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].pop();}const tabJSON = {};layoutToJSON(item, tabJSON);- window.siyuan.closedTabs.push(tabJSON);-+ window.siyuan.storage[Constants.LOCAL_CLOSED_TABS].push(tabJSON);+ setStorageVal(Constants.LOCAL_CLOSED_TABS, window.siyuan.storage[Constants.LOCAL_CLOSED_TABS]);if (item.model instanceof Custom && item.model.beforeDestroy) {item.model.beforeDestroy();}diff --git a/app/src/protyle/util/compatibility.ts b/app/src/protyle/util/compatibility.tsindex fdfaa0a4d4..610f4a318f 100644--- a/app/src/protyle/util/compatibility.ts+++ b/app/src/protyle/util/compatibility.ts@@ -467,6 +467,7 @@ export const getLocalStorage = (cb: () => void) => {currentTab: "emoji"};defaultStorage[Constants.LOCAL_FONTSTYLES] = [];+ defaultStorage[Constants.LOCAL_CLOSED_TABS] = [];defaultStorage[Constants.LOCAL_FILESPATHS] = []; // IFilesPath[]defaultStorage[Constants.LOCAL_SEARCHDATA] = {removed: true,@@ -506,7 +507,8 @@ export const getLocalStorage = (cb: () => void) => {Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD,Constants.LOCAL_DIALOGPOSITION, Constants.LOCAL_SEARCHUNREF, Constants.LOCAL_HISTORY,Constants.LOCAL_OUTLINE, Constants.LOCAL_FILEPOSITION, Constants.LOCAL_FILESPATHS, Constants.LOCAL_IMAGES,- Constants.LOCAL_PLUGIN_DOCKS, Constants.LOCAL_EMOJIS, Constants.LOCAL_MOVE_PATH, Constants.LOCAL_RECENT_DOCS].forEach((key) => {+ Constants.LOCAL_PLUGIN_DOCKS, Constants.LOCAL_EMOJIS, Constants.LOCAL_MOVE_PATH, Constants.LOCAL_RECENT_DOCS,+ Constants.LOCAL_CLOSED_TABS].forEach((key) => {if (typeof response.data[key] === "string") {try {const parseData = JSON.parse(response.data[key]);