Zum Inhalt

Eweiterung des RTE

Im Contently CMS ist der TinyMCE als Rich Text Editor für die Bearbeitung von Properties mit den Konfiguration PIN\RTE() integriert.

Standard-Konfiguration

Im Standard ist der TinyMCE wie folgt konfiguriert.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
{
  skin: 'lightgray',
  theme : 'modern',
  statusbar: true,
  menubar: false,
  language: 'de',
  paste_as_text: true,
  autoresize_bottom_margin: 20,
  convert_urls: false,
  plugins: "lists, link,anchor, code,autoresize,stickytoolbar2, paste image",
  block_formats: 'Absatz=p;Überschrift 1=h1;Überschrift 2=h2;Überschrift 3=h3;Überschrift 4=h4;Überschrift 5=h5;Überschrift 6=h6;Zitat=blockquote;Code=pre',
  toolbar1: 'formatselect | bold italic strikethrough subscript superscript | alignleft aligncenter alignright | bullist numlist outdent indent | link unlink anchor | undo redo | code'
}

Referenz

Die möglichen Optionen zur Konfiguration entnehmen Sie bitte der TinyMCE-Dokumentation unter www.tiny.cloud/docs/configure/editor-appearance/

Globale Anpassung

Der Editor kann für alle entsprechenden RTE-Properties einheitlich angepasst werden.

custom/app.php

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
$app->extend('dispatcher', function (EventDispatcherInterface $dispatcher, $app) {

    $dispatcher->addListener('pim.schema.after.propertyAnnotation', function(\Areanet\PIM\Classes\Event $event){
        $properties         = $event->getParam('properties');
        $propertyAnnotation = $event->getParam('propertyAnnotation');

        if ($propertyAnnotation instanceof \Areanet\PIM\Classes\Annotations\Rte) {
            $properties['extend'][] = "{'toolbar1': 'bold italic'}";
            $event->setParam('properties', $properties);
        }

    });

    return $dispatcher;

});

Spezielle Anpassung für Properties

Zusätzlich können auch einzelne RTEs für spezielle Properties gezielt angepasst werden.

custom/Entity/Produkt.php

1
2
3
4
5
6
/**
 * @ORM\Column(type="text", nullable=true)
 * @PIM\Config(label="Beschreibung")
 * @PIM\RTE(extend="{'toolbar1': 'bold italic'}")
 */
protected $beschreibungLang;