showing an unsaved msg when needed. see #183

This commit is contained in:
mic 2024-12-15 22:07:52 +01:00
parent 3c00e8e3d8
commit 4a8b845c2d
3 changed files with 10 additions and 1 deletions

View file

@ -68,6 +68,10 @@
display: none;
}
.unsaved{
color: red;
}
@media (prefers-color-scheme: dark) {
body {

View file

@ -12,7 +12,7 @@
<p>__MSG_AddTags_info_default__</p>
</div>
<div id="addtags_prompt_container">
__MSG_AddTags_prompt_text_title__
__MSG_AddTags_prompt_text_title__<span id="addtags_prompt_unsaved" class="unsaved hidden"> __MSG_customPrompts_unsaved_changes__</span>
<br><span class="infoline">__MSG_prefs_OptionText_btnManagePrompts_infoline__ <a href="https://micz.it/thunderbird-addon-thunderai/data-placeholders/">__MSG_customPrompts_managePrompts_help__</a></span>
<br>
<div class="autocomplete-container">

View file

@ -34,6 +34,11 @@ document.addEventListener('DOMContentLoaded', async () => {
addtags_textarea.addEventListener('input', (event) => {
addtags_reset_btn.disabled = (event.target.value === browser.i18n.getMessage('prompt_add_tags_full_text'));
addtags_save_btn.disabled = (event.target.value === addtags_prompt.text);
if(addtags_save_btn.disabled){
document.getElementById('addtags_prompt_unsaved').classList.add('hidden');
} else {
document.getElementById('addtags_prompt_unsaved').classList.remove('hidden');
}
});
addtags_reset_btn.addEventListener('click', () => {