{# Rich Text Editor Macros (Quill) =============================== Reusable rich text editor components using Quill.js with Alpine.js integration. Setup (in your template): 1. Import the macros: {% from 'shared/macros/richtext.html' import quill_css, quill_js, quill_editor %} 2. Add CSS block (in {% block quill_css %}): {{ quill_css() }} 3. Add JS block (in {% block quill_script %}): {{ quill_js() }} 4. Use the editor in your form: {{ quill_editor( id='content-editor', model='form.content', placeholder='Write your content here...' ) }} Note: Quill loads from CDN with local fallback for offline use. #} {# Quill CSS Block =============== Include this in your {% block quill_css %} to load Quill styles. Includes dark mode support. #} {% macro quill_css() %} {% endmacro %} {# Quill JS Block ============== Include this in your {% block quill_script %} to load Quill. Uses CDN with local fallback. #} {% macro quill_js() %} {% endmacro %} {# Quill Editor Component ====================== A rich text editor with Alpine.js two-way binding. Parameters: - id: Unique ID for the editor (required) - model: Alpine.js model to bind HTML content to (required) - placeholder: Placeholder text (default: 'Write something...') - min_height: Minimum height of editor (default: '200px') - toolbar: Toolbar configuration - 'full', 'standard', 'minimal' (default: 'standard') - readonly: Alpine.js variable for readonly state (optional) - disabled: Alpine.js variable for disabled state (optional) - label: Label text (optional) - required: Whether field is required (default: false) - help_text: Help text below editor (optional) Toolbar presets: - 'full': All formatting options - 'standard': Headers, bold, italic, lists, links, images (default) - 'minimal': Bold, italic, lists only #} {% macro quill_editor( id, model, placeholder='Write something...', min_height='200px', toolbar='standard', readonly=none, disabled=none, label=none, required=false, help_text=none ) %}
{{ help_text }}
{% endif %}