Toggle media bin footer between Select all and Deselect all.

Clear multi-select in one click when any assets are selected.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
digital-garbage
2026-06-11 16:50:05 +03:00
co-authored by Cursor
parent 3d13053149
commit 8408a22bab
+6 -5
View File
@@ -328,13 +328,14 @@
if (total > 0) {
const footer = el("div", "media-bin-footer");
const all = el("button", "btn ghost tiny", `Select all (${total})`);
all.onclick = () => {
mediaSelected.clear();
bin.forEach((m) => mediaSelected.add(m.id));
const hasSelection = selN > 0;
const toggle = el("button", "btn ghost tiny", hasSelection ? `Deselect all (${selN})` : `Select all (${total})`);
toggle.onclick = () => {
if (hasSelection) mediaSelected.clear();
else bin.forEach((m) => mediaSelected.add(m.id));
render(S.get());
};
footer.append(all);
footer.append(toggle);
wrap.append(footer);
}
return wrap;