I've created a widget with a wysiwyg inside it (with the class from this module Dmatthew\WidgetParameters\Block\Adminhtml\Widget\Type\Wysiwyg)


When I'm adding my content, with the strong, underline or other html tag, it's working fine.

But if I change the color (it's adding a span) with style="color:blue", the quote from the style is cutting my content.

Is there a way to prevent it ?

    public function prepareElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
    $editor = $this->factoryElement->create('editor', ['data' => $element->getData()])
                'add_variables' => false,
                'add_widgets' => false,
                'add_images' => false

    if ($element->getRequired()) {

        'after_element_html', $this->_getAfterElementHtml() . $editor->getElementHtml()
    $element->setValue(''); // Hides the additional label that gets added.

    return $element;

EDIT : this is what I get after saving my widget. All the word after I've added a color (with the wysiwyg) to the text is cut (and show span in wysiwyg)

enter image description here

enter image description here

EDIT 2 : this is my widget definition :

Video Vidéo et description
    <parameter name="url" xsi:type="text" required="true" visible="true">
        <label translate="true">Identifiant Youtube de la vidéo</label>

    <parameter name="subtitle" xsi:type="text" required="true" visible="true">
        <label translate="true">Sous titre</label>

    <parameter name="content" xsi:type="block" visible="true" required="true">
        <label translate="true">Contenu associé à la vidéo</label>
        <block class="Dmatthew\WidgetParameters\Block\Adminhtml\Widget\Type\Wysiwyg"/>

  • Please post the content you've done in your wysiwyg, I can't see where you tried to add style in current post. – Vivek Kumar Jan 5 at 6:33
  • See my updated answer – Morgan Tartreau Jan 5 at 8:39
  • What is the data length for the wysiwyg content on your database? – Tuyen Nguyen Jan 5 at 14:13
  • I don't know, i've updated my question with my widget definition – Morgan Tartreau Jan 5 at 14:26
  • Could this append because my wysiwig is from a custom widget and the widget is in a bloc ? because in admin/admin/widget_instance this is working fine ! – Morgan Tartreau Jan 5 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.