```
✨ feat(Formules): Ajoute champ 'pos' pour ordonner les formules. 🐛 fix(CrmEditor): Améliore la gestion du copier-coller et retire le toast d'erreur. ```
This commit is contained in:
@@ -37,11 +37,6 @@ export class CrmEditor extends HTMLTextAreaElement {
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Toast de sécurité -->
|
||||
<div id="paste-error" class="absolute top-16 left-1/2 -translate-x-1/2 bg-red-500 text-white px-4 py-2 rounded-full text-xs font-bold shadow-xl opacity-0 transition-all duration-300 pointer-events-none z-50">
|
||||
Copie impossible
|
||||
</div>
|
||||
|
||||
<div id="wysiwyg-area"
|
||||
contenteditable="true"
|
||||
class="p-6 min-h-[300px] max-h-[600px] overflow-y-auto focus:outline-none bg-white text-slate-900 prose prose-slate max-w-none shadow-inner break-words w-full">
|
||||
@@ -50,9 +45,9 @@ export class CrmEditor extends HTMLTextAreaElement {
|
||||
<div class="flex items-center justify-between px-4 py-2 border-t border-white/10 bg-black/20 text-[11px] font-medium tracking-wide">
|
||||
<div id="char-counter" class="flex items-center gap-2">
|
||||
<span id="char-count" class="text-white bg-white/10 px-2 py-0.5 rounded-full">0 caractères</span>
|
||||
<span id="seo-warning" class="text-orange-400 opacity-0 transition-opacity italic">Texte insuffisant pour un référencement optimal</span>
|
||||
<span id="seo-warning" class="text-orange-400 opacity-0 transition-opacity italic">Texte insuffisant</span>
|
||||
</div>
|
||||
<div class="text-white/40 uppercase tracking-widest font-bold">EsyWysiwyg 1.0</div>
|
||||
<div class="text-white/40 uppercase tracking-widest font-bold">EsyWysiwyg 1.1</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
@@ -60,17 +55,21 @@ export class CrmEditor extends HTMLTextAreaElement {
|
||||
this.wysiwyg = this.editorContainer.querySelector('#wysiwyg-area');
|
||||
this.colorInput = this.editorContainer.querySelector('#text-color-input');
|
||||
this.colorBar = this.editorContainer.querySelector('#color-bar');
|
||||
this.pasteError = this.editorContainer.querySelector('#paste-error');
|
||||
|
||||
this.initEvents();
|
||||
this.updateStats();
|
||||
}
|
||||
|
||||
initEvents() {
|
||||
// Sécurité anti-collage
|
||||
// --- NOUVELLE LOGIQUE DE NETTOYAGE (PASTE) ---
|
||||
this.wysiwyg.addEventListener('paste', (e) => {
|
||||
e.preventDefault();
|
||||
this.showPasteWarning();
|
||||
// On récupère uniquement le texte brut du presse-papier
|
||||
const text = (e.originalEvent || e).clipboardData.getData('text/plain');
|
||||
// On l'insère proprement à l'endroit du curseur sans aucune balise
|
||||
document.execCommand('insertText', false, text);
|
||||
this.syncValue();
|
||||
this.updateStats();
|
||||
});
|
||||
|
||||
// Boutons standards
|
||||
@@ -102,16 +101,6 @@ export class CrmEditor extends HTMLTextAreaElement {
|
||||
});
|
||||
}
|
||||
|
||||
showPasteWarning() {
|
||||
this.pasteError.classList.remove('opacity-0', 'scale-90');
|
||||
this.pasteError.classList.add('opacity-100', 'scale-100');
|
||||
|
||||
setTimeout(() => {
|
||||
this.pasteError.classList.add('opacity-0', 'scale-90');
|
||||
this.pasteError.classList.remove('opacity-100', 'scale-100');
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
updateStats() {
|
||||
const text = this.wysiwyg.innerText || "";
|
||||
const count = text.trim().length;
|
||||
|
||||
Reference in New Issue
Block a user