From 61bc821754654ab2e3f97f24c341052d9cd73d13 Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 1 Aug 2025 21:56:20 +0800 Subject: [PATCH] :art: https://github.com/siyuan-note/siyuan/issues/15340 --- app/src/boot/globalEvent/keydown.ts | 14 ++++++++++---- app/src/protyle/breadcrumb/index.ts | 10 +++++++--- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.ts index cc0a811e3..e1692a8e6 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 8a2f99d8a..f117f29be 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();