This commit is contained in:
Vanessa 2022-09-28 23:48:59 +08:00
parent 4d0290783b
commit 284d78bc27
2 changed files with 6 additions and 12 deletions

View file

@ -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, size: id === protyle.block.rootID ? Constants.SIZE_GET : Constants.SIZE_GET_MAX,
}, getResponse => { }, getResponse => {
if (isPushBack) { 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 { } 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 // https://github.com/siyuan-note/siyuan/issues/4874
if (focusId) { if (focusId) {

View file

@ -48,7 +48,7 @@ const focusStack = async (stack: IBackStack) => {
callback(tab) { callback(tab) {
const editor = new Editor({ const editor = new Editor({
tab, tab,
blockId: info.data.rootChildID, blockId: stack.id, // 忘记为什么要用 rootChildID 了,但用了会产生 https://github.com/siyuan-note/siyuan/issues/6004 问题
}); });
tab.addModel(editor); tab.addModel(editor);
} }
@ -159,18 +159,12 @@ const focusStack = async (stack: IBackStack) => {
} }
return false; 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", { 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, mode: stack.isZoom ? 0 : 3,
size: stack.isZoom ? Constants.SIZE_GET_MAX : Constants.SIZE_GET, size: stack.isZoom ? Constants.SIZE_GET_MAX : Constants.SIZE_GET,
}, getResponse => { }, 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 => { Array.from(stack.protyle.wysiwyg.element.querySelectorAll(`[data-node-id="${stack.id}"]`)).find(item => {
if (!hasClosestByAttribute(item, "data-type", "NodeBlockQueryEmbed")) { if (!hasClosestByAttribute(item, "data-type", "NodeBlockQueryEmbed")) {
blockElement = item; blockElement = item;
@ -270,7 +264,7 @@ export const pushBack = (protyle: IProtyle, range?: Range, blockElement?: Elemen
const position = getSelectionOffset(editElement, undefined, range); const position = getSelectionOffset(editElement, undefined, range);
const id = blockElement.getAttribute("data-node-id") || protyle.block.rootID; const id = blockElement.getAttribute("data-node-id") || protyle.block.rootID;
const lastStack = window.siyuan.backStack[window.siyuan.backStack.length - 1]; 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) { if (lastStack && lastStack.id === id && lastStack.isZoom === isZoom) {
lastStack.position = position; lastStack.position = position;
} else { } else {