Vanessa 2023-12-17 12:17:22 +08:00
parent 97af8f874b
commit 0dde702ba6
5 changed files with 30 additions and 15 deletions

View file

@ -1,5 +1,5 @@
import {Tab} from "./Tab";
import {getInstanceById, newModelByInitData} from "./util";
import {exportLayout, getInstanceById, newModelByInitData} from "./util";
import {getAllModels, getAllTabs} from "./getAll";
import {hideAllElements, hideElements} from "../protyle/ui/hideElements";
import {pdfResize} from "../asset/renderAssets";
@ -84,7 +84,7 @@ export const switchTabByIndex = (index: number) => {
};
let resizeTimeout: number;
export const resizeTabs = () => {
export const resizeTabs = (setLayout = true) => {
clearTimeout(resizeTimeout);
// .layout .fn__flex-shrink {width .15s cubic-bezier(0, 0, .2, 1) 0ms} 时需要再次计算 padding
// PDF 避免分屏多次调用后页码跳转到1 https://github.com/siyuan-note/siyuan/issues/5646
@ -117,6 +117,13 @@ export const resizeTabs = () => {
});
pdfResize();
hideAllElements(["gutter"]);
if (setLayout) {
exportLayout({
reload: false,
onlyData: false,
errorExit: false
});
}
}, 200);
};