fix selection bug

This commit is contained in:
vcoppe
2024-06-12 13:18:15 +02:00
parent 0e9211cb27
commit 812961dcec

View File

@@ -47,7 +47,7 @@
let sortable: Sortable; let sortable: Sortable;
let orientation = getContext<'vertical' | 'horizontal'>('orientation'); let orientation = getContext<'vertical' | 'horizontal'>('orientation');
function updateToSelection() { function updateToSelection(e) {
if (updating) return; if (updating) return;
updating = true; updating = true;
// Sortable updates selection // Sortable updates selection
@@ -61,6 +61,13 @@
element.classList.contains('sortable-selected') element.classList.contains('sortable-selected')
); );
}); });
if ($selection.size > 1 && !(e.ctrlKey || e.metaKey || e.shiftKey)) {
// Fix bug that sometimes causes a single select to be treated as a multi-select
$selection.clear();
$selection.set(item.extend(getRealId(changed[0])), true);
}
return $selection; return $selection;
}); });
} }