mirror of
https://github.com/zadam/trilium.git
synced 2025-11-18 06:24:30 +01:00
calendar: Lock calendar initialDate using label
This commit is contained in:
parent
40568ac547
commit
d0de9e5e21
@ -6,7 +6,7 @@ import "./index.css";
|
|||||||
import { useNoteLabel, useNoteLabelBoolean, useResizeObserver, useSpacedUpdate, useTriliumEvent, useTriliumOption, useTriliumOptionInt } from "../../react/hooks";
|
import { useNoteLabel, useNoteLabelBoolean, useResizeObserver, useSpacedUpdate, useTriliumEvent, useTriliumOption, useTriliumOptionInt } from "../../react/hooks";
|
||||||
import { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons";
|
import { DISPLAYABLE_LOCALE_IDS } from "@triliumnext/commons";
|
||||||
import { Calendar as FullCalendar } from "@fullcalendar/core";
|
import { Calendar as FullCalendar } from "@fullcalendar/core";
|
||||||
import { parseStartEndDateFromEvent, parseStartEndTimeFromEvent } from "./utils";
|
import { parseStartEndDateFromEvent, parseStartEndTimeFromEvent, getCustomisableLabel } from "./utils";
|
||||||
import dialog from "../../../services/dialog";
|
import dialog from "../../../services/dialog";
|
||||||
import { t } from "../../../services/i18n";
|
import { t } from "../../../services/i18n";
|
||||||
import { buildEvents, buildEventsForCalendar } from "./event_builder";
|
import { buildEvents, buildEventsForCalendar } from "./event_builder";
|
||||||
@ -91,6 +91,7 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi
|
|||||||
const [ hideWeekends ] = useNoteLabelBoolean(note, "calendar:hideWeekends");
|
const [ hideWeekends ] = useNoteLabelBoolean(note, "calendar:hideWeekends");
|
||||||
const [ weekNumbers ] = useNoteLabelBoolean(note, "calendar:weekNumbers");
|
const [ weekNumbers ] = useNoteLabelBoolean(note, "calendar:weekNumbers");
|
||||||
const [ calendarView, setCalendarView ] = useNoteLabel(note, "calendar:view");
|
const [ calendarView, setCalendarView ] = useNoteLabel(note, "calendar:view");
|
||||||
|
const initialDate = getCustomisableLabel(note, "initialDate", "calendar:initialDate");
|
||||||
const initialView = useRef(calendarView);
|
const initialView = useRef(calendarView);
|
||||||
const viewSpacedUpdate = useSpacedUpdate(() => setCalendarView(initialView.current));
|
const viewSpacedUpdate = useSpacedUpdate(() => setCalendarView(initialView.current));
|
||||||
useResizeObserver(containerRef, () => calendarRef.current?.updateSize());
|
useResizeObserver(containerRef, () => calendarRef.current?.updateSize());
|
||||||
@ -134,6 +135,7 @@ export default function CalendarView({ note, noteIds }: ViewModeProps<CalendarVi
|
|||||||
height="90%"
|
height="90%"
|
||||||
nowIndicator
|
nowIndicator
|
||||||
handleWindowResize={false}
|
handleWindowResize={false}
|
||||||
|
{ ...(initialDate ? {initialDate: initialDate} : undefined)}
|
||||||
locale={locale}
|
locale={locale}
|
||||||
{...editingProps}
|
{...editingProps}
|
||||||
eventDidMount={eventDidMount}
|
eventDidMount={eventDidMount}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user