magento2: Unable to save page and block changes using Page Builder with enabled js minification.
Preconditions (*)
- Magento 2.3.3 EE
Steps to reproduce (*)
- Stores->Settings->Configuration->Advanced->Developer->JavaScript Settings->Minify JavaScript Files = Yes
- Set production
bin/magento deploy:mode:set production
- Go to Content->Elements->Blocks\Pages->Edit
- Make changes and Save
Expected result (*)
- Possibility to edit and save blocks and pages.
Actual result (*)
- Changes are not saved.
Additional Information
- I can see in browser console that Page Builder tries to load not minified resources. Since we have js minification enabled, in static content exists only minified js.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 29 (8 by maintainers)
@sdzhepa I just want to thank you for carefully responding to the OP about this issue. There has been a habit of closing issues raised that mention Commerce Edition. Instead you chose to provide guidance anyway, and I think that’s an example for Adobe to follow when dealing with the community, since Open-Source and Commerce are (for the time being) very closely related.
I have made module based on @LordHansolo reply, it is working perfectly. https://github.com/kushaljindal92/magentoee-pagebuilder-fix
I made some investigation.
The CMS page form and the WYSIWYG editor are connected by the JQuery event which transfers the Page Builder instance from the editor to the form.
See: src/vendor/magento/module-page-builder/view/adminhtml/web/js/form/element/wysiwyg.js:91
src/vendor/magento/module-page-builder/view/adminhtml/web/js/form/form-mixin.js:27
If the form is initialized earlier than the editor (that often happens after the first/second save of the CMS page/block and page reload), the form is missing this event and doesn’t see the PB instance.
I’ve made a temporary hotfix for CMS Page in my project (maybe someone needs a quick solution):
I used google chrome, firefox and edge. It was happening in every browser.
Disabled minified JS and CSS and I can now save page builder content.
@mugua @LordHansolo If you have an active Magento Commerce subscription you can just ask the Commerce support and they’ll send you a patch.
Thank You @sdzhepa. Hello @mugua. Yes I fixed it. I will provide You part of code and places where they should appear.
In my module I created block that extends Magento\PageBuilder\Block\Adminhtml\Stage\Render and adds two additional methods
isJsMinificationEnabledandgetMinResolverAssetUrl.Next I created template in My module scope
view/adminhtml/templates/stage/render.phtmlwith content from<magento_root>/vendor/magento/module-page-builder/view/adminhtml/templates/stage/render.phtmland add code below after<script src="<?= $block->escapeUrl($block->getRequireJsUrl()); ?>"></script>.Next I created Controller that extends
Magento\PageBuilder\Controller\Adminhtml\Stage\Render. Copy entire execute method and override part below.Next I created adminhtml/di.xml to set preference for Magento\PageBuilder\Controller\Adminhtml\Stage\Render.
Next in module.xml I add Magento_PageBuilder to sequence.
Thats all. Now Page Builder should work fine with enabled js minification.
Hello @LordHansolo
Thank you for contribution and collaboration!
This issue related to Page Builder functionality which is not part of Magento Open Source.
Current repository and issue tracker aimed at Magento Open Source version only and the main focus is community contribution/collaboration. It described in Issue reporting guidelines and it is a part of the issue report template:
But I have asked internal Magento team(who is working on Page Builder) about this issue and
2.3.4