froala / KMSFroalaEditorBundle

Symfony bundle for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
105 stars 33 forks source link

Fail to display on EasyAdminBundle #129

Closed saddit closed 2 years ago

saddit commented 2 years ago
class RichTextEditField implements FieldInterface
{
    use FieldTrait;

    public static function new(string $propertyName, ?string $label = null): self
    {
        return (new self())
            ->setProperty($propertyName)
            ->setLabel($label)
            ->setFormType(FroalaEditorType::class)
            ->addCssFiles("/bundles/kmsfroalaeditor/froala_editor/css/froala_style.min.css")
            ->setFormTypeOptions([
                'froala_language'      => 'en',
                'froala_toolbarInline' => true,
                'froala_tableColors'   => ['#FFFFFF', '#FF0000'],
                'froala_saveParams'    => ['id' => 'myEditorField'],
            ]);
    }

}

It displayed as a normal textarea

saddit commented 2 years ago

I solve it!!!

//xxxCrudController.php
public function configureCrud(Crud $crud): Crud
{
    return parent::configureCrud($crud)
        ->addFormTheme("@KMSFroalaEditor/Form/froala_widget.html.twig");
}
saddit commented 2 years ago

This may be a "Good first issue"