{% form_theme form _self %}

{% block ckeditor_widget %}
{% spaceless %}
    <textarea {{ block('widget_attributes') }}>{{ value }}</textarea>
   
    <script type="text/javascript" src="{{ asset('bundles/ivoryckeditor/ckeditor.js') }}"></script>
    <script type="text/javascript">
        CKEDITOR.replace("{{ id }}",{
            toolbar: {{ toolbar | json_encode | raw }},
            {% if ui_color is not null %}
                uiColor: {{ ui_color }},
            {% endif %}
        });
    </script>
{% endspaceless %}
{% endblock %}
{% form_theme form _self %}

{% block ckeditor_widget %}
{% spaceless %}
    <textarea {{ block('widget_attributes') }}>{{ value }}</textarea>

    <script type="text/javascript" src="{{ asset('bundles/ivoryckeditor/ckeditor.js') }}"></script>
    <script type="text/javascript">
        var instance = CKEDITOR.instances['{{ id }}'];
        if (instance) {
            instance.destroy(true);
        }

        CKEDITOR.replace("{{ id }}",{
            toolbar: {{ toolbar | json_encode | raw }},
            {% if ui_color is not null %}
                uiColor: {{ ui_color }},
            {% endif %}
        });
    </script>
{% endspaceless %}
{% endblock %}

Destroy the ckeditor instance if it already exists
Destroy the ckeditor instance if it already exists
