Fix: Signaturen-Tab lädt erste Identität automatisch

- "Bitte wählen" Placeholder entfernt
- Erste Identität wird beim Laden direkt ausgewählt
- Signatur wird sofort in den Editor geladen (kein manuelles Umschalten nötig)
This commit is contained in:
Kendrick Bollens
2026-05-07 02:22:55 +02:00
parent 864be54646
commit 1d00a06e30
3 changed files with 20 additions and 7 deletions

Binary file not shown.

View File

@@ -860,7 +860,6 @@
<div class="form-group"> <div class="form-group">
<label for="sig-identity-select">Identität / E-Mail-Adresse</label> <label for="sig-identity-select">Identität / E-Mail-Adresse</label>
<select id="sig-identity-select" style="width:100%;"> <select id="sig-identity-select" style="width:100%;">
<option value="">— Bitte wählen —</option>
</select> </select>
</div> </div>

View File

@@ -1002,7 +1002,7 @@ function updateSigEditorState(source) {
async function loadIdentities() { async function loadIdentities() {
allIdentities = []; allIdentities = [];
sigIdentitySelect.innerHTML = '<option value="">— Bitte wählen —</option>'; sigIdentitySelect.innerHTML = '';
const accounts = await browser.accounts.list(); const accounts = await browser.accounts.list();
for (const account of accounts) { for (const account of accounts) {
@@ -1026,10 +1026,24 @@ async function loadIdentities() {
} }
} }
// Auto-select first identity and trigger change // Auto-select first identity and load signature directly
if (allIdentities.length > 0 && !sigIdentitySelect.value) { if (allIdentities.length > 0) {
sigIdentitySelect.value = allIdentities[0].id; const first = allIdentities[0];
sigIdentitySelect.dispatchEvent(new Event('change')); 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); renderTemplates(templates);
updateTplSyncIndicator(); updateTplSyncIndicator();
loadSyncConfig(); loadSyncConfig();
loadIdentities(); await loadIdentities();
checkForServerUpdates(); checkForServerUpdates();
setInterval(checkForServerUpdates, 30000); setInterval(checkForServerUpdates, 30000);