This commit is contained in:
parent
3169afbee8
commit
e99c6a1600
3 changed files with 9 additions and 5 deletions
|
@ -508,7 +508,7 @@ export class Wnd {
|
|||
}
|
||||
}
|
||||
|
||||
public addTab(tab: Tab, keepCursor = false, isSaveLayout = true) {
|
||||
public addTab(tab: Tab, keepCursor = false, isSaveLayout = true, activeTime?: string) {
|
||||
if (keepCursor) {
|
||||
tab.headElement?.classList.remove("item--focus");
|
||||
tab.panelElement.classList.add("fn__none");
|
||||
|
@ -548,8 +548,7 @@ export class Wnd {
|
|||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
});
|
||||
|
||||
tab.headElement.setAttribute("data-activetime", (new Date()).getTime().toString());
|
||||
tab.headElement.setAttribute("data-activetime", activeTime || (new Date()).getTime().toString());
|
||||
}
|
||||
const containerElement = this.element.querySelector(".layout-tab-container");
|
||||
if (!containerElement.querySelector(".fn__flex-1")) {
|
||||
|
|
|
@ -366,7 +366,7 @@ export const JSONToCenter = (
|
|||
if (json.active && child.headElement) {
|
||||
child.headElement.setAttribute("data-init-active", "true");
|
||||
}
|
||||
(layout as Wnd).addTab(child, false, false);
|
||||
(layout as Wnd).addTab(child, false, false, json.activeTime);
|
||||
(layout as Wnd).showHeading();
|
||||
} else if (json.instance === "Editor" && json.blockId) {
|
||||
if (window.siyuan.config.fileTree.openFilesUseCurrentTab) {
|
||||
|
@ -548,6 +548,7 @@ export const layoutToJSON = (layout: Layout | Wnd | Tab | Model, json: any, brea
|
|||
}
|
||||
}
|
||||
json.instance = "Tab";
|
||||
json.activeTime = layout.headElement.getAttribute("data-activetime");
|
||||
} else if (layout instanceof Editor) {
|
||||
if (!layout.editor.protyle.notebookId && breakObj) {
|
||||
breakObj.editor = "true";
|
||||
|
|
6
app/src/types/config.d.ts
vendored
6
app/src/types/config.d.ts
vendored
|
@ -1774,6 +1774,10 @@ declare namespace Config {
|
|||
* Tab title
|
||||
*/
|
||||
title?: string;
|
||||
/**
|
||||
* Tab recent view time
|
||||
*/
|
||||
activeTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2292,4 +2296,4 @@ declare namespace Config {
|
|||
*/
|
||||
export type TUILayoutType = "normal" | "center" | "top" | "bottom" | "left" | "right";
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue