Bwuljqh
Bwuljqh

Reputation: 1

Integration of CKEditor with Symfony is not working

I am curently building a website for a project with Symfony and since there will be articles on it, a WYSIWYG editor seems like the best choice. I first tried some editor and then realised the CKEditor was available with Symfony. I installed it and it worked for a while but then just stopped displaying while still hiding the text area (screeshots below).

I tried to resolve it but failed so I ignored the problem for a while, taking care of other things and finally came across the Easy admin bundle which solved a lot of my problems. Finally I went and tried CKEditor with Easy Admin but still nothing and this code is embeded in the page if that's any help.

I looked at a lot of git issues but found no one with the same problem, do you have any idea of how to resolve it ?

easy_admin.yaml
easy_admin:
 design:
   form_theme: # Both themes are needed for ckeditor integration
     - "@EasyAdmin/form/bootstrap_4.html.twig"
     - "@FOSCKEditor/Form/ckeditor_widget.html.twig"

 Article:
   class: App\Entity\Article
     form:
       fields:
         - title
         - { property: 'pictureFile', type: 'vich_image' }
         - { property: 'content', type: 'fos_ckeditor'}

If any other information from my side is needed do not hesitate

Upvotes: 0

Views: 1217

Answers (1)

user13044495
user13044495

Reputation:

add the below code in the crudController that you want to show the ckeditor in easy admin

public function configureCrud(Crud $crud): Crud
{
    return $crud->addFormTheme('@FOSCKEditor/Form/ckeditor_widget.html.twig');
}

then use the below line int the fields it should work properly with Easyamin3 and Symfony5 i have tested that myself and it works awesome

TextareaField::new('content')->setFormType(CKEditorType::class),

Upvotes: 3

Related Questions