mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-21 11:24:40 +02:00
Use CKEDITOR 5 for all comment fields.
This commit is contained in:
parent
dde7e7347c
commit
898803e3ce
12 changed files with 112 additions and 75 deletions
|
@ -48,6 +48,7 @@ use App\Entity\LabelSystem\LabelProfile;
|
|||
use App\Form\AttachmentFormType;
|
||||
use App\Form\ParameterType;
|
||||
use App\Form\Type\MasterPictureAttachmentType;
|
||||
use App\Form\Type\RichTextEditorType;
|
||||
use App\Form\Type\StructuralEntityType;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use function get_class;
|
||||
|
@ -118,7 +119,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
if ($entity instanceof AbstractStructuralDBElement || $entity instanceof LabelProfile) {
|
||||
$builder->add(
|
||||
'comment',
|
||||
CKEditorType::class,
|
||||
RichTextEditorType::class,
|
||||
[
|
||||
'required' => false,
|
||||
'empty_data' => '',
|
||||
|
@ -126,7 +127,7 @@ class BaseEntityAdminForm extends AbstractType
|
|||
'attr' => [
|
||||
'rows' => 4,
|
||||
],
|
||||
'help' => 'bbcode.hint',
|
||||
'mode' => 'markdown-full',
|
||||
'disabled' => !$this->security->isGranted($is_new ? 'create' : 'edit', $entity),
|
||||
]
|
||||
);
|
||||
|
|
|
@ -25,7 +25,6 @@ namespace App\Form;
|
|||
|
||||
use App\Entity\LabelSystem\LabelOptions;
|
||||
use App\Form\Type\RichTextEditorType;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\NumberType;
|
||||
|
@ -104,7 +103,7 @@ class LabelOptionsType extends AbstractType
|
|||
$builder->add('lines', RichTextEditorType::class, [
|
||||
'label' => 'label_profile.lines.label',
|
||||
'empty_data' => '',
|
||||
'output_format' => 'html',
|
||||
'mode' => 'html-label',
|
||||
'attr' => [
|
||||
'rows' => 4,
|
||||
],
|
||||
|
|
|
@ -57,7 +57,6 @@ use App\Form\Type\RichTextEditorType;
|
|||
use App\Form\Type\SIUnitType;
|
||||
use App\Form\Type\StructuralEntityType;
|
||||
use App\Form\WorkaroundCollectionType;
|
||||
use FOS\CKEditorBundle\Form\Type\CKEditorType;
|
||||
use Symfony\Component\Form\AbstractType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
|
||||
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
|
||||
|
@ -112,7 +111,7 @@ class PartBaseType extends AbstractType
|
|||
'required' => false,
|
||||
'empty_data' => '',
|
||||
'label' => 'part.edit.description',
|
||||
'mode' => 'single_line',
|
||||
'mode' => 'markdown-single_line',
|
||||
'attr' => [
|
||||
'placeholder' => 'part.edit.description.placeholder',
|
||||
'rows' => 2,
|
||||
|
@ -214,7 +213,7 @@ class PartBaseType extends AbstractType
|
|||
'attr' => [
|
||||
'rows' => 4,
|
||||
],
|
||||
|
||||
'mode' => 'markdown-full',
|
||||
'disabled' => !$this->security->isGranted('comment.edit', $part),
|
||||
'empty_data' => '',
|
||||
]);
|
||||
|
|
|
@ -14,11 +14,8 @@ class RichTextEditorType extends AbstractType
|
|||
{
|
||||
parent::configureOptions($resolver); // TODO: Change the autogenerated stub
|
||||
|
||||
$resolver->setDefault('mode', 'full');
|
||||
$resolver->setAllowedValues('mode', ['full', 'single_line']);
|
||||
|
||||
$resolver->setDefault('output_format', 'markdown');
|
||||
$resolver->setAllowedValues('output_format', ['markdown', 'html']);
|
||||
$resolver->setDefault('mode', 'markdown-full');
|
||||
$resolver->setAllowedValues('mode', ['html-label', 'markdown-single_line', 'markdown-full']);
|
||||
}
|
||||
|
||||
public function getBlockPrefix()
|
||||
|
@ -38,7 +35,6 @@ class RichTextEditorType extends AbstractType
|
|||
$tmp = [];
|
||||
|
||||
$tmp['data-mode'] = $options['mode'];
|
||||
$tmp['data-output-format'] = $options['output_format'];
|
||||
|
||||
//Add our data-controller element to the textarea
|
||||
$tmp['data-controller'] = 'elements--ckeditor';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue