a "do_reply" from the compose window is changed in a "substitute text". see #353
This commit is contained in:
parent
a14a153079
commit
d49e6d65e7
2 changed files with 7 additions and 1 deletions
|
|
@ -232,6 +232,9 @@ class MessagesArea extends HTMLElement {
|
|||
const fullTextHTMLAtAssignment = this.fullTextHTML.trim().replace(/^"|"$/g, '').replace(/^<p>"/, '<p>').replace(/"<\/p>$/, '</p>'); // strip quotation marks
|
||||
//console.log(">>>>>>>>>>>> fullTextHTMLAtAssignment: " + fullTextHTMLAtAssignment);
|
||||
actionButton.addEventListener('click', async () => {
|
||||
if(promptData.mailMessageId == -1) { // we are using the reply from the compose window!
|
||||
promptData.action = "2"; // replace text
|
||||
}
|
||||
switch(promptData.action) {
|
||||
case "1": // do reply
|
||||
// console.log("[ThunderAI] (do reply) fullTextHTMLAtAssignment: " + fullTextHTMLAtAssignment);
|
||||
|
|
@ -239,7 +242,7 @@ class MessagesArea extends HTMLElement {
|
|||
browser.runtime.sendMessage({command: "chatgpt_close", window_id: (await browser.windows.getCurrent()).id});
|
||||
break;
|
||||
case "2": // replace text
|
||||
// console.log("[ThunderAI] (replace text) fullTextHTMLAtAssignment: " + fullTextHTMLAtAssignment);
|
||||
console.log("[ThunderAI] (replace text) fullTextHTMLAtAssignment: " + fullTextHTMLAtAssignment);
|
||||
await browser.runtime.sendMessage({command: "chatgpt_replaceSelectedText", text: fullTextHTMLAtAssignment, tabId: promptData.tabId, mailMessageId: promptData.mailMessageId});
|
||||
browser.runtime.sendMessage({command: "chatgpt_close", window_id: (await browser.windows.getCurrent()).id});
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -647,6 +647,9 @@ browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|||
current_message = message;
|
||||
current_tabId = message.tabId;
|
||||
current_mailMessageId = message.mailMessageId;
|
||||
if(current_mailMessageId == -1) { // we are using the reply from the compose window!
|
||||
current_action = '2'; // replace text
|
||||
}
|
||||
run();
|
||||
break;
|
||||
case "chatgpt_alive":
|
||||
|
|
|
|||
Loading…
Reference in a new issue