Skip to content

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

:bug: fix https://github.com/siyuan-note/siyuan/issues/6004

Vanessa284d78bc27e6
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index f8e162c928..99df660784 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -409,9 +409,9 @@ export const zoomOut = (protyle: IProtyle, id: string, focusId?: string, isPushB
size: id === protyle.block.rootID ? Constants.SIZE_GET : Constants.SIZE_GET_MAX,
}, getResponse => {
if (isPushBack) {
- onGet(getResponse, protyle, id === protyle.block.rootID ? [Constants.CB_GET_FOCUS] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS]);
+ onGet(getResponse, protyle, id === protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_HTML] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_HTML]);
} else {
- onGet(getResponse, protyle, id === protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_UNUNDO]);
+ onGet(getResponse, protyle, 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]);
}
// https://github.com/siyuan-note/siyuan/issues/4874
if (focusId) {
diff --git a/app/src/util/backForward.ts b/app/src/util/backForward.ts
index 2d64dbd5c2..0557943196 100644
--- a/app/src/util/backForward.ts
+++ b/app/src/util/backForward.ts
@@ -48,7 +48,7 @@ const focusStack = async (stack: IBackStack) => {
callback(tab) {
const editor = new Editor({
tab,
- blockId: info.data.rootChildID,
+ blockId: stack.id, // 忘记为什么要用 rootChildID 了,但用了会产生 https://github.com/siyuan-note/siyuan/issues/6004 问题
});
tab.addModel(editor);
}
@@ -159,18 +159,12 @@ const focusStack = async (stack: IBackStack) => {
}
return false;
}
- const info = await fetchSyncPost("/api/block/getBlockInfo", {id: stack.id});
- if (info.code === 2) {
- // 文件被锁定
- lockFile(info.data);
- return false;
- }
fetchPost("/api/filetree/getDoc", {
- id: info.data.rootChildID,
+ id: stack.id, // 忘记为什么要用 rootChildID 了,但用了会产生 https://github.com/siyuan-note/siyuan/issues/6004 问题
mode: stack.isZoom ? 0 : 3,
size: stack.isZoom ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
}, getResponse => {
- onGet(getResponse, stack.protyle, [Constants.CB_GET_HTML]);
+ onGet(getResponse, stack.protyle, stack.isZoom ? [Constants.CB_GET_HTML, Constants.CB_GET_ALL] : [Constants.CB_GET_HTML]);
Array.from(stack.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${stack.id}"]`)).find(item => {
if (!hasClosestByAttribute(item, "data-type", "NodeBlockQueryEmbed")) {
blockElement = item;
@@ -270,7 +264,7 @@ export const pushBack = (protyle: IProtyle, range?: Range, blockElement?: Elemen
const position = getSelectionOffset(editElement, undefined, range);
const id = blockElement.getAttribute("data-node-id") || protyle.block.rootID;
const lastStack = window.siyuan.backStack[window.siyuan.backStack.length - 1];
- const isZoom = protyle.block.id !== protyle.block.rootID;
+ const isZoom = protyle.block.showAll;
if (lastStack && lastStack.id === id && lastStack.isZoom === isZoom) {
lastStack.position = position;
} else {