Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/16402

Vanessa8a70820cc57c
diff --git a/app/src/editor/util.ts b/app/src/editor/util.ts
index 60215fec97..694bc7b08b 100644
--- a/app/src/editor/util.ts
+++ b/app/src/editor/util.ts
@@ -388,11 +388,12 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
highlightById(editor.editor.protyle, options.id, "start");
} else if (options.action?.includes(Constants.CB_GET_FOCUS)) {
if (nodeElement) {
- const newRange = focusBlock(nodeElement, undefined, !options.action?.includes(Constants.CB_GET_OUTLINE));
+ const isFromOutline = options.action?.includes(Constants.CB_GET_OUTLINE);
+ const newRange = focusBlock(nodeElement, undefined, !isFromOutline);
if (newRange) {
editor.editor.protyle.toolbar.range = newRange;
}
- scrollCenter(editor.editor.protyle, editor.editor.protyle.disabled ? nodeElement : null);
+ scrollCenter(editor.editor.protyle, (editor.editor.protyle.disabled || isFromOutline) ? nodeElement : null, isFromOutline ? "start" : "nearest");
editor.editor.protyle.observerLoad = new ResizeObserver(() => {
if (document.contains(nodeElement)) {
scrollCenter(editor.editor.protyle);