Skip to content

Commit

Permalink
Merge pull request #1137 from DDMAL/trash-bin
Browse files Browse the repository at this point in the history
Disable delete & open button if nothing selected
  • Loading branch information
yinanazhou authored Nov 15, 2023
2 parents a2d5c92 + 2733126 commit 931269c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Dashboard/Dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,8 @@ function shiftSelectionHandler(index) {
* If a folder and file(s) are selected, opens file(s).
*/
function handleOpenDocuments() {
if (!openButton.classList.contains('active')) return;

// Open folder if only one folder is selected
if (state.getSelectedFolders().length === 1) {
const newPath = [...state.getFolderPath(), state.getSelectedEntries()[0] as IFolder];
Expand All @@ -310,6 +312,8 @@ function handleOpenDocuments() {
* If a folder and file(s) are selected, deletes all.
*/
function handleDeleteDocuments() {
if (!deleteButton.classList.contains('active')) return;

function deleteFileEntry(file: IFile): Promise<boolean> {
return new Promise((resolve, reject) => {
deleteDocument(file.id)
Expand Down

0 comments on commit 931269c

Please sign in to comment.