diff --git a/templates-reply-hotel.xpi b/templates-reply-hotel.xpi index 70d48dc..25021d6 100644 Binary files a/templates-reply-hotel.xpi and b/templates-reply-hotel.xpi differ diff --git a/templates_options/templates_options.html b/templates_options/templates_options.html index 16b83f6..3cff284 100644 --- a/templates_options/templates_options.html +++ b/templates_options/templates_options.html @@ -860,7 +860,6 @@
diff --git a/templates_options/templates_options.js b/templates_options/templates_options.js index e26a688..ce823ee 100644 --- a/templates_options/templates_options.js +++ b/templates_options/templates_options.js @@ -1002,7 +1002,7 @@ function updateSigEditorState(source) { async function loadIdentities() { allIdentities = []; - sigIdentitySelect.innerHTML = ''; + sigIdentitySelect.innerHTML = ''; const accounts = await browser.accounts.list(); for (const account of accounts) { @@ -1026,10 +1026,24 @@ async function loadIdentities() { } } - // Auto-select first identity and trigger change - if (allIdentities.length > 0 && !sigIdentitySelect.value) { - sigIdentitySelect.value = allIdentities[0].id; - sigIdentitySelect.dispatchEvent(new Event('change')); + // Auto-select first identity and load signature directly + if (allIdentities.length > 0) { + const first = allIdentities[0]; + sigIdentitySelect.value = first.id; + + const sourceMap = await getSigSourceMap(); + const source = sourceMap[first.email.toLowerCase()] || 'own'; + updateSigSourceDropdown(first.email); + sigSourceSelect.value = source; + + if (source.startsWith('=')) { + const srcEmail = source.substring(1); + const srcIdentity = allIdentities.find(i => i.email.toLowerCase() === srcEmail); + sigEditorArea.innerHTML = extractHeader(srcIdentity ? (srcIdentity.signature || '') : ''); + } else { + sigEditorArea.innerHTML = extractHeader(first.signature || ''); + } + updateSigEditorState(source); } } @@ -1627,7 +1641,7 @@ window.addEventListener('load', async () => { renderTemplates(templates); updateTplSyncIndicator(); loadSyncConfig(); - loadIdentities(); + await loadIdentities(); checkForServerUpdates(); setInterval(checkForServerUpdates, 30000);