diff --git a/src/Bundle/ChillMainBundle/Form/Extension/CKEditorExtension.php b/src/Bundle/ChillMainBundle/Form/Extension/CKEditorExtension.php deleted file mode 100644 index 96751d746..000000000 --- a/src/Bundle/ChillMainBundle/Form/Extension/CKEditorExtension.php +++ /dev/null @@ -1,38 +0,0 @@ -setDefaults([ - 'attr' => [ - 'class' => 'ckeditor snippet-markdown' - ] - ]); - } -} \ No newline at end of file diff --git a/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php b/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php new file mode 100644 index 000000000..f63a364f9 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Form/Type/ChillTextareaType.php @@ -0,0 +1,51 @@ + + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ +namespace Chill\MainBundle\Form\Type; + +use Symfony\Component\Form\AbstractType; +use Symfony\Component\Form\Extension\Core\Type\TextareaType; +use Symfony\Component\OptionsResolver\OptionsResolver; +use Symfony\Component\Form\FormView; +use Symfony\Component\Form\FormInterface; + +/** + * + * + */ +class ChillTextareaType extends AbstractType +{ + public function getParent() + { + return TextareaType::class; + } + + public function configureOptions(OptionsResolver $resolver) + { + $resolver + ->setDefined('disable_editor') + ->setDefault('disable_editor', false) + ->setAllowedTypes('disable_editor', 'bool'); + } + + public function buildView(FormView $view, FormInterface $form, array $options) + { + if (!$options['disable_editor']) { + $view->vars['attr']['ckeditor'] = true; + } + } +} diff --git a/src/Bundle/ChillMainBundle/chill.webpack.config.js b/src/Bundle/ChillMainBundle/chill.webpack.config.js index a6a69a954..c27c8abeb 100644 --- a/src/Bundle/ChillMainBundle/chill.webpack.config.js +++ b/src/Bundle/ChillMainBundle/chill.webpack.config.js @@ -7,9 +7,8 @@ buildCKEditor = function(encore) .addPlugin( new CKEditorWebpackPlugin( { language: 'fr', addMainLanguageTranslationsToAllAssets: true, - verbose: true, - strict: true, - //additionalLanguages: ['en', 'nl', 'es'], + verbose: !encore.isProduction(), + strict: true } ) ) // Use raw-loader for CKEditor 5 SVG files. @@ -35,7 +34,7 @@ buildCKEditor = function(encore) } ) } ) ; -} +}; // Compile and loads all assets from the Chill Main Bundle module.exports = function(encore, entries) diff --git a/src/Bundle/ChillMainBundle/config/services/form.yaml b/src/Bundle/ChillMainBundle/config/services/form.yaml index d3a01ff5d..513553194 100644 --- a/src/Bundle/ChillMainBundle/config/services/form.yaml +++ b/src/Bundle/ChillMainBundle/config/services/form.yaml @@ -138,10 +138,6 @@ services: tags: - { name: form.type } - Chill\MainBundle\Form\Extension\CKEditorExtension: - tags: - - { name: form.type_extension, extended_type: Symfony\Component\Form\Extension\Core\Type\TextareaType } - chill.main.form.type.comment: class: Chill\MainBundle\Form\Type\CommentType arguments: diff --git a/src/Bundle/ChillPersonBundle/Form/PersonType.php b/src/Bundle/ChillPersonBundle/Form/PersonType.php index 7cf24a836..9cf268a24 100644 --- a/src/Bundle/ChillPersonBundle/Form/PersonType.php +++ b/src/Bundle/ChillPersonBundle/Form/PersonType.php @@ -36,6 +36,7 @@ use Chill\CustomFieldsBundle\Form\Type\CustomFieldType; use Chill\PersonBundle\Form\Type\Select2MaritalStatusType; use Chill\PersonBundle\Config\ConfigPersonAltNamesHelper; use Chill\PersonBundle\Form\Type\PersonAltNameType; +use Chill\MainBundle\Form\Type\ChillTextareaType; class PersonType extends AbstractType { @@ -89,7 +90,7 @@ class PersonType extends AbstractType if ($this->config['memo'] === 'visible') { $builder - ->add('memo', TextareaType::class, array('required' => false)) + ->add('memo', ChillTextareaType::class, array('required' => false)) ; } @@ -98,7 +99,7 @@ class PersonType extends AbstractType } if ($this->config['contact_info'] === 'visible') { - $builder->add('contactInfo', TextareaType::class, array('required' => false)); + $builder->add('contactInfo', ChillTextareaType::class, array('required' => false)); } if ($this->config['phonenumber'] === 'visible') { diff --git a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig index e3d6f233a..d9a0d8d31 100644 --- a/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig +++ b/src/Bundle/ChillPersonBundle/Resources/views/Person/view.html.twig @@ -53,15 +53,6 @@ This view should receive those arguments: {% apply markdown_to_html %} {{ person.memo }} {% endapply %}
- {% apply markdown_to_html %} -## Marc est down - -**michel** _ça va_ - -> une citation - -Sit amet nisl ~~purus~~ in mollis. - {% endapply %} {% endif %}