CKEditor 不能在 Symfony 4.4 上使用 EasyAdmin 3

mub*_*ara 3 ckeditor symfony easyadmin

我实际上正在开发一个需要使用 Symfony 4.4 和 EasyAdmin 3 的 WYSIWYG 界面的项目。

我尝试按照此文档https://symfony.com/doc/2.x/bundles/EasyAdminBundle/integration/ivoryckeditorbundle.html以及我在 Google 或 Youtube 上找到的其他一些教程来安装 FOS_CKEditor ,但不幸的是我不明白为什么 CKEditorField 没有显示在我的管理仪表板上。我想我已经错过了一些东西。

一些帮助将不胜感激,这是我的配置文件:

Fos_ckeditor:

#config/packages/fos_ckeditor.yaml

twig:
    form_themes:
        - '@FOSCKEditor/Form/ckeditor_widget.html.twig'

fos_ck_editor:
    configs:
        basic_conf:
            toolbar: full
Run Code Online (Sandbox Code Playgroud)

易管理员:

#config/packages/easy_admin.yaml

easy_admin:
    design:
        form_theme:
            - "@EasyAdmin/form/bootstrap_4.html.twig"
            - "@FOSCKEditor/Form/ckeditor_widget.html.twig"

Run Code Online (Sandbox Code Playgroud)

我还尝试通过添加以下内容来定义 CrudController 中的 FieldType:

#CrudController

 public function configureFields(string $pageName): iterable
{
    return [
        ..//
        TextareaField::new('corps', 'Corps')
        ->setFormType(CKEditorType::class),

Run Code Online (Sandbox Code Playgroud)

但它没有奏效。

预先感谢您的帮助!

Bou*_*ffe 5

根据https://github.com/EasyCorp/EasyAdminBundle/issues/3412 你可以添加

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

它对我来说很好:)

  • 你救了我的命,兄弟!我开始因为这个问题而陷入沮丧;) (3认同)

小智 0

尝试fos_ck_editor像这样更新该部分:

fos_ck_editor:
    input_sync: true
    default_config: base_config
    configs:
        base_config:
            toolbar: full
Run Code Online (Sandbox Code Playgroud)