diff --git a/CHANGELOG.md b/CHANGELOG.md
index ea003c7d..2401da7a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
Version 3.1.0 - ??/??/2025
- Added Google Gemini API support [#204, #2174].
+ - Added {%mail_typed_text%} data placeholder to get the text inserted before the quoted mail body when replying [#196].
- Added an info text about using the new {%tags_full_list%} placeholder in the "Add Tags Prompt" page [#215].
- ...
@@ -15,8 +16,8 @@
- [ChatGPT API][Ollama API][OpenAI Comp API] Added a special prompt to apply tags to emails [#183].
- Default prompts text has been translated [#185].
- - Data placeholder {%tags_full_list%} for the full available tags list added [#197].
- - Data placeholder {%tags_current_email%} for the single mail tags list added [#198].
+ - Added {%tags_full_list%} data placeholder for the full available tags list added [#197].
+ - Added {%tags_current_email%} data placeholder for the single mail tags list added [#198].
- User survey link added [#202].
- [OpenAI Comp API] Added a button in the options page to manually insert the model [#205].
- Polish (pl) translation added, thanks to neexpl.
diff --git a/_locales/en/messages.json b/_locales/en/messages.json
index 6ec714b5..da85f92e 100644
--- a/_locales/en/messages.json
+++ b/_locales/en/messages.json
@@ -950,5 +950,9 @@
"prefs_OptionText_btnManagePrompts_infoline3": {
"message": "You can use the {%tags_full_list%} data placeholder in the prompt to list the available tags. With an appropriate prompt, you could then force the tags to be chosen only from the list of those already existing.",
"description": ""
+ },
+ "placeholder_mail_typed_text": {
+ "message": "Typed text before the quoted mail body",
+ "description": ""
}
}
\ No newline at end of file
diff --git a/js/mzta-compose-script.js b/js/mzta-compose-script.js
index 28ade65a..ba63e625 100644
--- a/js/mzta-compose-script.js
+++ b/js/mzta-compose-script.js
@@ -39,7 +39,7 @@ switch (message.command) {
return Promise.resolve(true);
break;
- case "getText":
+ case "getText": {
let t = '';
const children = window.document.body.childNodes;
for (const node of children) {
@@ -51,6 +51,7 @@ switch (message.command) {
t += node.textContent;
}
return Promise.resolve(t);
+ }
case "getTextOnly":
return Promise.resolve(window.document.body.innerText);
@@ -58,6 +59,21 @@ switch (message.command) {
case "getFullHtml":
return Promise.resolve(window.document.body.innerHTML);
+ case "getOnlyTypedText": {
+ // TODO: add support for moz-cite-prefix
+ let t = '';
+ const children = window.document.body.childNodes;
+ for (const node of children) {
+ if (node instanceof Element) {
+ if (node.classList.contains('moz-cite-prefix')) {
+ break;
+ }
+ }
+ t += node.textContent;
+ }
+ return Promise.resolve(t);
+ }
+
case 'sendAlert':
//console.log(">>>>>> message.curr_tab_type: " + JSON.stringify(message.curr_tab_type));
if(message.curr_tab_type == 'mail'){ // workaround for Thunderbird bug not showing the alert
diff --git a/js/mzta-menus.js b/js/mzta-menus.js
index cbb251ad..e21a101b 100644
--- a/js/mzta-menus.js
+++ b/js/mzta-menus.js
@@ -82,6 +82,7 @@ export class mzta_Menus {
selection: await browser.tabs.sendMessage(tabs[0].id, { command: "getSelectedText" }),
text: await browser.tabs.sendMessage(tabs[0].id, { command: "getTextOnly" }),
html: await browser.tabs.sendMessage(tabs[0].id, { command: "getFullHtml" }),
+ only_typed_text: await browser.tabs.sendMessage(tabs[0].id, { command: "getOnlyTypedText" })
};
};
@@ -99,8 +100,10 @@ export class mzta_Menus {
let body_text = '';
let selection_text = '';
+ let only_typed_text = '';
selection_text = msg_text.selection.replace(/\s+/g, ' ').trim();
body_text = msg_text.text.replace(/\s+/g, ' ').trim();
+ only_typed_text = msg_text.only_typed_text.replace(/\s+/g, ' ').trim();
//open chatgpt window
//console.log("Click menu item...");
let chatgpt_lang = '';
@@ -150,6 +153,9 @@ export class mzta_Menus {
case 'mail_html_body':
finalSubs['mail_html_body'] = msg_text.html;
break;
+ case 'mail_typed_text':
+ finalSubs['mail_typed_text'] = only_typed_text;
+ break;
case 'mail_subject':
let mail_subject = await getMailSubject(tabs[0]);
finalSubs['mail_subject'] = mail_subject;
diff --git a/js/mzta-placeholders.js b/js/mzta-placeholders.js
index 194f2be9..36795227 100644
--- a/js/mzta-placeholders.js
+++ b/js/mzta-placeholders.js
@@ -47,6 +47,13 @@ const defaultPlaceholders = [
type: 0,
is_default: "1",
},
+ {
+ id: 'mail_typed_text',
+ name: "__MSG_placeholder_mail_typed_text__",
+ default_value: "",
+ type: 2,
+ is_default: "1",
+ },
{
id: 'mail_subject',
name: "__MSG_placeholder_mail_subject__",
diff --git a/options/mzta-release-notes.html b/options/mzta-release-notes.html
index 1f3ee74f..40a9b6cd 100644
--- a/options/mzta-release-notes.html
+++ b/options/mzta-release-notes.html
@@ -10,6 +10,7 @@
Version 3.1.0 - ??/??/2025
- Added Google Gemini API support [#204, #2174].
+ - Added {%mail_typed_text%} data placeholder to get the text inserted before the quoted mail body when replying [#196].
- Added an info text about using the new {%tags_full_list%} placeholder in the "Add Tags Prompt" page [#215].
- ...
@@ -17,8 +18,8 @@
- [ChatGPT API][Ollama API][OpenAI Comp API] Added a special prompt to apply tags to emails [#183].
- Default prompts text has been translated [#185].
- - Data placeholder {%tags_full_list%} for the full available tags list added [#197].
- - Data placeholder {%tags_current_email%} for the single mail tags list added [#198].
+ - Added {%tags_full_list%} data placeholder for the full available tags list added [#197].
+ - Added {%tags_current_email%} data placeholder for the single mail tags list added [#198].
- User survey link added [#202].
- Polish (pl) translation added, thanks to neexpl.
- [OpenAI Comp API] Added a button in the options page to manually insert the model [#205].