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/15340

Vanessa61bc82175465
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts
index cc0a811e32..e1692a8e6c 100644
--- a/app/src/boot/globalEvent/keydown.ts
+++ b/app/src/boot/globalEvent/keydown.ts
@@ -16,7 +16,7 @@ import {
import {newFile} from "../../util/newFile";
import {Constants} from "../../constants";
import {openSetting} from "../../config";
-import {getInstanceById} from "../../layout/util";
+import {getInstanceById, saveLayout} from "../../layout/util";
import {getActiveTab, getDockByType, switchTabByIndex} from "../../layout/tabUtil";
import {Tab} from "../../layout/Tab";
import {Editor} from "../../editor";
@@ -490,6 +490,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.preview.custom, event)) {
setEditMode(protyle, "preview");
+ saveLayout();
event.preventDefault();
return true;
}
@@ -497,11 +498,16 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
setEditMode(protyle, "wysiwyg");
protyle.scroll.lastScrollTop = 0;
fetchPost("/api/filetree/getDoc", {
- id: protyle.block.parentID,
- size: window.siyuan.config.editor.dynamicLoadBlocks,
+ id: protyle.block.id,
+ size: protyle.block.id === protyle.block.rootID ? window.siyuan.config.editor.dynamicLoadBlocks : Constants.SIZE_GET_MAX,
}, getResponse => {
- onGet({data: getResponse, protyle});
+ onGet({
+ data: getResponse,
+ protyle,
+ action: protyle.block.id === protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_HTML, Constants.CB_GET_UNUNDO] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO, Constants.CB_GET_HTML]
+ });
});
+ saveLayout();
event.preventDefault();
return true;
}
diff --git a/app/src/protyle/breadcrumb/index.ts b/app/src/protyle/breadcrumb/index.ts
index 8a2f99d8a3..f117f29bef 100644
--- a/app/src/protyle/breadcrumb/index.ts
+++ b/app/src/protyle/breadcrumb/index.ts
@@ -444,10 +444,14 @@ ${padHTML}
setEditMode(protyle, "wysiwyg");
protyle.scroll.lastScrollTop = 0;
fetchPost("/api/filetree/getDoc", {
- id: protyle.block.parentID,
- size: window.siyuan.config.editor.dynamicLoadBlocks,
+ id: protyle.block.id,
+ size: protyle.block.id === protyle.block.rootID ? window.siyuan.config.editor.dynamicLoadBlocks : Constants.SIZE_GET_MAX,
}, getResponse => {
- onGet({data: getResponse, protyle});
+ onGet({
+ data: getResponse,
+ protyle,
+ action: protyle.block.id === protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_HTML, Constants.CB_GET_UNUNDO] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO, Constants.CB_GET_HTML]
+ });
});
/// #if !MOBILE
saveLayout();