magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.56k stars 9.32k forks source link

WYSIWYG is empty in dynamic rows #38893

Open thomas-kl1 opened 4 months ago

thomas-kl1 commented 4 months ago

Preconditions and environment

Add a design_config_form.xml adminhtml ui component with the following:

<?xml version="1.0" encoding="UTF-8"?>
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
    <fieldset name="other_settings">
        <fieldset name="header">
            <dynamicRows name="top_information">
                <settings>
                    <label translate="true">Top Information</label>
                    <componentType>dynamicRows</componentType>
                </settings>
                <container name="record" component="Magento_Ui/js/dynamic-rows/record">
                    <argument name="data" xsi:type="array">
                        <item name="config" xsi:type="array">
                            <item name="isTemplate" xsi:type="boolean">true</item>
                            <item name="is_collection" xsi:type="boolean">true</item>
                            <item name="componentType" xsi:type="string">container</item>
                        </item>
                    </argument>
                    <field name="caption" formElement="wysiwyg">
                        <argument name="data" xsi:type="array">
                            <item name="config" xsi:type="array">
                                <item name="wysiwygConfigData" xsi:type="array">
                                    <item name="height" xsi:type="string">100px</item>
                                    <item name="add_variables" xsi:type="boolean">true</item>
                                    <item name="add_widgets" xsi:type="boolean">false</item>
                                    <item name="add_images" xsi:type="boolean">false</item>
                                    <item name="add_directives" xsi:type="boolean">false</item>
                                    <item name="pagebuilder_button" xsi:type="boolean">false</item>
                                    <item name="is_pagebuilder_enabled" xsi:type="boolean">false</item>
                                    <item name="toggle_button" xsi:type="boolean">true</item>
                                    <item name="dynamic_id" xsi:type="boolean">true</item>
                                </item>
                            </item>
                        </argument>
                        <settings>
                            <label>Caption</label>
                        </settings>
                        <formElements>
                            <wysiwyg>
                                <settings>
                                    <cols>20</cols>
                                    <rows>8</rows>
                                    <wysiwyg>true</wysiwyg>
                                </settings>
                            </wysiwyg>
                        </formElements>
                    </field>
                    <actionDelete template="Magento_Backend/dynamic-rows/cells/action-delete">
                        <settings>
                            <label>Actions</label>
                            <componentType>actionDelete</componentType>
                        </settings>
                    </actionDelete>
                </container>
            </dynamicRows>
        </fieldset>
    </fieldset>
</form>

Now add a config.xml file in the etc folder of your module (workaround from https://github.com/magento/magento2/issues/38733):

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd">
    <default>
        <design>
            <header>
                <top_information>
                    <row1>
                        <caption><![CDATA[<p>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...<p>]]></caption>
                    </row1>
                    <row2>
                        <caption><![CDATA[<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<p>]]></caption>
                    </row2>
                    <row3>
                        <caption><![CDATA[<p>Cras bibendum ullamcorper hendrerit. Pellentesque ultricies molestie leo a consequat.</p><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.<p>]]></caption>
                    </row3>
                </sev_top_information>
            </header>
        </design>
    </default>
</config>

Now you need the di.xml:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Theme\Model\Design\Config\MetadataProvider">
        <arguments>
            <argument name="metadata" xsi:type="array">
                <item name="top_information" xsi:type="array">
                    <item name="path" xsi:type="string">design/header/top_information</item>
                    <item name="fieldset" xsi:type="string">other_settings/header</item>
                    <item name="backend_model" xsi:type="string">Magento\Config\Model\Config\Backend\Serialized\ArraySerialized</item>
                </item>
            </argument>
        </arguments>
    </type>
</config>

Steps to reproduce

Expected result

You can see 3 rows with filled wysiwyg from the default value of config.xml Wysiwyg in rows are always filled and correctly initialized.

Actual result

Rows should be initialized and filled correctly.

Additional information

No response

Release note

No response

Triage and priority

m2-assistant[bot] commented 4 months ago

Hi @thomas-kl1. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:

m2-assistant[bot] commented 4 months ago

Hi @engcom-Hotel. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

engcom-Hotel commented 4 months ago

Hello @thomas-kl1,

Thanks for the report and collaboration!

We can reproduce the issue mentioned here in the main description with the 2.4-develop branch, confirming the issue. For reference, we are attaching the module which helps us in issue reproduction:

Magentoissues.zip

Thanks

github-jira-sync-bot commented 4 months ago

:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12336 is successfully created for this GitHub issue.

m2-assistant[bot] commented 4 months ago

:white_check_mark: Confirmed by @engcom-Hotel. Thank you for verifying the issue.
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

thomas-kl1 commented 4 months ago

Hello @engcom-Hotel

Thanks for confirming this issue. Could you share the ETA (if available) else are you able to tell the severity of this issue? Is any quality patch being implemented?

engcom-Hotel commented 4 months ago

Hello @thomas-kl1,

As I can see, this issue has been triaged as P2, so the internal team will address issues based on their priority.

However, if you are interested, you can also create a community PR with the fix for this issue. We will move forward with that PR accordingly.

Thanks

thomas-kl1 commented 2 weeks ago

Adobe support provided a fix I share here:

ACSD-61656_2.4.7-p3.patch

diff --git a/vendor/magento/module-ui/view/base/web/js/lib/view/utils/dom-observer.js b/vendor/magento/module-ui/view/base/web/js/lib/view/utils/dom-observer.js
index bcb8e97f98669..ea13611dfe92a 100644
--- a/vendor/magento/module-ui/view/base/web/js/lib/view/utils/dom-observer.js
+++ b/vendor/magento/module-ui/view/base/web/js/lib/view/utils/dom-observer.js
@@ -149,7 +149,7 @@ define([
         _.each(watchers.selectors, function (listeners, selector) {
             for (let data of listeners) {
                 if (!data.ctx.contains(node) || !$(node, data.ctx).is(selector)) {
-                    break;
+                    continue;
                 }

                 if (data.type === 'add') {