Skip to content

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

:recycle: https://github.com/siyuan-note/siyuan/issues/9846

Vanessa47b66562a698
diff --git a/app/src/layout/util.ts b/app/src/layout/util.ts
index 7a9a3e13b5..39c620cc7f 100644
--- a/app/src/layout/util.ts
+++ b/app/src/layout/util.ts
@@ -473,7 +473,7 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any) => {
json.blockId = layout.editor.protyle.block.id;
json.rootId = layout.editor.protyle.block.rootID;
json.mode = layout.editor.protyle.preview.element.classList.contains("fn__none") ? "wysiwyg" : "preview";
- json.action = layout.editor.protyle.block.showAll ? Constants.CB_GET_ALL : "";
+ json.action = layout.editor.protyle.block.showAll ? Constants.CB_GET_ALL : Constants.CB_GET_SCROLL;
json.instance = "Editor";
saveScroll(layout.editor.protyle);
} else if (layout instanceof Asset) {
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.ts
index fe2c4f7cb0..5524908110 100644
--- a/app/src/protyle/index.ts
+++ b/app/src/protyle/index.ts
@@ -228,10 +228,15 @@ export class Protyle {
removeLoading(this.protyle);
return;
}
- if (options.rootId) {
+ const filePosition = window.siyuan.storage[Constants.LOCAL_FILEPOSITION][options.blockId] ||
+ window.siyuan.storage[Constants.LOCAL_FILEPOSITION][options.rootId];
+ if (this.protyle.options.mode !== "preview" &&
+ !mergedOptions.action.includes(Constants.CB_GET_ALL) &&
+ (mergedOptions.action.includes(Constants.CB_GET_SCROLL) || mergedOptions.action.includes(Constants.CB_GET_ROOTSCROLL)) &&
+ filePosition) {
getDocByScroll({
protyle: this.protyle,
- scrollAttr: window.siyuan.storage[Constants.LOCAL_FILEPOSITION][options.rootId],
+ scrollAttr: filePosition,
mergedOptions,
cb: () => {
this.afterOnGet(mergedOptions);
diff --git a/app/src/window/openNewWindow.ts b/app/src/window/openNewWindow.ts
index 98bb7df19a..f03a3452f9 100644
--- a/app/src/window/openNewWindow.ts
+++ b/app/src/window/openNewWindow.ts
@@ -53,6 +53,7 @@ export const openNewWindowById = (id: string, options: windowOptions = {}) => {
}
};
if (response.data.rootID === id) {
+ json.children.action = Constants.CB_GET_SCROLL;
/// #if !BROWSER
ipcRenderer.send(Constants.SIYUAN_OPEN_WINDOW, {
position: options.position,