From 70477ef64bb6cbcba21c6deddf76b4c34bbacdc3 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 11 Oct 2023 17:58:46 -0400 Subject: [PATCH] deactivate_uploads() hides the window. --- webcit-ng/static/js/upload.js | 8 ++++++++ webcit-ng/static/js/view_mail.js | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/webcit-ng/static/js/upload.js b/webcit-ng/static/js/upload.js index 228e97ace..6dbd92e64 100644 --- a/webcit-ng/static/js/upload.js +++ b/webcit-ng/static/js/upload.js @@ -10,6 +10,12 @@ var uploads_in_progress = 0; var uploads = [] ; // everything the user has uploaded +// Remove the upload window completely (even if it's hidden) +function deactivate_uploads() { + document.getElementById("ctdl-upload").remove(); +} + + // Turn the specified div into a place where we can upload. (Note: permanently changes the drag-and-drop behavior of that div.) function activate_uploads(parent_div) { document.getElementById(parent_div).innerHTML += ` @@ -152,4 +158,6 @@ function flush_uploads() { console.log(u.ref); }); uploads=[]; + + deactivate_uploads(); // this makes the window get destroyed too } diff --git a/webcit-ng/static/js/view_mail.js b/webcit-ng/static/js/view_mail.js index 3071496e8..e015466f2 100644 --- a/webcit-ng/static/js/view_mail.js +++ b/webcit-ng/static/js/view_mail.js @@ -525,7 +525,7 @@ function mail_compose(is_quoted, references, quoted_msgnum, m_to, m_cc, m_subjec document.getElementById("ctdl-compose-cc-field").style.display = "block"; } - activate_uploads("ctdl-compose-mail"); + activate_uploads("ctdl-editor-body"); } // Called when the user clicks the button to make the hidden "CC" and "BCC" lines appear. @@ -553,6 +553,7 @@ function msm_field(element_name, separator) { function mail_send_message() { document.body.style.cursor = "wait"; + deactivate_uploads(); let url = "/ctdl/r/" + escapeHTMLURI(current_room) + "/dummy_name_for_new_mail" + "?wefw=" + msm_field("ctdl_mc_references", "!") // references (if present) -- 2.30.2