refactor: consolidate task move event handling

Removed redundant emitTaskMovedEvent function to streamline task event emissions. Now emitting a generalized 'taskChanged' event for task movements, ensuring consistent event handling and reducing code duplication.
This commit is contained in:
Kumi 2024-07-31 08:55:55 +02:00
parent 41d544be7e
commit 41a5d0ba5e
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -249,7 +249,6 @@ class Kanblendar {
if (dropTarget.classList.contains('kanblendar-time-slot') || dropTarget.classList.contains('kanblendar-non-timed-tasks')) { if (dropTarget.classList.contains('kanblendar-time-slot') || dropTarget.classList.contains('kanblendar-non-timed-tasks')) {
dropTarget.appendChild(task); dropTarget.appendChild(task);
this.emitTaskMovedEvent(task, dropTarget);
this.emitTaskChangedEvent('move', task); this.emitTaskChangedEvent('move', task);
} }
@ -441,16 +440,6 @@ class Kanblendar {
} }
} }
emitTaskMovedEvent(task, target) {
const event = new CustomEvent('taskMoved', {
detail: {
taskId: task.id,
newParent: target.id
}
});
document.dispatchEvent(event);
}
adjustTimeSlotHeights() { adjustTimeSlotHeights() {
const timeSlotMap = new Map(); const timeSlotMap = new Map();
let maxNonTimedHeight = 0; let maxNonTimedHeight = 0;