fix: prevent stacked reorder mode from multiple 'Neu anordnen' clicks

Added _reorderCtx.active flag — plReorderEnter bails early if already
active, preventing duplicate handles and event listeners from stacking.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-19 19:54:36 +02:00
1 parent 92edaa9da4
commit 96e3cb0451
1 file changed
+3 -1
+3 -1
View File
@@ -587,7 +587,8 @@ function _setupReorderMode(container, songs, pl) {
} }
export function plReorderEnter() { export function plReorderEnter() {
if (!_reorderCtx) return; if (!_reorderCtx || _reorderCtx.active) return;
_reorderCtx.active = true;
const { container, songs } = _reorderCtx; const { container, songs } = _reorderCtx;
container.classList.add('pl-draggable'); container.classList.add('pl-draggable');
// Block context-menu (long-press) on all items while reordering. // Block context-menu (long-press) on all items while reordering.
@@ -684,6 +685,7 @@ export function plReorderCancel() { _exitReorderMode(false); }
function _exitReorderMode(save) { function _exitReorderMode(save) {
if (!_reorderCtx) return; if (!_reorderCtx) return;
const { container, songs, pl } = _reorderCtx; const { container, songs, pl } = _reorderCtx;
_reorderCtx.active = false;
container.classList.remove('pl-draggable'); container.classList.remove('pl-draggable');
container.removeEventListener('contextmenu', _blockCtxMenu, true); container.removeEventListener('contextmenu', _blockCtxMenu, true);
container.querySelectorAll('.pl-drag-handle').forEach(h => h.remove()); container.querySelectorAll('.pl-drag-handle').forEach(h => h.remove());