mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-07-03 14:09:06 +02:00
This commit is contained in:
@@ -8,6 +8,7 @@ import {setModelsHash} from "../window/setHeader";
|
||||
import {countBlockWord} from "../layout/status";
|
||||
import {App} from "../index";
|
||||
import {fullscreen} from "../protyle/breadcrumb/action";
|
||||
import {fetchPost} from "../util/fetch";
|
||||
|
||||
export class Editor extends Model {
|
||||
public element: HTMLElement;
|
||||
@@ -33,6 +34,8 @@ export class Editor extends Model {
|
||||
this.headElement = options.tab.headElement;
|
||||
this.element = options.tab.panelElement;
|
||||
this.initProtyle(options);
|
||||
// 当文档第一次加载到页签时更新 openAt 时间
|
||||
fetchPost("/api/storage/updateRecentDocOpenTime", {rootID: options.rootId});
|
||||
}
|
||||
|
||||
private initProtyle(options: {
|
||||
|
||||
@@ -488,6 +488,10 @@ export class Wnd {
|
||||
isInitActive = true;
|
||||
} else {
|
||||
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");
|
||||
@@ -556,9 +560,6 @@ export class Wnd {
|
||||
}
|
||||
// focusin 触发前,layout__wnd--active 和 tab 已设置,需在调用里面更新
|
||||
if (update) {
|
||||
// 更新文档浏览时间
|
||||
fetchPost("/api/storage/updateRecentDocViewTime", {rootID: currentTab.model.editor.protyle.block.rootID});
|
||||
|
||||
updatePanelByEditor({
|
||||
protyle: currentTab.model.editor.protyle,
|
||||
focus: true,
|
||||
@@ -637,11 +638,6 @@ export class Wnd {
|
||||
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
|
||||
if (this.parent.type === "center" && this.children.length === 2 && !this.children[0].headElement) {
|
||||
this.removeTab(this.children[0].id);
|
||||
|
||||
Reference in New Issue
Block a user