1. Go to this page and download the library: Download nadar/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/ */
nadar / quill-delta-parser example snippets
// Ensure to load the autoload file from Composer somewhere in your application.
ray or JSON string).
$lexer = new \nadar\quill\Lexer($json);
// Echo 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"
// exists. If yes, return the value for this key.
$mention = $line->insertJsonKey('mention');
if ($mention) {
// Apply the inline behavior, updates the content and append to the next "block" element.
// The value in this example would be "<strong>Basil</strong>".
$this->updateInput($line, '<strong>'.$mention['value'].'</strong>');
}
}
}
$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 listener behavior for image color:
$lexer = new Lexer($json);
$lexer->registerListener($image);
echo $lexer->render();
$mySuperClass = new class() extends Image {
// Here is the custom class code ...
};
$lexer->overwriteListener(new Image(), $mySuperClass);
class MySuperDuperImageClass extends Image
{
// Here is the custom class code ...
}
$lexer->overwriteListener(new Image(), new MySuperDuperImageClass());
$lexer = new Lexer($json);
$lexer->render(); // Make sure to run the render before calling debugPrint().
$debug = new Debug($lexer);
echo $debug->debugPrint();
html
<h1>Hello</h1>
<p><br></p>
<p>This is the PHP Quill <strong>parser</strong>!</p>
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.