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/16641
Vanessa29569e007548
diff --git a/app/src/editor/util.ts b/app/src/editor/util.tsindex 9b851c0d29..ad9d2c7e0b 100644--- a/app/src/editor/util.ts+++ b/app/src/editor/util.ts@@ -398,19 +398,29 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod}if (options.action?.includes(Constants.CB_GET_FOCUS)) {if (nodeElement) {+ let scrollTop: number;if (options.action.includes(Constants.CB_GET_SEARCH)) {const scrollAttr = window.siyuan.storage[Constants.LOCAL_FILEPOSITION][editor.editor.protyle.block.rootID];focusByOffset(nodeElement, scrollAttr.focusStart, scrollAttr.focusEnd);+ scrollTop = scrollAttr.scrollTop;} else {const newRange = focusBlock(nodeElement, undefined, !options.action?.includes(Constants.CB_GET_OUTLINE));if (newRange) {editor.editor.protyle.toolbar.range = newRange;}}- scrollCenter(editor.editor.protyle, (editor.editor.protyle.disabled || options.scrollPosition) ? nodeElement : null, options.scrollPosition);+ if (typeof scrollTop === "number") {+ editor.editor.protyle.contentElement.scrollTop = scrollTop;+ } else {+ scrollCenter(editor.editor.protyle, (editor.editor.protyle.disabled || options.scrollPosition) ? nodeElement : null, options.scrollPosition);+ }editor.editor.protyle.observerLoad = new ResizeObserver(() => {if (document.contains(nodeElement)) {- scrollCenter(editor.editor.protyle, (editor.editor.protyle.disabled || options.scrollPosition) ? nodeElement : null, options.scrollPosition);+ if (typeof scrollTop === "number") {+ editor.editor.protyle.contentElement.scrollTop = scrollTop;+ } else {+ scrollCenter(editor.editor.protyle, (editor.editor.protyle.disabled || options.scrollPosition) ? nodeElement : null, options.scrollPosition);+ }}});setTimeout(() => {diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex 6774c43912..dc1cf3e08e 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -940,7 +940,8 @@ export const openSearchEditor = (options: {focusId: options.id,focusStart: offset.start,focusEnd: offset.end,- zoomInId: options.protyle.block.showAll ? options.protyle.block.id : undefined+ zoomInId: options.protyle.block.showAll ? options.protyle.block.id : undefined,+ scrollTop: options.protyle.contentElement.scrollTop,};window.siyuan.storage[Constants.LOCAL_FILEPOSITION][options.protyle.block.rootID] = scrollAttr;if (offset.start === offset.end) {