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.
|
// 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) => {
|
const onDateClick = useCallback(async (e: DateClickArg) => {
|
||||||
if (!isCalendarRoot) return;
|
|
||||||
|
|
||||||
const eventNote = await date_notes.getDayNote(e.dateStr);
|
const eventNote = await date_notes.getDayNote(e.dateStr);
|
||||||
if (eventNote) {
|
if (eventNote) {
|
||||||
appContext.triggerCommand("openInPopup", { noteIdOrPath: eventNote.noteId });
|
appContext.triggerCommand("openInPopup", { noteIdOrPath: eventNote.noteId });
|
||||||
@@ -127,7 +125,7 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi
|
|||||||
editable={isEditable} selectable={isEditable}
|
editable={isEditable} selectable={isEditable}
|
||||||
select={onCalendarSelection}
|
select={onCalendarSelection}
|
||||||
eventChange={onEventChange}
|
eventChange={onEventChange}
|
||||||
dateClick={onDateClick}
|
dateClick={isCalendarRoot ? onDateClick : undefined}
|
||||||
viewDidMount={({ view }) => {
|
viewDidMount={({ view }) => {
|
||||||
if (initialView.current !== view.type) {
|
if (initialView.current !== view.type) {
|
||||||
initialView.current = view.type;
|
initialView.current = view.type;
|
||||||
|
|||||||
Reference in New Issue
Block a user