PHP Quill Renderer

Quill deltas renderer, converts deltas to HTML, Markdown and Github flavoured Markdown, the Quill attributes supported are listed in the table in the README, the goal is to eventually support every Quill feature and add additional parsers.

Quilljs is a modern WYSIWYG editor built for compatibility and extensibility.

In my projects I include Quill via yarn, create a hidden input to store the data and then on submit pass the data along to the hidden input.

Instantiate the editor

var quill = new Quill('#quill-editor', {
    modules: {
        toolbar: [
            [{ 'header': [1, 2, 3, 4, 5, 6, false] }],
            ['bold', 'italic', 'underline', 'strike'],
            ['link'],
            [{ 'script': 'sub'}, { 'script': 'super' }],
            [{ 'list': 'ordered'}, { 'list': 'bullet' }],
            ['clean']
        ]
    },
    placeholder: 'Compose an epic...',
    theme: 'snow'
});

Pass to hidden input

$('form').submit(function() {
    $('#hidden_element').val(JSON.stringify(quill.getContents()));
    return true;
});

Installation

The easiest way to use the renderer is via composer. composer require deanblackborough/php-quill-renderer, alternatively you can include the classes in my src/ directory in your library or app.

Usage

try {
    $quill = new \DBlackborough\Quill\Render($quill_json, 'HTML');
    $result = $quill->render();
} catch (\Exception $e) {
    echo $e->getMessage();
}

echo $result;

You can view the entire README on GitHub

Demo v4.01.0

Enter your content into the Quill editor and click 'Parse', you will see the deltas and the output generated by the PHP Quill Renderer in your requested output format.

No submitted text is saved, I simply pass the posted text along to the PHP Quill Renderer and output the result directly, check here if you would like to confirm.