From 9ddfbeaeda3a3625963cb55515c0ef8955fb527a Mon Sep 17 00:00:00 2001 From: mic Date: Sun, 13 Apr 2025 08:16:02 +0200 Subject: [PATCH] Fix selection text handling in menu actions to ensure proper text assignment when using mail_typed_text placeholder --- js/mzta-menus.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/mzta-menus.js b/js/mzta-menus.js index f5c1620a..0166b89b 100644 --- a/js/mzta-menus.js +++ b/js/mzta-menus.js @@ -105,11 +105,16 @@ export class mzta_Menus { let body_text = ''; let selection_text = ''; let only_typed_text = ''; + only_typed_text = msg_text.only_typed_text.replace(/\s+/g, ' ').trim(); selection_text = msg_text.selection.replace(/\s+/g, ' ').trim(); + if(selection_text === ''){ + if(placeholdersUtils.hasPlaceholder(curr_prompt.text, "mail_typed_text")){ + selection_text = only_typed_text; + } + } curr_prompt.selection_text = selection_text; body_text = msg_text.text.replace(/\s+/g, ' ').trim(); curr_prompt.body_text = body_text; - only_typed_text = msg_text.only_typed_text.replace(/\s+/g, ' ').trim(); //open chatgpt window //console.log("Click menu item..."); let chatgpt_lang = await taPromptUtils.getDefaultLang(curr_prompt);