Improves drag and drop functionality and fixes issues
Refactors drag and drop logic to dynamically find the dragged element, ensuring correct behavior even when the DOM changes during the drag operation. Creates all-day container if it doesn't exist. This resolves issues where drag and drop operations would fail if the original element was no longer present in the DOM or if the container didn't exist.
This commit is contained in:
parent
7054c0d40a
commit
9cdf4fbe96
4 changed files with 58 additions and 19 deletions
|
|
@ -13,13 +13,20 @@ export class AllDayEventRenderer {
|
|||
}
|
||||
|
||||
/**
|
||||
* Get or cache all-day container
|
||||
* Get or cache all-day container, create if it doesn't exist
|
||||
*/
|
||||
private getContainer(): HTMLElement | null {
|
||||
if (!this.container) {
|
||||
const header = document.querySelector('swp-calendar-header');
|
||||
if (header) {
|
||||
// Try to find existing container
|
||||
this.container = header.querySelector('swp-allday-container');
|
||||
|
||||
// If not found, create it
|
||||
if (!this.container) {
|
||||
this.container = document.createElement('swp-allday-container');
|
||||
header.appendChild(this.container);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.container;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue