1. Go to this page and download the library: Download hbryan/quill-delta-parser library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
hbryan / quill-delta-parser example snippets
use nadar\quill\Lexer;
$lexer = new Lexer($json);
// echoing the html for the given json ops.
echo $lexer->render();
class Mention extends InlineListener
{
/**
* {@inheritDoc}
*/
public function process(Line $line)
{
// check if input is json, decodes to an array and checks if the key "mention"
// exsts, if yes return the value for this key.
$mention = $line->insertJsonKey('mention');
if ($mention) {
// use default inline behavior, updates the content and append to next "block" element.
// the value in this example would be "<mention>Basil</mention>".
$this->updateInput($line, '<mention>'.$mention['value'].'</mention>');
}
}
$lexer = new Lexer($json);
$lexer->registerListener(new Mention);
echo $lexer->render();
$image = new Image();
$image->wrapper = '<img src="{src}" class="my-image" />';
// override the default plugin from the lexer:
$lexer = new Lexer($json);
$lexer->registerListener($image);
echo $lexer->render();
$lexer = new Lexer($json);
$lexer->render(); // make sure to run the render before call debugPrint();
$debug = new Debug($lexer);
echo $debug->debugPrint();