Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
232 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
.php_cs.cache | ||
composer.lock | ||
phpunit.xml | ||
.phpunit.result.cache | ||
vendor/ | ||
.idea/ | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
$header = <<<EOF | ||
This file is part of the FOSUserBundle package. | ||
(c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
For the full copyright and license information, please view the LICENSE | ||
file that was distributed with this source code. | ||
EOF; | ||
|
||
return PhpCsFixer\Config::create() | ||
->setRules([ | ||
'@Symfony' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'combine_consecutive_unsets' => true, | ||
'header_comment' => ['header' => $header], | ||
'linebreak_after_opening_tag' => true, | ||
'no_php4_constructor' => true, | ||
'no_useless_else' => true, | ||
'ordered_class_elements' => true, | ||
'ordered_imports' => true, | ||
'php_unit_construct' => true, | ||
'php_unit_strict' => true, | ||
'phpdoc_no_empty_return' => false, | ||
]) | ||
->setUsingCache(true) | ||
->setRiskyAllowed(true) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
) | ||
; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
language: php | ||
|
||
dist: bionic | ||
sudo: false | ||
|
||
cache: | ||
directories: | ||
- $HOME/.composer/cache/files | ||
- .phpunit | ||
|
||
env: | ||
global: | ||
- SYMFONY_PHPUNIT_DIR=.phpunit | ||
|
||
matrix: | ||
fast_finish: true | ||
include: | ||
- php: 7.2 | ||
- php: 7.3 | ||
# Test against dev versions | ||
- php: nightly | ||
env: DEPENDENCIES=dev | ||
allow_failures: | ||
- env: DEPENDENCIES=dev | ||
|
||
before_install: | ||
- composer self-update | ||
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi; | ||
- if [ "$SYMFONY_VERSION" != "" ]; then composer require --dev --no-update symfony/symfony:"$SYMFONY_VERSION"; fi | ||
|
||
install: | ||
- composer update $COMPOSER_FLAGS | ||
- ./vendor/bin/simple-phpunit install | ||
|
||
script: ./vendor/bin/simple-phpunit -v --coverage-text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,30 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the FOSUserBundle package. | ||
* (c) FriendsOfSymfony <http://friendsofsymfony.github.com/> | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Nicolassing\QuillBundle\DependencyInjection; | ||
|
||
use Symfony\Component\Config\FileLocator; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
use Symfony\Component\DependencyInjection\Extension\Extension; | ||
use Symfony\Component\DependencyInjection\Loader; | ||
use Symfony\Component\Config\FileLocator; | ||
|
||
/** | ||
* @author Nicolas Assing <nicolas.assing@gmail.com> | ||
*/ | ||
class NicolassingQuillExtension extends Extension | ||
{ | ||
public function load(array $configs, ContainerBuilder $container) | ||
public function load(array $configs, ContainerBuilder $container): void | ||
{ | ||
$configuration = new Configuration(); | ||
$config = $this->processConfiguration($configuration, $configs); | ||
$container->setParameter('nicolassing_quill.config', $config); | ||
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); | ||
$loader->load('services.xml'); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,56 @@ | ||
# NicolassingQuillBundle | ||
# NicolassingQuillBundle | ||
|
||
This bundle integrate [quilljs](https://quilljs.com/docs) in your Symfony project. | ||
|
||
## Installation ## | ||
|
||
Add the `nicolassing/quill-bundle` package to your `require` section in the `composer.json` file. | ||
|
||
``` bash | ||
$ composer require nicolassing/quill-bundle | ||
``` | ||
|
||
## Usage ## | ||
|
||
Configure `quill` client(s) in your `config/packages/nicolassing_quill.yaml`: | ||
|
||
``` yaml | ||
nicolassing_quill: | ||
theme: snow | ||
height: 10rem | ||
``` | ||
|
||
There is 2 themes available | ||
* snow (default) | ||
* bubble | ||
|
||
Add a quill widget into your form | ||
``` php | ||
namespace App\Form\Type; | ||
|
||
use Symfony\Component\Form\AbstractType; | ||
use Nicolassing\QuillBundle\Form\Type\QuillType; | ||
use Symfony\Component\Form\FormBuilderInterface; | ||
|
||
class FooType extends AbstractType | ||
{ | ||
public function buildForm(FormBuilderInterface $builder, array $options) | ||
{ | ||
$builder | ||
->add('bar', QuillType::class) | ||
; | ||
} | ||
} | ||
``` | ||
|
||
Add javascript and stylesheet in your twig template | ||
``` twig | ||
<!-- Include stylesheet --> | ||
<link href="https://cdn.quilljs.com/1.3.6/quill.snow.css" rel="stylesheet"> | ||
{{ form_row(form.bar) }} | ||
<!-- Include the Quill library --> | ||
<script src="https://cdn.quilljs.com/1.3.6/quill.js"></script> | ||
<script src="bundles/nicolassingquill/js/nicolassing_quill.js"></scriptt> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{% block quill_widget %} | ||
{% spaceless %} | ||
{% apply spaceless %} | ||
<div class="quill" data-theme="{{ theme }}" data-id="{{ id }}" style="height: {{ height }}"> | ||
{{ value|raw }} | ||
</div> | ||
<input type="hidden" {{ block('widget_attributes') }} value="{{ value }}" /> | ||
{% endspaceless %} | ||
{% endblock %} | ||
{% endapply %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.