Feature: WYSIWYG-Editor, Gitea-Sync, Signaturen-Verwaltung
- WYSIWYG-Editor mit contenteditable statt Textarea (MDI-Icons, System-Fonts, Farbwähler) - Gitea-Sync: Templates per Abteilung aus Git-Repo laden/hochladen mit Commit-Author - Abteilungsordner + _gemeinsam Ordner, einzelnes Pull/Push pro Vorlage - Sync-Status pro Vorlage (grün/rot/grau Ampel), persistent über Neustarts - Signaturen-Tab: Identitäten bearbeiten, aus Datei laden, Sync über signatures/ Ordner - Persönliche Signaturen für geteilte E-Mail-Adressen (pro Mitarbeiter) - Tab-Navigation: Vorlagen, Signaturen, Synchronisierung - Auto-Pull beim Thunderbird-Start (Templates + Signaturen)
This commit is contained in:
38
popup.js
38
popup.js
@@ -13,9 +13,17 @@ async function getTemplates() {
|
||||
}
|
||||
|
||||
function insertTemplateAndClose(templateText) {
|
||||
// Check if a prefix template is selected
|
||||
const prefixSelect = document.getElementById('prefix-select');
|
||||
const prefixContent = prefixSelect ? prefixSelect.value : '';
|
||||
|
||||
const combinedText = prefixContent
|
||||
? prefixContent + '<br>' + templateText
|
||||
: templateText;
|
||||
|
||||
browser.runtime.sendMessage({
|
||||
action: 'insertTemplate',
|
||||
text: templateText
|
||||
text: combinedText
|
||||
}).catch(e => console.error("Error sending message to background:", e));
|
||||
window.close();
|
||||
}
|
||||
@@ -39,6 +47,34 @@ async function renderPopupButtons() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Populate prefix dropdown
|
||||
const prefixSection = document.getElementById('prefix-section');
|
||||
const prefixSelect = document.getElementById('prefix-select');
|
||||
if (templates.length > 1) {
|
||||
prefixSection.style.display = '';
|
||||
templates.forEach(template => {
|
||||
const option = document.createElement('option');
|
||||
option.value = template.content;
|
||||
option.textContent = template.name;
|
||||
option.dataset.name = template.name;
|
||||
prefixSelect.appendChild(option);
|
||||
});
|
||||
|
||||
// Restore last selection
|
||||
const saved = await browser.storage.local.get('last_prefix');
|
||||
if (saved.last_prefix) {
|
||||
const match = [...prefixSelect.options].find(o => o.dataset.name === saved.last_prefix);
|
||||
if (match) prefixSelect.value = match.value;
|
||||
}
|
||||
|
||||
// Save selection on change
|
||||
prefixSelect.addEventListener('change', () => {
|
||||
const selected = prefixSelect.selectedOptions[0];
|
||||
const name = selected?.dataset?.name || '';
|
||||
browser.storage.local.set({ last_prefix: name });
|
||||
});
|
||||
}
|
||||
|
||||
templates.forEach(template => {
|
||||
const button = document.createElement('button');
|
||||
button.textContent = template.name;
|
||||
|
||||
Reference in New Issue
Block a user