Improves all-day drag-and-drop conversion

Refactors drag-to-all-day functionality to apply CSS styling and reposition the existing drag clone within the all-day container, rather than creating a new event element.

Centralizes all-day container creation in HeaderManager. Introduces `drag:mouseleave-header` to handle transitions from all-day back to timed events.

Ensures consistent styling and robust cleanup of drag clones for a smoother user experience.
This commit is contained in:
Janus C. H. Knudsen 2025-09-21 21:30:51 +02:00
parent 2cdbc8f1a3
commit c682c30e23
6 changed files with 181 additions and 121 deletions

View file

@ -260,6 +260,7 @@ export class DragDropManager {
// Clean up drag state first
this.cleanupDragState();
// Only emit drag:end if drag was actually started
if (isDragStarted) {
@ -286,6 +287,9 @@ export class DragDropManager {
target: dropTarget
};
this.eventBus.emit('drag:end', dragEndPayload);
draggedElement.remove();
} else {
// This was just a click - emit click event instead
this.eventBus.emit('event:click', {
@ -295,6 +299,12 @@ export class DragDropManager {
}
}
}
// Add a cleanup method that finds and removes ALL clones
private cleanupAllClones(): void {
// Remove clones from all possible locations
const allClones = document.querySelectorAll('[data-event-id^="clone"]');
allClones.forEach(clone => clone.remove());
}
/**
* Consolidated position calculation method using PositionUtils