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

Vanessae5d309bf3162
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 8df389d621..eb8f104a90 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -23,7 +23,7 @@ import {
import {mathRender} from "../protyle/render/mathRender";
import {transaction, updateTransaction} from "../protyle/wysiwyg/transaction";
import {openMenu} from "./commonMenuItem";
-import {fetchPost} from "../util/fetch";
+import {fetchPost, fetchSyncPost} from "../util/fetch";
import {Constants} from "../constants";
import {copyPlainText, readText, setStorageVal, updateHotkeyTip, writeText} from "../protyle/util/compatibility";
import {preventScroll} from "../protyle/scroll/preventScroll";
@@ -907,7 +907,7 @@ export const zoomOut = (options: {
fetchPost("/api/filetree/getDoc", {
id: options.id,
size: options.id === options.protyle.block.rootID ? window.siyuan.config.editor.dynamicLoadBlocks : Constants.SIZE_GET_MAX,
- }, getResponse => {
+ }, async (getResponse) => {
if (options.isPushBack) {
onGet({
data: getResponse,
@@ -925,7 +925,11 @@ export const zoomOut = (options: {
}
// https://github.com/siyuan-note/siyuan/issues/4874
if (options.focusId) {
- const focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.focusId}"]`);
+ let focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${options.focusId}"]`);
+ if (!focusElement) {
+ const unfoldResponse = await fetchSyncPost("/api/block/getUnfoldedParentID", {id:options.focusId})
+ focusElement = options.protyle.wysiwyg.element.querySelector(`[data-node-id="${unfoldResponse.data.parentID}"]`);
+ }
if (focusElement) {
// 退出聚焦后块在折叠中 https://github.com/siyuan-note/siyuan/issues/10746
let showElement = focusElement;