Native iCloud apps for Windows and Linux, built in Rust. Notes, Reminders, Calendar, Contacts, Drive and Photos, offline and in sync with your iPhone.
Rust apple-notesapple-reminderscloudkitcrdtdesktop-appicloudicloud-calendaricloud-driveicloud-notesicloud-photosiphonelinuxlinux-desktoplocal-firstoffline-firstprivacyrusttauritauri-appwindows
Calendar: Delete deletes the open event, as in Calendar
Yashwanth Kamireddic5c3f2ff47ee
diff --git a/.uiverify/calendar.mjs b/.uiverify/calendar.mjsindex d9aeeb9..796c3aa 100644--- a/.uiverify/calendar.mjs+++ b/.uiverify/calendar.mjs@@ -261,6 +261,17 @@ ok(/Sep/.test(title) && /Oct/.test(title), `a week across two months is named fo});ok(notice?.text === "iCloud didn't accept that change, so nothing was saved." && notice.dismiss,"a refused delete says so in a sentence, with Dismiss", `the notice: ${JSON.stringify(notice)}`);+ // Delete, pressed with an event open and no field in use, deletes it — as in Calendar.+ if (notice?.dismiss) {+ await p.getByRole("button", { name: "Dismiss" }).click();+ await p.locator(".cx-block", { hasText: "New Event" }).first().click();+ await p.waitForTimeout(250);+ await p.evaluate(() => document.activeElement?.blur());+ await p.keyboard.press("Delete");+ await p.waitForTimeout(300);+ ok((await p.locator('[role="alert"]').count()) === 1, "Delete deletes an open event, as in Calendar",+ "Delete did nothing to the open event");+ }if (notice?.dismiss) {await p.getByRole("button", { name: "Dismiss" }).click();await p.waitForTimeout(150);diff --git a/src/screens/calendar/CalendarView.tsx b/src/screens/calendar/CalendarView.tsxindex db553de..76bd095 100644--- a/src/screens/calendar/CalendarView.tsx+++ b/src/screens/calendar/CalendarView.tsx@@ -1455,7 +1455,16 @@ function EventPopover({}, [at]);useEffect(() => {- const onKey = (e: KeyboardEvent) => e.key === "Escape" && onClose();+ const onKey = (e: KeyboardEvent) => {+ if (e.key === "Escape") return onClose();+ // Delete, as in Calendar: an open event goes when Delete is pressed outside its fields —+ // and Undo brings it back, since iCloud keeps no bin.+ const typing = (e.target as HTMLElement | null)?.closest("input, textarea, select, [contenteditable]");+ if ((e.key === "Delete" || e.key === "Backspace") && !typing && onDelete && editable) {+ e.preventDefault();+ onDelete();+ }+ };const onDown = (e: MouseEvent) => {if (box.current && !box.current.contains(e.target as Node)) onClose();};@@ -1465,7 +1474,7 @@ function EventPopover({window.removeEventListener("keydown", onKey);window.removeEventListener("mousedown", onDown);};- }, [onClose]);+ }, [onClose, onDelete, editable]);const set = (patch: Partial<Draft>) => onChange({ ...draft, ...patch });return (