From 7c1bb4db61823ae386ca5f219722244095f04915 Mon Sep 17 00:00:00 2001 From: mic Date: Tue, 10 Dec 2024 23:33:27 +0100 Subject: [PATCH] closing the popup after calling the menu action, wating fro the message reponse. --- popup/mzta-popup.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/popup/mzta-popup.js b/popup/mzta-popup.js index 87f7fafd..82a5ad7b 100644 --- a/popup/mzta-popup.js +++ b/popup/mzta-popup.js @@ -246,11 +246,15 @@ document.body.insertBefore(banner, document.body.firstChild); } -function sendPrompt(prompt_id, tabId){ +async function sendPrompt(prompt_id, tabId){ taLog.log("sendPrompt: " + prompt_id); document.getElementById('mzta_search_input').style.display = 'none'; document.getElementById('mzta_sending_prompt').style.display = 'block'; - browser.runtime.sendMessage({command: "shortcut_do_prompt", tabId: tabId, promptId: prompt_id}); + let response = await browser.runtime.sendMessage({command: "shortcut_do_prompt", tabId: tabId, promptId: prompt_id}); + console.log(">>>>>>>>>>>>>>>>> response: " + JSON.stringify(response)); + if(response.ok == '1'){ + window.close(); + } } function filterPromptsForTab(prompts_data, filtering){