nadar/quill-delta-parser
Parse Quill editor Delta JSON (ops) into safe, sanitized HTML in PHP. Simple Lexer API to render output from arrays or JSON strings, with a consistent parsing mechanism and hooks to extend/customize elements and attributes.
Size listener for font-size attributes expands compatibility with Quill.js’s formatting modules, making it more suitable for:
font-size suggests a modular architecture, reinforcing the package’s ability to support custom Delta ops (e.g., @mentions, @formulas) via similar listeners.font-size values (e.g., convert px to rem for consistency).Size listener is minimal (~few KB), preserving the package’s low overhead.font-size support now covers a common Quill formatting op, reducing the need for pre-processing in most cases.font-size) remain unaffected.font-size attributes, enabling:
style="font-size: 1.5rem !important").| Risk Area | Mitigation Strategy | Update for 3.7.0 |
|---|---|---|
| Delta Schema Drift | Validate input Delta structure. | New: Validate font-size values (e.g., ensure they’re numeric/valid CSS units). |
| XSS Vulnerabilities | Sanitize output HTML. | No change. |
| Performance | Benchmark with large Deltas; cache parsed HTML. | New: Test font-size parsing overhead (negligible, but validate in bulk ops). |
| Custom Element Support | Test edge cases (e.g., nested custom elements). | No change. |
| Quill Version Mismatch | Document supported Delta ops versions. | New: Confirm compatibility with Quill v2.3.4+ (where font-size is standard). |
font-size for responsive typography (e.g., mobile/desktop adjustments)?font-size units (e.g., convert px to em for consistency)?Size listener to support custom CSS variables (e.g., --font-size-base)?font-size parsing impact real-time collaborative editing (e.g., Google Docs-like apps)?font-size values user-controlled (risk of CSS injection)? Sanitize if needed.font-size parsing with invalid values (e.g., "invalid", null).font-size ops (e.g., nested headings).font-size in Delta payloads (e.g., from Quill.js API calls).font-size into Blade templates or API responses.font-size or apply utility classes.Size module:
const quill = new Quill('#editor', {
modules: { size: true },
theme: 'snow'
});
font-size changes via Laravel Echo/Pusher.font-size parsing in a non-critical feature (e.g., blog post editor).font-size support.font-size ops.font-size (if needed).font-size (e.g., 16px) if parsing fails.font-size values (e.g., "100%" → sanitize to "1rem").| Component | Compatibility Notes | Update for 3.7.0 |
|---|---|---|
| PHP Version | Unchanged (PHP 8.1+). | No change. |
| Quill.js | Requires Quill v2.3.4+ for font-size module. |
New: Document Quill version requirement. |
| Laravel Versions | Unchanged (Laravel 8+). | No change. |
| Custom Elements | Unchanged. | No change. |
| CSS Frameworks | New: Integrate with Tailwind/Laravel Mix for font-size utilities. |
New: Example: Use @apply or utility classes to override parsed sizes. |
composer require nadar/quill-delta-parser:^3.7.0.Size module.font-size:
$html = $parser->parse($deltaWithFontSize);
<div class="prose">{{ $html }}</div> <!-- Tailwind’s prose component -->
font-size: Extend the parser to convert px to rem:
$parser->extend(function ($node) {
if ($node->getAttribute('font-size')) {
$node->setAttribute('style', 'font-size: ' . pxToRem($node->getAttribute('font-size')) . ';');
}
});
font-size (e.g., "auto", "inherit").font-size for static content.font-size parsing is CPU-intensive (unlikely).font-size module changes.font-size normalization may need updates if CSS standards evolve.font-size parsing warnings for invalid values.Size listener logic.font-size listener; prioritize testing if critical.font-size).font-size parsing in large Deltas (e.g., 10K ops with nested sizes).Size listener → scales with Laravel’s queue workers.font-size may increase size; compress if needed.| Failure Scenario | Impact | Mitigation | Update for 3.7.0 |
|---|---|---|---|
| Malformed Delta Input | Parsing errors, crashes | Validate font-size values. |
New: Reject non-numeric/valid CSS units (e.g., "100%" → sanitize to "1rem"). |
| XSS in Output HTML | Security vulnerabilities | Sanitize with |
How can I help you explore Laravel packages today?