An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:zap: https://github.com/siyuan-note/siyuan/issues/10028
Vanessa45bfec7d2fd4
diff --git a/app/src/layout/Wnd.ts b/app/src/layout/Wnd.tsindex c26a060e75..49d293b32f 100644--- a/app/src/layout/Wnd.ts+++ b/app/src/layout/Wnd.ts@@ -700,10 +700,11 @@ export class Wnd {clearCounter();this.children.find((item, index) => {if (item.id === id) {- if (item.model instanceof Custom) {- if (item.model.beforeDestroy) {- item.model.beforeDestroy();- }+ if (item.model instanceof Custom && item.model.beforeDestroy) {+ item.model.beforeDestroy();+ }+ if (item.model instanceof Editor) {+ saveScroll(item.model.editor.protyle);}if (this.children.length === 1) {this.destroyModel(this.children[0].model);@@ -771,7 +772,7 @@ export class Wnd {item.panelElement.remove();this.destroyModel(item.model);this.children.splice(index, 1);- resizeTabs(item.headElement ? true : false);+ resizeTabs(false);return true;}});@@ -791,6 +792,7 @@ export class Wnd {setTitle(window.siyuan.languages.siyuanNote);}}+ saveLayout();/// #if !BROWSERwebFrame.clearCache();ipcRenderer.send(Constants.SIYUAN_CMD, "clearCache");diff --git a/app/src/layout/index.ts b/app/src/layout/index.tsindex 3b2593917a..cf7512ddef 100644--- a/app/src/layout/index.ts+++ b/app/src/layout/index.ts@@ -96,6 +96,7 @@ export class Layout {});}addResize(child);+ resizeTabs(false);// https://ld246.com/article/1669858316295if (this.direction === "tb") {child.element.style.minHeight = "64px";diff --git a/app/src/layout/util.ts b/app/src/layout/util.tsindex ee5f66515c..cf0fe5890b 100644--- a/app/src/layout/util.ts+++ b/app/src/layout/util.ts@@ -205,7 +205,7 @@ export const saveLayout = () => {saveCount++;setTimeout(() => {saveLayout();- }, Constants.TIMEOUT_LOAD);+ }, Constants.TIMEOUT_LOAD * saveCount);} else {saveCount = 0;if (isWindow()) {diff --git a/app/src/protyle/scroll/saveScroll.ts b/app/src/protyle/scroll/saveScroll.tsindex 2cb7c4c85a..8aa5a87381 100644--- a/app/src/protyle/scroll/saveScroll.ts+++ b/app/src/protyle/scroll/saveScroll.ts@@ -6,7 +6,7 @@ import {Constants} from "../../constants";import {setStorageVal} from "../util/compatibility";export const saveScroll = (protyle: IProtyle, getObject = false) => {- if (!protyle.wysiwyg.element.firstElementChild || window.siyuan.config.readonly || protyle.element.classList.contains("fn__none")) {+ if (!protyle.wysiwyg.element.firstElementChild || window.siyuan.config.readonly) {// 报错或者空白页面return undefined;}diff --git a/app/src/protyle/util/onGet.ts b/app/src/protyle/util/onGet.tsindex 18fafd90b0..8da1def18a 100644--- a/app/src/protyle/util/onGet.ts+++ b/app/src/protyle/util/onGet.ts@@ -398,8 +398,8 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScrif (action.includes(Constants.CB_GET_FOCUS) || action.includes(Constants.CB_GET_HL) || action.includes(Constants.CB_GET_FOCUSFIRST)) {const contentRect = protyle.contentElement.getBoundingClientRect();const focusRect = focusElement.getBoundingClientRect();- if (contentRect.top > focusRect.top || contentRect.bottom < focusRect.bottom) {- scrollCenter(protyle, focusElement, !hasScrollTop);+ if (!hasScrollTop && (contentRect.top > focusRect.top || contentRect.bottom < focusRect.bottom)) {+ scrollCenter(protyle, focusElement, true);}} else {protyle.observerLoad?.disconnect();@@ -413,8 +413,8 @@ const focusElementById = (protyle: IProtyle, action: string[], scrollAttr?: IScrif (action.includes(Constants.CB_GET_FOCUS) || action.includes(Constants.CB_GET_HL) || action.includes(Constants.CB_GET_FOCUSFIRST)) {const contentRect = protyle.contentElement.getBoundingClientRect();const focusRect = focusElement.getBoundingClientRect();- if (contentRect.top > focusRect.top || contentRect.bottom < focusRect.bottom) {- scrollCenter(protyle, focusElement, !hasScrollTop);+ if (!hasScrollTop && (contentRect.top > focusRect.top || contentRect.bottom < focusRect.bottom)) {+ scrollCenter(protyle, focusElement, true);}}});