Vanessa 2024-11-03 11:44:19 +08:00
parent b3bc642e07
commit e11ba33f4c

View file

@ -912,14 +912,14 @@ export const zoomOut = (options: {
data: getResponse,
protyle: options.protyle,
action: options.id === options.protyle.block.rootID ? [Constants.CB_GET_FOCUS, Constants.CB_GET_HTML] : [Constants.CB_GET_ALL, Constants.CB_GET_FOCUS, Constants.CB_GET_HTML],
afterCB: options.callback
afterCB: options.callback,
});
} else {
onGet({
data: getResponse,
protyle: options.protyle,
action: options.id === options.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],
afterCB: options.callback
afterCB: options.callback,
});
}
// https://github.com/siyuan-note/siyuan/issues/4874
@ -938,7 +938,13 @@ export const zoomOut = (options: {
showElement = getFirstBlock(showElement);
}
focusBlock(showElement);
showElement.scrollIntoView();
const resizeObserver = new ResizeObserver(() => {
showElement.scrollIntoView();
});
resizeObserver.observe(options.protyle.wysiwyg.element);
setTimeout(() => {
resizeObserver.disconnect();
}, 1000 * 3);
} else if (options.id === options.protyle.block.rootID) { // 聚焦返回后,该块是动态加载的,但是没加载出来
fetchPost("/api/filetree/getDoc", {
id: options.focusId,