fix when switching between writing and reading
authorPhiTux <redacted>
Thu, 25 Sep 2025 17:59:57 +0000 (19:59 +0200)
committerPhiTux <redacted>
Thu, 25 Sep 2025 17:59:57 +0000 (19:59 +0200)
frontend/src/lib/Datepicker.svelte
frontend/src/routes/(authed)/write/+page.svelte

index 173585018894006b74b91554e0ffc152576721c7..96fb60d816a5d7bce262737afee028f9de8b7edf 100644 (file)
@@ -1,5 +1,6 @@
 <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}
index 459dabeab7deea370e40b07e3752dbcdd2706bac..2c9cfb1bee415a965f59f8b6c3d118368e91ea37 100644 (file)
 
        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: '' });
git clone https://git.99rst.org/PROJECT