Skip to content

custom widget with wysiwyg problem on insert widget via pages or blocks #13409

Closed
@deagleka

Description

@deagleka

Preconditions
Magento v2.2.2
Cache disabled

Steps to reproduce
1.created a custom widget with text field using editor to activate wysiwyg
widget.xml file:
<parameter name="custom_title" xsi:type="block" visible="true" required="true"> <label translate="true">Title</label><block class="VendorName\NameSpace\Block\Adminhtml\Widget\TextAreaField"/></parameter>

TextAreaField block:
$editor = $this->_factoryElement->create('editor', ['data' => $element->getData()])->setLabel('')->setWysiwyg(true) ->setConfig($this->getWysiwygConfig($element))->setForceLoad(true) ->setForm($element->getForm());

  1. Create custom widget with 2 different ways:
    a. via Admin -> Content -> Widgets : This works fine, everything is ok.
    b. via Admin -> Content -> Pages -> Home Page -> Content -> Insert Widget : Problem starting from here.

Expected result

  1. an image of Magento Widget should appear
    image
  2. if check via code, it should have this below code:
    {{widget type="VendorName\NameSpace\Block\Widget\CustomWidget" custom_title="abc" template="VendorName_NameSpace::widget/master-template.phtml"}}

Actual result

  1. If I turn off wysiwyg on my custom widget: it works fine.

  2. If I turn wysiwyg on: Image and Code doesnt show up.

  3. If I turn off wysiwyg and make my widget code appear -> then edit it by double click on the image -> change the text into wysiwyg -> save.
    The image still there, however if checking the value : content not change -> there is another widget image appear in the content if turn on wysiwyg.

Note
I think it is some kind of duplicate wysiwyg command mceInsertContent in lib/web/mage/adminhtml/wysiwyg/widget.js line 383
this.getWysiwyg().execCommand('mceInsertContent', false, content);

Hope this help. Have been stucked for this problem more than 2 days. Need help. Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.3.xThe issue has been fixed in 2.3 release lineIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions