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