Event search (Ctrl+F), locale/RTL handling, weekday selector workday/weekend, refactored event handling, Firefox compatibility #3

Merged
LeoVasanko merged 17 commits from vol003 into main 2025-08-27 13:41:46 +01:00
5 changed files with 13 additions and 10 deletions
Showing only changes of commit 3ef8368130 - Show all commits

View File

@ -1,12 +1,6 @@
<!doctype html>
<html lang="en">
<head>
<script type="module" src="/src/main.js"></script>
<meta charset="utf-8">
<title>Calendar</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
</head>
<body>
<div id="app"></div>
<script type="module" src="/src/main.js"></script>
</body>
</html>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<div id="app"></div>

View File

@ -3,6 +3,7 @@ import { ref, onMounted, onBeforeUnmount } from 'vue'
import CalendarView from './components/CalendarView.vue'
import EventDialog from './components/EventDialog.vue'
import { useCalendarStore } from './stores/CalendarStore'
import { lang } from './utils/locale'
const eventDialog = ref(null)
const calendarStore = useCalendarStore()
@ -35,6 +36,8 @@ function handleGlobalKey(e) {
onMounted(() => {
calendarStore.initializeHolidaysFromConfig()
document.addEventListener('keydown', handleGlobalKey, { passive: false })
// Set document language via shared util
if (lang) document.documentElement.setAttribute('lang', lang)
})
onBeforeUnmount(() => {

View File

@ -13,6 +13,7 @@ import { daysInclusive, addDaysStr, MIN_YEAR, MAX_YEAR } from '@/utils/date'
import { toLocalString, fromLocalString, DEFAULT_TZ } from '@/utils/date'
import { addDays, differenceInWeeks } from 'date-fns'
import { createVirtualWeekManager } from '@/plugins/virtualWeeks'
import { rtl } from '@/utils/locale'
const calendarStore = useCalendarStore()
const emit = defineEmits(['create-event', 'edit-event'])
@ -433,7 +434,7 @@ window.addEventListener('resize', () => {
</script>
<template>
<div class="calendar-view-root">
<div class="calendar-view-root" :dir="rtl && 'rtl'">
<div ref="rowProbe" class="row-height-probe" aria-hidden="true"></div>
<div class="wrap">
<HeaderControls @go-to-today="goToToday" />

View File

@ -4,6 +4,7 @@
v-for="span in eventSpans"
:key="span.id"
class="event-span"
dir="auto"
:class="[`event-color-${span.colorId}`]"
:data-id="span.id"
:data-n="span._recurrenceIndex != null ? span._recurrenceIndex : 0"

4
src/utils/locale.js Normal file
View File

@ -0,0 +1,4 @@
export const lang = navigator.language
const rtlLangs = new Set(['ar', 'fa', 'he', 'iw', 'ur', 'ps', 'sd', 'ug', 'dv', 'ku', 'yi'])
const primary = lang.toLowerCase().split(/[-_]/)[0]
export const rtl = rtlLangs.has(primary)