Don't let user close browser window if they have unsaved changes (vibe-kanban) (#538)

* Perfect! The implementation is complete and passes all checks. 

## Summary

Added browser window close protection to prevent data loss when users have unsaved changes in the task dialog:

- **Added `beforeunload` event listener** in [`TaskFormDialog.tsx`](file:///private/var/folders/m1/9q_ct1913z10v6wbnv54j25r0000gn/T/vibe-kanban/worktrees/vk-f59b-don-t-let/frontend/src/components/tasks/TaskFormDialog.tsx#L95-L111)
- **Integrates with existing `hasUnsavedChanges()` logic** - no duplication
- **Only active when dialog is open AND has unsaved content** 
- **Automatic cleanup** when dialog closes or changes are saved
- **Browser-standard confirmation dialog** appears when user tries to close tab/window

The feature now protects against data loss from both dialog close (existing) and browser window close (new) scenarios.

* Cleanup script changes for task attempt f59bea00-6158-4cdd-ad19-1f30e40c1324

* Perfect! Now the browser window close protection works for both scenarios:

## Updated Implementation

**Create mode:** Warns when user has entered title or description content
**Edit mode:** Warns when user has modified title, description, or status from original values

The `beforeunload` event will now trigger when:
- **Creating a task** and typing content, then trying to close browser
- **Editing a task** and changing any field, then trying to close browser

Both the existing dialog close warning and new browser window close warning now protect against data loss in all editing scenarios.

* Cleanup script changes for task attempt f59bea00-6158-4cdd-ad19-1f30e40c1324
This commit is contained in:
Louis Knight-Webb
2025-08-20 15:44:38 +01:00
committed by GitHub
parent e99f9807fb
commit 6fb7b939d9
2 changed files with 29 additions and 4 deletions

View File

@@ -229,7 +229,7 @@ impl ImageService {
let rel = &caps[2];
let abs = worktree_path.join(rel);
let abs = abs.to_string_lossy().replace('\\', "/");
format!("![{}]({})", alt, abs)
format!("![{alt}]({abs})")
})
.into_owned()
}