{% load static %}
<div class="vLargeTextField django-quill-widget-container">
    <div id="quill-{{ id }}" class="django-quill-widget" data-config="{{ config }}" data-type="django-quill"></div>
    <input id="quill-input-{{ id }}" name="{{ name }}" type="hidden">
    <script>
        (function () {
            var wrapper = new QuillWrapper('quill-{{ id }}', 'quill-input-{{ id }}', JSON.parse('{{ config|safe }}'));
            {% if quill and quill.delta %}
                // try django_quill/quill.py/Quill instance
                var contents = JSON.parse('{{ quill.delta|safe|escapejs }}');
                wrapper.quill.setContents(contents);
            {% elif value %}
                // try Parsing value as JSON
                try {
                    var value = JSON.parse('{{ value|safe|escapejs }}');
                    wrapper.quill.setContents(JSON.parse(value['delta']));
                }
                // When a parsing error occurs, the contents are regarded as HTML and the contents of the editor are filled.
                catch (e) {
                    wrapper.quill.clipboard.dangerouslyPasteHTML(0, `{{ value|safe }}`)
                }
            {% endif %}
        })();
    </script>
</div>