fix: use Quill clipboard.convert for proper HTML import in event editor
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions

Header dropdown (H2/H3), proper list and link rendering.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Maciej Pienczyn 2026-04-08 12:10:01 +02:00
parent a04c37c72a
commit ca73bfb5c7

View File

@ -295,8 +295,8 @@
placeholder: 'Opisz co będzie się działo na wydarzeniu...',
modules: {
toolbar: [
[{'header': [2, 3, false]}],
['bold', 'italic', 'underline'],
[{'header': 3}],
[{'list': 'ordered'}, {'list': 'bullet'}],
['link'],
['clean']
@ -305,12 +305,18 @@
});
{% if event and event.description %}
quill.root.innerHTML = {{ event.description|tojson }};
// Use Quill's clipboard to paste HTML properly (preserves lists, links, headers)
var delta = quill.clipboard.convert({{ event.description|tojson }});
quill.setContents(delta);
{% endif %}
// Sync Quill content to hidden input on form submit
quill.root.closest('form').addEventListener('submit', function() {
document.getElementById('description').value = quill.root.innerHTML;
var form = document.querySelector('.form-card form');
form.addEventListener('submit', function() {
var html = quill.root.innerHTML;
// Don't save empty editor
if (html === '<p><br></p>') html = '';
document.getElementById('description').value = html;
});
})();
{% endblock %}