mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 07:45:51 +01:00
refactor(react/collections/calendar): change event handling
This commit is contained in:
@@ -97,8 +97,6 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi
|
||||
|
||||
// Called upon when clicking the day number in the calendar, opens or creates the day note but only if in a calendar root.
|
||||
const onDateClick = useCallback(async (e: DateClickArg) => {
|
||||
if (!isCalendarRoot) return;
|
||||
|
||||
const eventNote = await date_notes.getDayNote(e.dateStr);
|
||||
if (eventNote) {
|
||||
appContext.triggerCommand("openInPopup", { noteIdOrPath: eventNote.noteId });
|
||||
@@ -127,7 +125,7 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi
|
||||
editable={isEditable} selectable={isEditable}
|
||||
select={onCalendarSelection}
|
||||
eventChange={onEventChange}
|
||||
dateClick={onDateClick}
|
||||
dateClick={isCalendarRoot ? onDateClick : undefined}
|
||||
viewDidMount={({ view }) => {
|
||||
if (initialView.current !== view.type) {
|
||||
initialView.current = view.type;
|
||||
|
||||
Reference in New Issue
Block a user