diff --git a/web/src/components/admin/AdminEmail.jsx b/web/src/components/admin/AdminEmail.jsx index 5d7cd6d..a33a467 100644 --- a/web/src/components/admin/AdminEmail.jsx +++ b/web/src/components/admin/AdminEmail.jsx @@ -1,6 +1,7 @@ import { useEffect, useRef, useState } from 'react'; import { api } from '../../lib/api.js'; import { copyRichEmail } from '../../lib/emailClipboard.js'; +import { downloadOutlookDraft } from '../../lib/outlookDraft.js'; const INITIAL = { subject: 'Actualités du Business Club SLUC Nancy', @@ -65,6 +66,16 @@ export function EmailCreatorTab() { } }; + const downloadOutlook = () => { + const slug = form.subject.normalize('NFD').replace(/[\u0300-\u036f]/g, '').replace(/[^a-zA-Z0-9]+/g, '-').replace(/^-|-$/g, '').toLowerCase() || 'email'; + downloadOutlookDraft({ + subject: form.subject, + html: data.html, + filename: `${slug}-outlook.eml`, + }); + flash('outlook'); + }; + const download = () => { const blob = new Blob([data.html], { type: 'text/html' }); const url = URL.createObjectURL(blob); @@ -115,12 +126,13 @@ export function EmailCreatorTab() { {error &&
{error}
}- Dans un brouillon Outlook, utilisez Ctrl + clic pour tester un lien. Après envoi, un clic normal suffit. + Pour Outlook, ouvrez le fichier .eml téléchargé : le mail est chargé comme un vrai brouillon HTML, sans collage ni remplacement des styles. Dans le brouillon, utilisez Ctrl + clic pour tester un lien.
diff --git a/web/src/components/admin/AdminTabs.jsx b/web/src/components/admin/AdminTabs.jsx index 4cecb7b..0840912 100644 --- a/web/src/components/admin/AdminTabs.jsx +++ b/web/src/components/admin/AdminTabs.jsx @@ -1,6 +1,7 @@ import { useEffect, useRef, useState } from 'react'; import { api, dateParts, seasonLabel, statutLabel } from '../../lib/api.js'; import { copyRichEmail } from '../../lib/emailClipboard.js'; +import { downloadOutlookDraft } from '../../lib/outlookDraft.js'; import { useAuth } from '../../lib/AuthContext.jsx'; import Modal from '../Modal.jsx'; import ImageSlot from '../ImageSlot.jsx'; @@ -392,6 +393,16 @@ function EmailModal({ renc, onClose }) { } }; + const downloadOutlook = () => { + const slug = renc.titre.normalize('NFD').replace(/[̀-ͯ]/g, '').replace(/[^a-zA-Z0-9]+/g, '-').toLowerCase(); + downloadOutlookDraft({ + subject: data.subject, + html: data.html, + filename: `invitation-${slug}-outlook.eml`, + }); + flash('outlook'); + }; + const download = () => { const blob = new Blob([data.html], { type: 'text/html' }); const url = URL.createObjectURL(blob); @@ -429,8 +440,11 @@ function EmailModal({ renc, onClose }) { automatiquement. Videz un champ pour retirer ce bloc de l'email.