Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix js error when disable/enable wysiwyg editor #12141

Merged

Conversation

vovayatsyuk
Copy link
Member

Description

This PR fixes two issues when disable/enable WYSIWYG editor with ui/form/element/helper/service checkbox:

  • Js error in console: Uncaught TypeError: Cannot read property 'controlManager' of null at UiClass.setDisabled (wysiwyg.js:98)
  • Only the last WYSIWYG button will be disabled

Manual testing scenarios

  1. Open app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml

  2. Replace description field with the following code:

    <field name="description" template="ui/form/field" sortOrder="50" formElement="wysiwyg">
        <argument name="data" xsi:type="array">
            <item name="config" xsi:type="array">
                <!--<item name="wysiwygConfigData" xsi:type="array">
                    <item name="settings" xsi:type="array">
                        <item name="theme_advanced_buttons1" xsi:type="string">bold,italic,|,justifyleft,justifycenter,justifyright,|,fontselect,fontsizeselect,|,forecolor,backcolor,|,link,unlink,image,|,bullist,numlist,|,code</item>
                        <item name="theme_advanced_buttons2" xsi:type="boolean">false</item>
                        <item name="theme_advanced_buttons3" xsi:type="boolean">false</item>
                        <item name="theme_advanced_buttons4" xsi:type="boolean">false</item>
                        <item name="theme_advanced_statusbar_location" xsi:type="boolean">false</item>
                    </item>
                    <item name="files_browser_window_url" xsi:type="boolean">false</item>
                    <item name="height" xsi:type="string">100px</item>
                    <item name="toggle_button" xsi:type="boolean">false</item>
                    <item name="add_variables" xsi:type="boolean">false</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">true</item>
                </item>-->
                <item name="source" xsi:type="string">category</item>
                <item name="service" xsi:type="array">
                    <item name="template" xsi:type="string">ui/form/element/helper/service</item>
                </item>
            </item>
        </argument>
        <settings>
            <label translate="true">Description</label>
            <dataScope>description</dataScope>
        </settings>
        <formElements>
            <wysiwyg class="Magento\Catalog\Ui\Component\Category\Form\Element\Wysiwyg">
                <settings>
                    <rows>8</rows>
                    <wysiwyg>true</wysiwyg>
                </settings>
            </wysiwyg>
        </formElements>
    </field>
  3. Navigate to category edit form and try to use "Use Default Value" checkbox below description field.

  4. Js error will be logged to the console and the last button will be disabled only.

  5. Apply the patch to fix js error and all buttons will be disabled.

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)

@ishakhsuvarov ishakhsuvarov added this to the November 2017 milestone Nov 10, 2017
@okorshenko okorshenko merged commit 3b139c4 into magento:2.2-develop Nov 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants