mirasvit / module-blog

Magento 2 Blog Extension
https://mirasvit.com/magento-2-extensions/blog.html
Open Software License 3.0
67 stars 48 forks source link

Page builder js issue on save post in Admin #162

Open pepsi10 opened 4 years ago

pepsi10 commented 4 years ago

After upgrade Magento to ver 2.3.2 -p2 when try to save a post in admin Admin -> Content -> Miravit -> Blog Post -> edit a post there is js error:

[ERROR] Page Builder was rendering for 5 seconds without releasing locks.
ConsoleOutputHandler.show @ console-output-handler.min.js:2
(anonymous) @ logger.min.js:6
Logger.processOutput_ @ logger.min.js:6
Logger.log_ @ logger.min.js:3
Logger.error @ logger.min.js:3
(anonymous) @ form-mixin.min.js:1
setTimeout (async) 
save @ form-mixin.min.js:1
(anonymous) @ wrapper.min.js:3
dispatch @ jquery.min.js:338
elemData.handle @ jquery.min.js:311 

Also post edit form is loaded really slowly.

Checked with 1.0.31 and 1.0.33 module-blog versions.

ghost commented 4 years ago

@pepsi10 Experiencing the same issue on 2.3.3. It's possible that the page builder module updates now mean additional UI components / data sources are required but it's difficult to tell without comparing the source.

I've managed to narrow it down to the short_content field in blog_form_post.xml, used for Excerpts. Removing the field allows you to save again but obviously this is not a real solution.

As you can see in the image below, the promise is still pending on save. This is for the second PageBuilder instance which is the short_content field. image

ghost commented 4 years ago

To at least get this working, changing the excerpt field to a textarea does the trick. You do lose pagebuilder/WYSIWYG functionality but given that it's supposed to be a short description this is probably better anyway.

diff --git a/view/adminhtml/ui_component/blog_post_form.xml b/view/adminhtml/ui_component/blog_post_form.xml
index 980bace..9614e3a 100644
--- a/view/adminhtml/ui_component/blog_post_form.xml
+++ b/view/adminhtml/ui_component/blog_post_form.xml
@@ -301,9 +301,9 @@
                     <item name="config" xsi:type="array">
                         <item name="label" xsi:type="string" translate="true">Excerpt</item>
                         <item name="dataType" xsi:type="string">text</item>
-                        <item name="formElement" xsi:type="string">wysiwyg</item>
+                        <item name="formElement" xsi:type="string">textarea</item>
                         <item name="template" xsi:type="string">ui/form/field</item>
-                        <item name="wysiwyg" xsi:type="boolean">true</item>
+                        <item name="wysiwyg" xsi:type="boolean">false</item>
                         <item name="imports" xsi:type="array">
                             <item name="visible" xsi:type="string">blog_post_form.blog_post_form:is_short_content</item>
                         </item>
karyna-t commented 4 years ago

https://github.com/magento/magento2/issues/25620

possible fix https://github.com/magento/magento2-page-builder/pull/304

MattFluidDigital commented 4 years ago

I came across 2 issues after upgraded to Magento 2.3.3. The first is that you cannot save a blog post because there are 2 page builder fields on the page. This can be fixed with the following patch file:

blog_post_edit.log

The second issue after upgrading to 2.3.3 is that the settings cog icon for all of the elements does not load the modal window to allow you to make the changes. This can be fixed with the following patch file:

blog_post_form.log

After applying both of these patches I can now use the module as expected on 2.3.3

I have had to change the prefixes of the patch files from ".patch" to ".log" otherwise they would not upload, so if you change them back it should allow you to apply the patches

sskharate commented 4 years ago

Thanks @MattFluidDigital

I referred your patches for the issue I was having with more than 1 WYSIWYG on category page which prevented me saving categories giving error Page Builder was rendering for 5 seconds without releasing locks
Issue resolved by adding below two lines. Magento version at the time of error : Magento Commerce 2.3.4

<item name="is_pagebuilder_enabled" xsi:type="boolean">true</item>
 <item name="pagebuilder_button" xsi:type="boolean">true</item>

Full field for anyone facing similar issue.

<field name="custom_description" template="ui/form/field" sortOrder="120" 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">false</item>
                        <item name="add_widgets" xsi:type="boolean">false</item>
                        <item name="add_images" xsi:type="boolean">true</item>
                        <item name="add_directives" xsi:type="boolean">true</item>
                        <item name="is_pagebuilder_enabled" xsi:type="boolean">true</item>
                        <item name="pagebuilder_button" xsi:type="boolean">true</item>
                    </item>
                    <item name="source" xsi:type="string">category</item>
                </item>
            </argument>
            <settings>
                <label translate="true">Custom Description</label>
                <dataScope>custom_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>