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/6415
Vanessab470885e7505
diff --git a/app/src/constants.ts b/app/src/constants.tsindex bf17913f3d..7794fed20e 100644--- a/app/src/constants.ts+++ b/app/src/constants.ts@@ -35,7 +35,6 @@ export abstract class Constants {// sizepublic static readonly SIZE_TOOLBAR_HEIGHT: number = 42;- public static readonly SIZE_GET = 36;public static readonly SIZE_GET_MAX = 102400;public static readonly SIZE_UNDO = 64;public static readonly SIZE_TITLE = 512;diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex f3b86ec896..2785609846 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -218,7 +218,7 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IModfetchPost("/api/filetree/getDoc", {id: options.id,mode: (options.action && options.action.includes(Constants.CB_GET_CONTEXT)) ? 3 : 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, editor.editor.protyle, options.action);// 大纲点击折叠标题下的内容时,需更新反链面板diff --git a/app/src/layout/dock/Outline.ts b/app/src/layout/dock/Outline.tsindex 421c9e6b64..41297d05da 100644--- a/app/src/layout/dock/Outline.ts+++ b/app/src/layout/dock/Outline.ts@@ -142,7 +142,7 @@ export class Outline extends Model {fetchPost("/api/filetree/getDoc", {id: item.editor.protyle.block.rootID,mode: 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS]);});diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.tsindex 2ed8216d62..d726e9a641 100644--- a/app/src/menus/protyle.ts+++ b/app/src/menus/protyle.ts@@ -451,7 +451,7 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB}fetchPost("/api/filetree/getDoc", {id,- size: id === protyle.block.rootID ? Constants.SIZE_GET : Constants.SIZE_GET_MAX,+ size: id === protyle.block.rootID ? window.siyuan.config.editor.dynamicLoadBlocks : Constants.SIZE_GET_MAX,}, getResponse => {if (isPushBack) {onGet(getResponse, protyle, id === protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_HTML] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_HTML]);@@ -468,7 +468,7 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushBfetchPost("/api/filetree/getDoc", {id: focusId,mode: 3,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getFocusResponse => {onGet(getFocusResponse, protyle, isPushBack ? [Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO]);});diff --git a/app/src/mobile/editor.ts b/app/src/mobile/editor.tsindex ef68071046..11c9d85807 100644--- a/app/src/mobile/editor.ts+++ b/app/src/mobile/editor.ts@@ -47,7 +47,7 @@ export const openMobileFileById = (id: string, action = [Constants.CB_GET_HL]) =addLoading(window.siyuan.mobileEditor.protyle);fetchPost("/api/filetree/getDoc", {id,- size: action.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,+ size: action.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,mode: action.includes(Constants.CB_GET_CONTEXT) ? 3 : 0,}, getResponse => {onGet(getResponse, window.siyuan.mobileEditor.protyle, action);diff --git a/app/src/mobile/util/MobileBacklinks.ts b/app/src/mobile/util/MobileBacklinks.tsindex e8fcc490c3..8ee8a11f4b 100644--- a/app/src/mobile/util/MobileBacklinks.ts+++ b/app/src/mobile/util/MobileBacklinks.ts@@ -144,7 +144,7 @@ export class MobileBacklinks {if (response.data.refRootID === window.siyuan.mobileEditor.protyle.block.rootID) {fetchPost("/api/filetree/getDoc", {id: window.siyuan.mobileEditor.protyle.block.id,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, window.siyuan.mobileEditor.protyle);});diff --git a/app/src/protyle/breadcrumb/action.ts b/app/src/protyle/breadcrumb/action.tsindex b3660c26b7..38306a26dc 100644--- a/app/src/protyle/breadcrumb/action.ts+++ b/app/src/protyle/breadcrumb/action.ts@@ -21,7 +21,7 @@ export const netImg2LocalAssets = (protyle: IProtyle) => {fetchPost("/api/filetree/getDoc", {id: protyle.block.id,mode: 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_FOCUS], saveScroll(protyle, true));});@@ -31,7 +31,7 @@ export const netImg2LocalAssets = (protyle: IProtyle) => {fetchPost("/api/filetree/getDoc", {id: item.editor.protyle.block.rootID,mode: 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS], saveScroll(protyle, true));});diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.tsindex 76d808ae82..0c46cfd5cf 100644--- a/app/src/protyle/breadcrumb/index.ts+++ b/app/src/protyle/breadcrumb/index.ts@@ -69,7 +69,7 @@ export class Breadcrumb {fetchPost("/api/filetree/getDoc", {id: protyle.options.blockId,mode: 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle);});@@ -78,7 +78,7 @@ export class Breadcrumb {fetchPost("/api/filetree/getDoc", {id: protyle.options.blockId,mode: 3,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_HL]);});@@ -231,7 +231,7 @@ export class Breadcrumb {fetchPost("/api/filetree/getDoc", {id: protyle.block.id,mode: 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_FOCUS], saveScroll(protyle, true));});@@ -241,7 +241,7 @@ export class Breadcrumb {fetchPost("/api/filetree/getDoc", {id: item.editor.protyle.block.rootID,mode: 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, item.editor.protyle, [Constants.CB_GET_FOCUS], saveScroll(protyle, true));});@@ -270,7 +270,7 @@ export class Breadcrumb {fetchPost("/api/filetree/getDoc", {id: protyle.block.showAll ? protyle.block.id : protyle.block.rootID,mode: 0,- size: protyle.block.showAll ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,+ size: protyle.block.showAll ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, protyle.block.showAll ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS], saveScroll(protyle, true), true);});@@ -296,7 +296,7 @@ export class Breadcrumb {protyle.scroll.lastScrollTop = 0;fetchPost("/api/filetree/getDoc", {id: protyle.block.rootID,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle);window.siyuan.menus.menu.remove();diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 3e56393993..87c4d72527 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -99,7 +99,7 @@ export class Protyle {if (this.protyle.block.showAll && data.cmd === "heading2doc" && !this.protyle.options.backlinkData) {fetchPost("/api/filetree/getDoc", {id: this.protyle.block.rootID,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, this.protyle);});@@ -167,7 +167,7 @@ export class Protyle {id: options.blockId,k: options.key || "",mode: (mergedOptions.action && mergedOptions.action.includes(Constants.CB_GET_CONTEXT)) ? 3 : 0, // 0: 仅当前 ID(默认值),1:向上 2:向下,3:上下都加载,4:加载最后- size: mergedOptions.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,+ size: mergedOptions.action?.includes(Constants.CB_GET_ALL) ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, this.protyle, mergedOptions.action, options.scrollAttr);if (this.protyle.model) {diff --git a/app/src/protyle/scroll/event.ts b/app/src/protyle/scroll/event.tsindex 782306833b..10ae75e007 100644--- a/app/src/protyle/scroll/event.ts+++ b/app/src/protyle/scroll/event.ts@@ -82,7 +82,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),mode: 1,k: protyle.options.key || "",- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {protyle.contentElement.style.overflow = "";protyle.contentElement.style.width = "";@@ -97,7 +97,7 @@ export const scrollEvent = (protyle: IProtyle, element: HTMLElement) => {id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),mode: 2,k: protyle.options.key || "",- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);});diff --git a/app/src/protyle/scroll/index.ts b/app/src/protyle/scroll/index.tsindex 7a0bbf1cd4..3c3539091b 100644--- a/app/src/protyle/scroll/index.ts+++ b/app/src/protyle/scroll/index.ts@@ -45,7 +45,7 @@ export class Scroll {index: parseInt(this.inputElement.value),id: protyle.block.parentID,mode: 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_FOCUSFIRST, Constants.CB_GET_UNCHANGEID]);});@@ -59,7 +59,7 @@ export class Scroll {if (protyle.block.showAll) {this.element.classList.add("fn__none");} else {- if (protyle.block.childBlockCount > Constants.SIZE_GET) {+ if (protyle.block.childBlockCount > window.siyuan.config.editor.dynamicLoadBlocks) {this.element.classList.remove("fn__none");} else {this.element.classList.add("fn__none");diff --git a/app/src/protyle/util/editorCommonEvent.ts b/app/src/protyle/util/editorCommonEvent.tsindex 148c1f2458..3e812aa5ef 100644--- a/app/src/protyle/util/editorCommonEvent.ts+++ b/app/src/protyle/util/editorCommonEvent.ts@@ -655,7 +655,7 @@ export const dropEvent = (protyle: IProtyle, editorElement: HTMLElement) => {});fetchPost("/api/filetree/getDoc", {id: protyle.block.id,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle);/// #if !MOBILEdiff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex 2c6dcddd4a..8317407a07 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -272,7 +272,7 @@ const setHTML = (options: {id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),mode: 2,k: protyle.options.key || "",- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);});diff --git a/app/src/protyle/util/reload.ts b/app/src/protyle/util/reload.tsindex ee548aabac..75481051e3 100644--- a/app/src/protyle/util/reload.ts+++ b/app/src/protyle/util/reload.ts@@ -28,7 +28,7 @@ export const reloadProtyle = (protyle: IProtyle) => {fetchPost("/api/filetree/getDoc", {id: protyle.block.showAll ? protyle.block.id : protyle.block.rootID,mode: 0,- size: protyle.block.showAll ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,+ size: protyle.block.showAll ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, protyle.block.showAll ? [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS] : [Constants.CB_GET_FOCUS], saveScroll(protyle, true), true);});diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.tsindex 8a92bd76e5..3e711043d8 100644--- a/app/src/protyle/wysiwyg/index.ts+++ b/app/src/protyle/wysiwyg/index.ts@@ -1212,7 +1212,7 @@ export class WYSIWYG {id: protyle.wysiwyg.element.firstElementChild.getAttribute("data-node-id"),mode: 1,k: protyle.options.key || "",- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {preventGetTopHTML = false;onGet(getResponse, protyle, [Constants.CB_GET_BEFORE, Constants.CB_GET_UNCHANGEID]);diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.tsindex 238212e98a..7348a95701 100644--- a/app/src/protyle/wysiwyg/keydown.ts+++ b/app/src/protyle/wysiwyg/keydown.ts@@ -462,7 +462,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {fetchPost("/api/filetree/getDoc", {id: protyle.block.rootID,mode: 0,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_FOCUS]);});@@ -478,7 +478,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {fetchPost("/api/filetree/getDoc", {id: protyle.block.rootID,mode: 4,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_FOCUS]);});diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.tsindex 0b87788c6a..2dcf4a2186 100644--- a/app/src/protyle/wysiwyg/transaction.ts+++ b/app/src/protyle/wysiwyg/transaction.ts@@ -108,7 +108,7 @@ const promiseTransaction = () => {id: protyle.wysiwyg.element.lastElementChild.getAttribute("data-node-id"),mode: 2,k: protyle.options.key || "",- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle, [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]);});diff --git a/app/src/search/index.ts b/app/src/search/index.tsindex b81680d827..b6c1ece230 100644--- a/app/src/search/index.ts+++ b/app/src/search/index.ts@@ -187,7 +187,7 @@ export class Search extends Model {id,k: value,mode: foldResponse.data ? 0 : 3,- size: foldResponse.data ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,+ size: foldResponse.data ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, this.protyle.protyle, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_HL, Constants.CB_GET_HTML]);const matchElement = this.protyle.protyle.wysiwyg.element.querySelector(`div[data-node-id="${id}"] span[data-type="search-mark"]`);diff --git a/app/src/search/spread.ts b/app/src/search/spread.tsindex 5c1dcf86e1..3c0a4ebf02 100644--- a/app/src/search/spread.ts+++ b/app/src/search/spread.ts@@ -668,7 +668,7 @@ const getArticle = (options: {id: options.id,k: options.k,mode: foldResponse.data ? 0 : 3,- size: foldResponse.data ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,+ size: foldResponse.data ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle.protyle, foldResponse.data ? [Constants.CB_GET_ALL, Constants.CB_GET_HTML] : [Constants.CB_GET_HL, Constants.CB_GET_HTML]);const matchElement = protyle.protyle.wysiwyg.element.querySelector(`div[data-node-id="${options.id}"] span[data-type="search-mark"]`);diff --git a/app/src/util/backForward.ts b/app/src/util/backForward.tsindex b931d8c1fc..6b882dfc61 100644--- a/app/src/util/backForward.ts+++ b/app/src/util/backForward.ts@@ -133,7 +133,7 @@ const focusStack = async (stack: IBackStack) => {fetchPost("/api/filetree/getDoc", {id: stack.id,mode: stack.isZoom ? 0 : 3,- size: stack.isZoom ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,+ size: stack.isZoom ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, stack.protyle, [Constants.CB_GET_HTML]);Array.from(stack.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${stack.id}"]`)).find(item => {@@ -162,7 +162,7 @@ const focusStack = async (stack: IBackStack) => {fetchPost("/api/filetree/getDoc", {id: stack.id, // 忘记为什么要用 rootChildID 了,但用了会产生 https://github.com/siyuan-note/siyuan/issues/6004 问题mode: stack.isZoom ? 0 : 3,- size: stack.isZoom ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,+ size: stack.isZoom ? Constants.SIZE_GET_MAX : window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, stack.protyle, stack.isZoom ? [Constants.CB_GET_HTML, Constants.CB_GET_ALL] : [Constants.CB_GET_HTML]);Array.from(stack.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${stack.id}"]`)).find(item => {diff --git a/app/src/util/globalShortcut.ts b/app/src/util/globalShortcut.tsindex ebb4578142..be9b270794 100644--- a/app/src/util/globalShortcut.ts+++ b/app/src/util/globalShortcut.ts@@ -816,7 +816,7 @@ const editKeydown = (event: KeyboardEvent) => {protyle.scroll.lastScrollTop = 0;fetchPost("/api/filetree/getDoc", {id: protyle.block.parentID,- size: Constants.SIZE_GET,+ size: window.siyuan.config.editor.dynamicLoadBlocks,}, getResponse => {onGet(getResponse, protyle);});