mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-29 11:02:28 +08:00
feat(views/calendar): click to go to day note
This commit is contained in:
parent
5c1db3cab2
commit
43f79ca813
@ -10,6 +10,8 @@ import dialogService from "../../services/dialog.js";
|
|||||||
import attributes from "../../services/attributes.js";
|
import attributes from "../../services/attributes.js";
|
||||||
import type { EventData } from "../../components/app_context.js";
|
import type { EventData } from "../../components/app_context.js";
|
||||||
import utils from "../../services/utils.js";
|
import utils from "../../services/utils.js";
|
||||||
|
import date_notes from "../../services/date_notes.js";
|
||||||
|
import appContext from "../../components/app_context.js";
|
||||||
|
|
||||||
const TPL = `
|
const TPL = `
|
||||||
<div class="calendar-view">
|
<div class="calendar-view">
|
||||||
@ -91,8 +93,7 @@ export default class CalendarView extends ViewMode {
|
|||||||
const { Calendar } = await import("@fullcalendar/core");
|
const { Calendar } = await import("@fullcalendar/core");
|
||||||
const plugins: PluginDef[] = [];
|
const plugins: PluginDef[] = [];
|
||||||
plugins.push((await import("@fullcalendar/daygrid")).default);
|
plugins.push((await import("@fullcalendar/daygrid")).default);
|
||||||
|
if (isEditable || this.isCalendarRoot) {
|
||||||
if (isEditable) {
|
|
||||||
plugins.push((await import("@fullcalendar/interaction")).default);
|
plugins.push((await import("@fullcalendar/interaction")).default);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,7 +120,17 @@ export default class CalendarView extends ViewMode {
|
|||||||
|
|
||||||
html += utils.escapeHtml(e.event.title);
|
html += utils.escapeHtml(e.event.title);
|
||||||
return { html };
|
return { html };
|
||||||
})
|
}),
|
||||||
|
dateClick: async (e) => {
|
||||||
|
if (!this.isCalendarRoot) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const note = await date_notes.getDayNote(e.dateStr);
|
||||||
|
if (note) {
|
||||||
|
appContext.tabManager.getActiveContext().setNote(note.noteId);
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
calendar.render();
|
calendar.render();
|
||||||
this.calendar = calendar;
|
this.calendar = calendar;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user