Vanessa 2025-08-01 21:56:20 +08:00
parent b126d34dde
commit 61bc821754
2 changed files with 17 additions and 7 deletions

View file

@ -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;
}

View file

@ -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();