This commit is contained in:
parent
5ff968412a
commit
ffc9164e08
4 changed files with 11 additions and 7 deletions
|
@ -403,7 +403,7 @@ export class Wnd {
|
|||
}
|
||||
}
|
||||
|
||||
public switchTab(target: HTMLElement, pushBack = false, update = true, resize = true) {
|
||||
public switchTab(target: HTMLElement, pushBack = false, update = true, resize = true, isSaveLayout = true) {
|
||||
let currentTab: Tab;
|
||||
this.children.forEach((item) => {
|
||||
if (target === item.headElement) {
|
||||
|
@ -431,7 +431,9 @@ export class Wnd {
|
|||
if (initData) {
|
||||
currentTab.addModel(newModelByInitData(this.app, currentTab, JSON.parse(initData)));
|
||||
currentTab.headElement.removeAttribute("data-initdata");
|
||||
saveLayout();
|
||||
if (isSaveLayout) {
|
||||
saveLayout();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -492,7 +494,9 @@ export class Wnd {
|
|||
resize,
|
||||
});
|
||||
}
|
||||
saveLayout();
|
||||
if (isSaveLayout) {
|
||||
saveLayout();
|
||||
}
|
||||
}
|
||||
|
||||
public addTab(tab: Tab, keepCursor = false, isSaveLayout = true) {
|
||||
|
|
|
@ -365,8 +365,8 @@ export class Dock {
|
|||
if ((type === "graph" || type === "globalGraph") && this.layout.element.querySelector(".fullscreen")) {
|
||||
document.getElementById("drag")?.classList.remove("fn__hidden");
|
||||
}
|
||||
// 关闭 dock 后设置光标
|
||||
if (!document.querySelector(".layout__center .layout__wnd--active")) {
|
||||
// 关闭 dock 后设置光标,初始化的时候不能设置,否则关闭文档树且多页签时会请求两次 getDoc
|
||||
if (saveLayout && !document.querySelector(".layout__center .layout__wnd--active")) {
|
||||
const currentElement = document.querySelector(".layout__center ul.layout-tab-bar .item--focus");
|
||||
if (currentElement) {
|
||||
getAllTabs().find(item => {
|
||||
|
|
|
@ -474,7 +474,7 @@ export const JSONToLayout = (app: App, isStart: boolean) => {
|
|||
document.querySelectorAll('li[data-type="tab-header"][data-init-active="true"]').forEach((item: HTMLElement) => {
|
||||
item.removeAttribute("data-init-active");
|
||||
const tab = getInstanceById(item.getAttribute("data-id")) as Tab;
|
||||
tab.parent.switchTab(item, false, false);
|
||||
tab.parent.switchTab(item, false, false, true, false);
|
||||
});
|
||||
}
|
||||
resizeTopBar();
|
||||
|
|
|
@ -247,7 +247,7 @@ const setHTML = (options: {
|
|||
onGet({data: getResponse, protyle, action: [Constants.CB_GET_APPEND, Constants.CB_GET_UNCHANGEID]});
|
||||
});
|
||||
}
|
||||
if (options.scrollAttr && !protyle.scroll.element.classList.contains("fn__none")) {
|
||||
if (options.scrollAttr && !protyle.scroll.element.classList.contains("fn__none") && !protyle.element.classList.contains("fn__none")) {
|
||||
// 使用动态滚动条定位到最后一个块,重启后无法触发滚动事件,需要再次更新 index
|
||||
protyle.scroll.updateIndex(protyle, options.scrollAttr.startId);
|
||||
// https://github.com/siyuan-note/siyuan/issues/8224
|
||||
|
|
Loading…
Add table
Reference in a new issue