diff --git a/sources/AppBundle/Event/Form/InterviewQuestionType.php b/sources/AppBundle/Event/Form/InterviewQuestionType.php index 45994ea0d..d7154c5a8 100644 --- a/sources/AppBundle/Event/Form/InterviewQuestionType.php +++ b/sources/AppBundle/Event/Form/InterviewQuestionType.php @@ -36,7 +36,7 @@ public function buildForm(FormBuilderInterface $builder, array $options): void 'rows' => 10, 'class' => 'easymde', ], - 'required' => true, + 'required' => false, 'empty_data' => '', 'constraints' => [ new Assert\NotBlank(), diff --git a/templates/admin/base_with_header.html.twig b/templates/admin/base_with_header.html.twig index debca10cc..30ca54dfb 100644 --- a/templates/admin/base_with_header.html.twig +++ b/templates/admin/base_with_header.html.twig @@ -197,13 +197,19 @@ }); }); + window.initEasyMDE = function(element) { + if (element && !element.easymde) { + element.easymde = new EasyMDE({ + element: element, + spellChecker: false, + hideIcons: ['side-by-side', 'fullscreen', 'check-list'] + }); + } + }; + var easyMdeList = document.getElementsByClassName('easymde'); for (var i = 0; i < easyMdeList.length; i++) { - var easymde = new EasyMDE({ - element:easyMdeList[i], - spellChecker: false, - hideIcons: ['side-by-side', 'fullscreen', 'check-list'] - }); + window.initEasyMDE(easyMdeList[i]); } diff --git a/templates/admin/event/interview/_javascript.html.twig b/templates/admin/event/interview/_javascript.html.twig index d3423dda7..1c7d8bc8c 100644 --- a/templates/admin/event/interview/_javascript.html.twig +++ b/templates/admin/event/interview/_javascript.html.twig @@ -17,6 +17,11 @@ collectionHolder.appendChild(item); + const textarea = item.querySelector('.easymde'); + if (textarea) { + window.initEasyMDE(textarea); + } + addDeletionButton(item, collectionHolder.dataset.index); collectionHolder.dataset.index++; }