diff --git a/customprompts/mzta-custom-prompts.js b/customprompts/mzta-custom-prompts.js index 5cc8dc98..72b7d18f 100644 --- a/customprompts/mzta-custom-prompts.js +++ b/customprompts/mzta-custom-prompts.js @@ -18,6 +18,7 @@ import { getPrompts, setDefaultPromptsProperties, setCustomPrompts, preparePromptsForExport, preparePromptsForImport } from "../js/mzta-prompts.js"; import { isThunderbird128OrGreater, getCustomPromptsUsedSpace } from "../js/mzta-utils.js"; +import { taLogger } from "../js/mzta-logger.js"; var promptsList = null; var somethingChanged = false; @@ -25,8 +26,12 @@ var positionMax_compose = 0; var positionMax_display = 0; var idnumMax = 0; var msgTimeout = null; +let taLog = null; document.addEventListener('DOMContentLoaded', async () => { + + let prefs_debug = await browser.storage.sync.get({do_debug: false}); + taLog = new taLogger("mzta-custom-prompts", prefs_debug.do_debug); setStorageSpace(); @@ -415,7 +420,7 @@ function loadPromptsList(values){
__MSG_customPrompts_form_label_need_signature__
- __MSG_customPrompts_form_label_need_custom_text__ + __MSG_customPrompts_form_label_need_custom_text__
__MSG_customPrompts_form_label_define_response_lang__
@@ -584,6 +589,7 @@ async function saveAll() { // For each item in the array, return only the '_values' part return item.values(); }); + taLog.log('newPrompts: ' + JSON.stringify(newPrompts)); // newPrompts.forEach(prompt => { // console.log('>>>>>>>>>>>>> id: ' + JSON.stringify(prompt)); // }); diff --git a/js/mzta-prompts.js b/js/mzta-prompts.js index 02548e9b..71822b85 100644 --- a/js/mzta-prompts.js +++ b/js/mzta-prompts.js @@ -169,7 +169,7 @@ export function preparePromptsForExport(prompts){ output.forEach(prompt => { if(prompt.is_default == 1){ Object.keys(prompt).forEach(key => { - if(!['id', 'enabled', 'position_compose', 'position_display'].includes(key)){ + if(!['id', 'enabled', 'position_compose', 'position_display', 'need_custom_text'].includes(key)){ delete prompt[key]; } }) @@ -214,6 +214,7 @@ async function getDefaultPrompts_withProps() { prompt.position_compose = prefs._default_prompts_properties[prompt.id].position_compose; prompt.position_display = prefs._default_prompts_properties[prompt.id].position_display; prompt.enabled = prefs._default_prompts_properties[prompt.id].enabled; + prompt.need_custom_text = prefs._default_prompts_properties[prompt.id].need_custom_text; }else{ prompt.position_display = pos; prompt.position_compose = pos; @@ -238,7 +239,7 @@ async function getCustomPrompts() { export async function setDefaultPromptsProperties(prompts) { let default_prompts_properties = {}; prompts.forEach((prompt) => { - default_prompts_properties[prompt.id] = {position_compose: prompt.position_compose, position_display: prompt.position_display, enabled: prompt.enabled}; + default_prompts_properties[prompt.id] = {position_compose: prompt.position_compose, position_display: prompt.position_display, enabled: prompt.enabled, need_custom_text: prompt.need_custom_text}; }); //console.log('>>>>>>>>>>>>>> default_prompts_properties: ' + JSON.stringify(default_prompts_properties)); await browser.storage.local.set({_default_prompts_properties: default_prompts_properties}); @@ -248,4 +249,3 @@ export async function setDefaultPromptsProperties(prompts) { export async function setCustomPrompts(prompts) { await browser.storage.local.set({_custom_prompt: prompts}); } -