<script>
import { cal, selectedDate, readingDate } from '$lib/calendarStore.js';
+ import { readingMode } from '$lib/settingsStore.js';
import { onMount } from 'svelte';
import { fly } from 'svelte/transition';
import * as bootstrap from 'bootstrap';
{$cal.daysWithLogs.includes(day.day) ? 'mark-background' : ''}
{$cal.daysWithFiles.includes(day.day) ? 'mark-dot' : ''}
{$cal.daysBookmarked.includes(day.day) ? 'mark-circle' : ''}
- {(!$readingDate && sameDate($selectedDate, day)) || sameDate($readingDate, day) ? 'selected' : ''}"
+ {(!$readingMode && sameDate($selectedDate, day)) || ($readingMode && sameDate($readingDate, day))
+ ? 'selected'
+ : ''}"
onclick={() => onDateClick(day)}
>
{day.day}
let tinyMDE;
onMount(() => {
+ // If we come from read mode, keep the last visible day as the active selected day
+ if ($readingDate) {
+ $selectedDate = $readingDate; // promote readingDate to selectedDate when switching to write mode
+ }
$readingDate = null; // no reading-highlighting when in write mode
tinyMDE = new TinyMDE.Editor({ element: 'editor', content: '' });