export default function alpineQuill(Alpine) { Alpine.directive('quill', function (el, { expression }, { evaluate, cleanup }) { const options = expression ? evaluate(expression) : {}; const defaultOptions = { theme: 'snow', ...options }; if (typeof window.Quill === 'undefined') { throw new Error('Quill must be loaded'); } const container = document.createElement('div'); el.appendChild(container); const quill = new window.Quill(container, defaultOptions); let isUpdating = false; // 1. Text changes handler quill.on('text-change', () => { if (isUpdating) return; isUpdating = true; const htmlContent = quill.root.innerHTML; el.value = htmlContent === '