Skip to content

Commit

Permalink
Update client-src\digitize\index.js: Fix #262
Browse files Browse the repository at this point in the history
  • Loading branch information
mhhd2020 committed Jul 10, 2023
1 parent fda97ac commit bb0673a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions client-src/digitize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,17 @@ document.forms.namedItem("upload").onsubmit = () => {
setDisabled("submitBtn", true);
setIsBusy("submitBtn", true);
};

// In case the page is newly loaded, reset the upload button, the spinner, and the upload field.
// This prevents unexpected behaviour when clicking the back button after an upload.
window.addEventListener("pageshow", () => {
setDisabled("submitBtn", true);
setIsBusy("submitBtn", false);

// Remove all previously selected files. The used file selector (filebokz) seems not to
// provide a working solution to remove all selected files at once.
const removeButtons = document.getElementsByClassName("remove");
for (let i = removeButtons.length - 1; i >= 0; i--) {
removeButtons[i].click();
}
});

0 comments on commit bb0673a

Please sign in to comment.