mirror of
https://github.com/zadam/trilium.git
synced 2026-01-03 13:14:24 +01:00
chore(window): initialize closed time of openNoteContents to 0
This commit is contained in:
parent
9c9e123e3d
commit
1078107776
@ -60,7 +60,7 @@ export default class TabManager extends Component {
|
||||
savedWindows.push({
|
||||
windowId: appContext.windowId,
|
||||
createdAt: Date.now(),
|
||||
closedAt: null,
|
||||
closedAt: 0,
|
||||
contexts: openNoteContexts
|
||||
});
|
||||
}
|
||||
@ -154,7 +154,7 @@ export default class TabManager extends Component {
|
||||
savedWindows.push({
|
||||
windowId: appContext.windowId,
|
||||
createdAt: Date.now(),
|
||||
closedAt: null,
|
||||
closedAt: 0,
|
||||
contexts: filteredNoteContexts
|
||||
});
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ export default () => {
|
||||
{
|
||||
windowId: "main",
|
||||
createdAt: 0,
|
||||
closedAt: null,
|
||||
closedAt: 0,
|
||||
contexts: parsed
|
||||
}
|
||||
];
|
||||
|
||||
@ -47,7 +47,7 @@ async function initNotSyncedOptions(initialized: boolean, opts: NotSyncedOpts =
|
||||
{
|
||||
windowId: "main",
|
||||
createdAt: 0,
|
||||
closedAt: null,
|
||||
closedAt: 0,
|
||||
contexts: [
|
||||
{
|
||||
notePath: "root",
|
||||
@ -266,7 +266,7 @@ function initStartupOptions() {
|
||||
{
|
||||
windowId: "main",
|
||||
createdAt: 0,
|
||||
closedAt: null,
|
||||
closedAt: 0,
|
||||
contexts: [
|
||||
{
|
||||
notePath: process.env.TRILIUM_START_NOTE_ID || "root",
|
||||
|
||||
@ -149,7 +149,7 @@ async function createInitialDatabase(skipDemoDb?: boolean) {
|
||||
{
|
||||
windowId: "main",
|
||||
createdAt: 0,
|
||||
closedAt: null,
|
||||
closedAt: 0,
|
||||
contexts: [
|
||||
{
|
||||
notePath: startNoteId,
|
||||
|
||||
@ -201,15 +201,9 @@ function updateTrayMenu() {
|
||||
const openedWindowIds = windowService.getAllWindowIds();
|
||||
const closedWindows = savedWindows
|
||||
.filter(win => !openedWindowIds.includes(win.windowId))
|
||||
.sort((a, b) => {
|
||||
// If closedAt is null, it indicates an abnormal closure and should be placed at the end
|
||||
if (a.closedAt === null && b.closedAt === null) return 0;
|
||||
if (a.closedAt === null) return 1;
|
||||
if (b.closedAt === null) return -1;
|
||||
// Otherwise, sort by time in descending order
|
||||
return b.closedAt - a.closedAt;
|
||||
});
|
||||
.sort((a, b) => { return b.closedAt - a.closedAt; }); // sort by time in descending order
|
||||
const menuItems: Electron.MenuItemConstructorOptions[] = [];
|
||||
|
||||
for (const win of closedWindows) {
|
||||
const activeCtx = win.contexts.find(c => c.active === true);
|
||||
const activateNotePath = (activeCtx ?? win.contexts[0])?.notePath;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user