Easyadminbundle: CKEditor javascript is not loaded; normal textarea is loaded instead.

Created on 21 Oct 2019  路  2Comments  路  Source: EasyCorp/EasyAdminBundle

I am following the instructions here to use CKEditor with EasyAdmin:

https://symfony.com/doc/master/bundles/EasyAdminBundle/integration/ivoryckeditorbundle.html

What happens is that the CKEditor javascript is not loaded by the page and texareas continue to appear as normal, albeit with a 'field-ckeditor' class added to the div of the form-group. There is no error given in the browser console output. This is despite adding the - '@FOSCKEditor/Form/ckeditor_widget.html.twig' line to my twig:form_themes.

I am using Easy Admin v2.3.1 on a fresh Symfony 4.3.5 installation.

Some observations:

  • My twig: form_themes can contain garbage without causing an error on a 'create' EasyAdmin page, but not on an 'edit' EasyAdmin page.

  • I can confirm that the ckeditor javascript is present at http://localhost:8000/bundles/fosckeditor/ckeditor.js by navigating there in a browser. But EasyAdmin pages do not call to this URL to load it.

  • View Source on an EasyAdmin 'edit' page reveals that the only occurrence of the string 'cked' is on the div containing the form field.

Any help gratefully received! :)

doc

Most helpful comment

vkhramtsov has helpfully just advised me to add the "@FOSCKEditor/Form/ckeditor_widget.html.twig" form theme to "easyadmin:design: form_theme:list" in "config/packages/easy_admin.yaml" like this:

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

This solved the problem for me. I think the docs need to be updated. The place they suggest to put the form template presently (twig:form_themes) does not work.

All 2 comments

vkhramtsov has helpfully just advised me to add the "@FOSCKEditor/Form/ckeditor_widget.html.twig" form theme to "easyadmin:design: form_theme:list" in "config/packages/easy_admin.yaml" like this:

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

This solved the problem for me. I think the docs need to be updated. The place they suggest to put the form template presently (twig:form_themes) does not work.

@jjsmclaughlin you are right. Thanks for reporting this. Luckily this was solved in #2962, so it will be displayed correctly after the next doc build on symfony.com. Thanks.

Was this page helpful?
0 / 5 - 0 ratings