diff --git a/frontend/src/components/playlist-view/playlist-view.ts b/frontend/src/components/playlist-view/playlist-view.ts index 8ea7fdc..d7710ae 100644 --- a/frontend/src/components/playlist-view/playlist-view.ts +++ b/frontend/src/components/playlist-view/playlist-view.ts @@ -1659,6 +1659,14 @@ export class PlaylistView e.stopPropagation(); this.ctxMenu.close(); + + // If the right-clicked playlist is NOT in the current + // multi-selection, replace the selection with just that one. + if (!this.selectedPlaylists.has(index)) { + this.selectedPlaylists = new Set([index]); + this.lastSelectedPlaylistIndex = index; + } + this.playlistContextMenuIndex = index; this.playlistContextMenuOpen = true; @@ -1696,7 +1704,7 @@ export class PlaylistView } } - private onPlaylistContextAction( + private async onPlaylistContextAction( action: string, ) { const index = @@ -1723,13 +1731,32 @@ export class PlaylistView }, ); break; - case 'delete': - void this.handleDeletePlaylist( - entry.summary.ID, - ); + case 'delete': { + if (this.selectedPlaylists.size > 1) { + const ids = [...this.selectedPlaylists] + .map(i => this.entries[i]) + .filter((e): e is PlaylistEntry => e !== undefined) + .map(e => e.summary.ID); + + for (const id of ids) { + await DeletePlaylist(id); + } + + this.selectedPlaylists = new Set(); + this.lastSelectedPlaylistIndex = null; + await this.refreshPlaylists(); + } else { + await this.handleDeletePlaylist( + entry.summary.ID, + ); + } + break; + } } + this.selectedPlaylists = new Set(); + this.lastSelectedPlaylistIndex = null; this.closePlaylistContextMenu(); } @@ -2311,21 +2338,25 @@ export class PlaylistView
`