Skip to content

Strange issue with tinymce_type.html.twig and JavaScriptImportPathCompiler #15

@devrodor

Description

@devrodor

I've encountered a strange bug, not sure if you've come across it.

I have two projects, one based on Symfony 6.4.1 and another on Symfony 6.4.4.

In the 6.4.1 version, I've installed TinyMCE without any issues using this bundle.

In the 6.4.4 project, I get the following error when integrating TinymceType into the Form Builder:

"An exception has been thrown during the rendering of a template ('Symfony\Component\AssetMapper\Compiler\JavaScriptImportPathCompiler::compile(): Return value must be of type string, null returned') in '@Tinymce/form/tinymce_type.html.twig'."

Upon investigating the problem's source, if I move the TinyMCE folder inside public > bundles and place it in root (public), and modify the twig template 'tinymce_type.html.twig' in this way, everything works correctly.

{%- block tinymce_widget -%}
	<tinymce-editor
		id="{{ id }}"
		name="{{ full_name }}"
		{{ required ? "required" : "" }}
		{{ block('attributes') }}
		src="{{ asset('tinymce/ext/tinymce/tinymce.min.js') }}"
		>{{ value }}</tinymce-editor>
	<script src="{{ asset('tinymce/ext/tinymce-webcomponent.js') }}" type="module"></script>
{%- endblock -%}

Checking vite.config.js, I find no issues.

Moreover, if I modify the previously mentioned template and point to tinymce.js (not to the minimized version), the error disappears, although it does not work. If you need more information, I can provide it for you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions