using add_tags_first_uppercase option. see #183
This commit is contained in:
parent
6c823f7992
commit
c33378d3be
4 changed files with 28 additions and 5 deletions
|
|
@ -850,5 +850,17 @@
|
||||||
"thunderai_warning_title": {
|
"thunderai_warning_title": {
|
||||||
"message": "ThunderAI Warning",
|
"message": "ThunderAI Warning",
|
||||||
"description": ""
|
"description": ""
|
||||||
|
},
|
||||||
|
"prefs_OptionText_add_tags_first_uppercase": {
|
||||||
|
"message": "First letter uppercase",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"prefs_OptionText_add_tags_first_uppercase_Info": {
|
||||||
|
"message": "If checked, the tags label will be set to lowercase letters with only the first letter uppercase.",
|
||||||
|
"description": ""
|
||||||
|
},
|
||||||
|
"AddTags_prompt_prefs_title": {
|
||||||
|
"message": "Add Tags Options",
|
||||||
|
"description": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -218,7 +218,7 @@ export class mzta_Menus {
|
||||||
this.logger.log("fullPrompt: " + fullPrompt);
|
this.logger.log("fullPrompt: " + fullPrompt);
|
||||||
// TODO: use the current API, abort if using chatgpt web
|
// TODO: use the current API, abort if using chatgpt web
|
||||||
// COMMENTED TO DO TESTS
|
// COMMENTED TO DO TESTS
|
||||||
mail_tags = "recipients, test, home, work, car, light";
|
mail_tags = "recipients, test, home, work, CAR, light";
|
||||||
// let cmd_addTags = new mzta_specialCommand_AddTags(fullPrompt,prefs_at.connection_type,true);
|
// let cmd_addTags = new mzta_specialCommand_AddTags(fullPrompt,prefs_at.connection_type,true);
|
||||||
// await cmd_addTags.initWorker();
|
// await cmd_addTags.initWorker();
|
||||||
// try{
|
// try{
|
||||||
|
|
|
||||||
|
|
@ -199,11 +199,13 @@ export async function getTagsList(){
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createTag(tag) {
|
export async function createTag(tag) {
|
||||||
|
let prefs_tag = await browser.storage.sync.get({add_tags_first_uppercase: true});
|
||||||
|
if(prefs_tag.add_tags_first_uppercase) tag = tag.toLowerCase().charAt(0).toUpperCase() + tag.toLowerCase().slice(1);
|
||||||
try {
|
try {
|
||||||
if(await isThunderbird128OrGreater()) {
|
if(await isThunderbird128OrGreater()) {
|
||||||
return browser.messages.tags.create('ta-'+tag, tag, generateHexColorForTag());
|
return browser.messages.tags.create('ta-'+tag.toLowerCase(), tag, generateHexColorForTag());
|
||||||
}else{
|
}else{
|
||||||
return browser.messages.createTag('ta-'+tag, tag, generateHexColorForTag());
|
return browser.messages.createTag('ta-'+tag.toLowerCase(), tag, generateHexColorForTag());
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[ThunderAI] Error creating tag:', error);
|
console.error('[ThunderAI] Error creating tag:', error);
|
||||||
|
|
@ -212,7 +214,7 @@ export async function createTag(tag) {
|
||||||
|
|
||||||
export async function assignTagToMessage(messageId, tag) {
|
export async function assignTagToMessage(messageId, tag) {
|
||||||
try {
|
try {
|
||||||
return browser.messages.update(messageId, {tags: ["ta-"+tag]});
|
return browser.messages.update(messageId, {tags: ["ta-"+tag.toLowerCase()]});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('[ThunderAI] Error assigning tag [messageId: ', messageId, ' - tag: ', tag, ']:', error);
|
console.error('[ThunderAI] Error assigning tag [messageId: ', messageId, ' - tag: ', tag, ']:', error);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
<h1 class="page_title">__MSG_AddTags_PageTitle__</h1>
|
<h1 class="page_title">__MSG_AddTags_PageTitle__</h1>
|
||||||
<p>__MSG_AddTags_info_default__</p>
|
<p>__MSG_AddTags_info_default__</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="addtags_table_title">__MSG_AddTags_prompt_text_title__</div>
|
<div class="addtags_table_title">__MSG_AddTags_prompt_prefs_title__</div>
|
||||||
<table id="miczPrefs">
|
<table id="miczPrefs">
|
||||||
<tr class="add_tags_tr">
|
<tr class="add_tags_tr">
|
||||||
<td><span>__MSG_prefs_OptionText_add_tags_maxnum__</span></td>
|
<td><span>__MSG_prefs_OptionText_add_tags_maxnum__</span></td>
|
||||||
|
|
@ -31,6 +31,15 @@
|
||||||
</label>
|
</label>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr class="add_tags_tr">
|
||||||
|
<td><span>__MSG_prefs_OptionText_add_tags_first_uppercase__</span></td>
|
||||||
|
<td>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="add_tags_first_uppercase" name="add_tags_first_uppercase" class="option-input" />
|
||||||
|
__MSG_prefs_OptionText_add_tags_first_uppercase_Info__
|
||||||
|
</label>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<div id="addtags_prompt_container">
|
<div id="addtags_prompt_container">
|
||||||
__MSG_AddTags_prompt_text_title__<span id="addtags_prompt_unsaved" class="unsaved hidden"> __MSG_customPrompts_unsaved_changes__</span>
|
__MSG_AddTags_prompt_text_title__<span id="addtags_prompt_unsaved" class="unsaved hidden"> __MSG_customPrompts_unsaved_changes__</span>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue