-1

So I'm trying to integrate tinymce for my textareas but I keep getting JS errors, asked chatgpt and all but no solution.

I did as the tinymce doc said (https://www.tiny.cloud/docs/tinymce/latest/php-projects/), copied the directory to my public js folder, initialized it in my twig javascript block, added the class selector to my textareas but nothing will make it work.

Here's my code :

base.html.twig

        {% block javascripts %}
            {% block importmap %}{{ importmap('app') }}{% endblock %}
            <script src="{{ asset('js\tinymce\tinymce.min.js')}}" referrerpolicy="origin"></script>
            <script>
                tinymce.init({
                    selector: '.tinymce'
                });
            </script>
            <script src="{{ asset('js/script.js')}}"></script>
        {% endblock %}

Form

    public function buildForm(FormBuilderInterface $builder, array $options): void
    {
        $builder
            ->add('contenu', TextareaType::class, [
                'label' => 'Avis',
                'attr' => [
                    'class' => 'tinymce form',
                ]
            ]);
     }

EDIT : problem fixed, must have been an issue during the installation but I removed and re-installed tinymce and it worked just fine

2
  • what's the JS errors?
    – duncan
    Commented Jul 10 at 8:51
  • it said that tinymce wasn't defined, removed it with composer, reinstalled it and it worked just fine, must have been an issue with the download
    – FutRR
    Commented Jul 10 at 9:09

0

Browse other questions tagged or ask your own question.