mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-22 09:30:14 +01:00
This commit is contained in:
parent
6e415879ee
commit
5ec6b314a9
2 changed files with 7 additions and 8 deletions
|
|
@ -8,6 +8,7 @@ import {setModelsHash} from "../window/setHeader";
|
||||||
import {countBlockWord} from "../layout/status";
|
import {countBlockWord} from "../layout/status";
|
||||||
import {App} from "../index";
|
import {App} from "../index";
|
||||||
import {fullscreen} from "../protyle/breadcrumb/action";
|
import {fullscreen} from "../protyle/breadcrumb/action";
|
||||||
|
import {fetchPost} from "../util/fetch";
|
||||||
|
|
||||||
export class Editor extends Model {
|
export class Editor extends Model {
|
||||||
public element: HTMLElement;
|
public element: HTMLElement;
|
||||||
|
|
@ -33,6 +34,8 @@ export class Editor extends Model {
|
||||||
this.headElement = options.tab.headElement;
|
this.headElement = options.tab.headElement;
|
||||||
this.element = options.tab.panelElement;
|
this.element = options.tab.panelElement;
|
||||||
this.initProtyle(options);
|
this.initProtyle(options);
|
||||||
|
// 当文档第一次加载到页签时更新 openAt 时间
|
||||||
|
fetchPost("/api/storage/updateRecentDocOpenTime", {rootID: options.rootId});
|
||||||
}
|
}
|
||||||
|
|
||||||
private initProtyle(options: {
|
private initProtyle(options: {
|
||||||
|
|
|
||||||
|
|
@ -488,6 +488,10 @@ export class Wnd {
|
||||||
isInitActive = true;
|
isInitActive = true;
|
||||||
} else {
|
} else {
|
||||||
item.headElement.setAttribute("data-activetime", (new Date()).getTime().toString());
|
item.headElement.setAttribute("data-activetime", (new Date()).getTime().toString());
|
||||||
|
// 更新文档浏览时间
|
||||||
|
if (currentTab.model instanceof Editor) {
|
||||||
|
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: currentTab.model.editor.protyle.block.rootID});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
item.panelElement.classList.remove("fn__none");
|
item.panelElement.classList.remove("fn__none");
|
||||||
|
|
@ -556,9 +560,6 @@ export class Wnd {
|
||||||
}
|
}
|
||||||
// focusin 触发前,layout__wnd--active 和 tab 已设置,需在调用里面更新
|
// focusin 触发前,layout__wnd--active 和 tab 已设置,需在调用里面更新
|
||||||
if (update) {
|
if (update) {
|
||||||
// 更新文档浏览时间
|
|
||||||
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: currentTab.model.editor.protyle.block.rootID});
|
|
||||||
|
|
||||||
updatePanelByEditor({
|
updatePanelByEditor({
|
||||||
protyle: currentTab.model.editor.protyle,
|
protyle: currentTab.model.editor.protyle,
|
||||||
focus: true,
|
focus: true,
|
||||||
|
|
@ -637,11 +638,6 @@ export class Wnd {
|
||||||
tab.callback(tab);
|
tab.callback(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 当文档第一次加载到页签时更新 openAt 时间
|
|
||||||
if (tab.model instanceof Editor && tab.model.editor?.protyle?.block?.rootID) {
|
|
||||||
fetchPost("/api/storage/updateRecentDocOpenTime", {rootID: tab.model.editor.protyle.block.rootID});
|
|
||||||
}
|
|
||||||
|
|
||||||
// 移除 centerLayout 中的 empty
|
// 移除 centerLayout 中的 empty
|
||||||
if (this.parent.type === "center" && this.children.length === 2 && !this.children[0].headElement) {
|
if (this.parent.type === "center" && this.children.length === 2 && !this.children[0].headElement) {
|
||||||
this.removeTab(this.children[0].id);
|
this.removeTab(this.children[0].id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue