diff --git a/assets/libs/CrmEditor.js b/assets/libs/CrmEditor.js index 76dcd66..550b3b7 100644 --- a/assets/libs/CrmEditor.js +++ b/assets/libs/CrmEditor.js @@ -37,11 +37,6 @@ export class CrmEditor extends HTMLTextAreaElement { - -
- Copie impossible -
-
@@ -50,9 +45,9 @@ export class CrmEditor extends HTMLTextAreaElement {
0 caractères - Texte insuffisant pour un référencement optimal + Texte insuffisant
-
EsyWysiwyg 1.0
+
EsyWysiwyg 1.1
`; @@ -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; diff --git a/migrations/Version20260130081429.php b/migrations/Version20260130081429.php new file mode 100644 index 0000000..4bfe3d1 --- /dev/null +++ b/migrations/Version20260130081429.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE formules ADD pos INT DEFAULT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE formules DROP pos'); + } +} diff --git a/src/Entity/Formules.php b/src/Entity/Formules.php index d348421..a67b724 100644 --- a/src/Entity/Formules.php +++ b/src/Entity/Formules.php @@ -72,6 +72,9 @@ class Formules #[ORM\OneToOne(mappedBy: 'formule', cascade: ['persist', 'remove'])] private ?FormulesRestriction $formulesRestriction = null; + #[ORM\Column(nullable: true)] + private ?int $pos = null; + public function __construct() { $this->formulesProductIncluses = new ArrayCollection(); @@ -332,4 +335,16 @@ class Formules return $this; } + + public function getPos(): ?int + { + return $this->pos; + } + + public function setPos(?int $pos): static + { + $this->pos = $pos; + + return $this; + } }