Closed LordHansolo closed 11 months ago
Hi @LordHansolo. Thank you for your report. To help us process this issue please make sure that you provided the following information:
Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:
@magento give me 2.3-develop instance
- upcoming 2.3.x release
For more details, please, review the Magento Contributor Assistant documentation.
@LordHansolo do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?
Hi @engcom-Echo. 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:
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).Details
If the issue has a valid description, the label Issue: Format is valid
will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid
appears.
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description
label to the issue by yourself.
[ ] 3. Add Component: XXXXX
label(s) to the ticket, indicating the components it may be related to.
[ ] 4. Verify that the issue is reproducible on 2.3-develop
branchDetails
- Add the comment @magento give me 2.3-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on 2.3-develop
branch, please, add the label Reproduced on 2.3.x
.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!
[ ] 5. Add label Issue: Confirmed
once verification is complete.
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
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:
Verify, that the issue you are about to report does not relate to the Magento Commerce. GitHub is intended for Magento Open Source users to report on issues related to Open Source only. There are no account management services associated with GitHub. You can report Commerce-related issues in one of two ways:
- You can use the Support portal associated with your account
- If you are a Partner reporting on behalf of a merchant, use the Partner portal.
But I have asked internal Magento team(who is working on Page Builder) about this issue and
2.3.4
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.
Hi Lordhansolo Have you fixed this issue now?
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 isJsMinificationEnabled
and getMinResolverAssetUrl
.
<?php
namespace Fix\PageBuilder\Block\Adminhtml\Stage;
use Magento\Framework\Serialize\Serializer\Json;
use Magento\Framework\View\Asset\Minification;
use Magento\Framework\View\Element\Template\Context;
use Magento\PageBuilder\Block\Adminhtml\Stage\Render as ParentRender;
use Magento\PageBuilder\Model\Stage\Config;
use Magento\RequireJs\Model\FileManager;
/**
* Class Render
*/
class Render extends ParentRender
{
/**
* @var FileManager
*/
private $fileManager;
/**
* @var Minification
*/
private $minification;
/**
* Class constructor
*
* @param Context $context
* @param FileManager $fileManager
* @param Config $config
* @param Json $json
* @param Minification $minification
* @param array $data
*/
public function __construct(
Context $context,
FileManager $fileManager,
Config $config,
Json $json,
Minification $minification,
array $data = []
) {
parent::__construct($context, $fileManager, $config, $json, $data);
$this->fileManager = $fileManager;
$this->minification = $minification;
}
/**
* Check that js minification is enabled
*
* @return boolean
*/
public function isJsMinificationEnabled()
{
return $this->minification->isEnabled('js');
}
/**
* Get min resolver asset url
*
* @return string
*/
public function getMinResolverAssetUrl()
{
$minResolver = $this->fileManager->createMinResolverAsset();
$url = $minResolver ? $minResolver->getUrl() : '';
return $url;
}
}
Next I created template in My module scope view/adminhtml/templates/stage/render.phtml
with content from <magento_root>/vendor/magento/module-page-builder/view/adminhtml/templates/stage/render.phtml
and add code below after <script src="<?= $block->escapeUrl($block->getRequireJsUrl()); ?>"></script>
.
<?php if ($block->isJsMinificationEnabled()) : ?>
<script src="<?= $block->escapeUrl($block->getMinResolverAssetUrl()); ?>"></script>
<?php endif ?>
Next I created Controller that extends Magento\PageBuilder\Controller\Adminhtml\Stage\Render
. Copy entire execute method and override part below.
$renderBlock = $layout->createBlock(
\Fix\PageBuilder\Block\Adminhtml\Stage\Render::class,
'stage_render'
);
$renderBlock->setTemplate('Fix_PageBuilder::stage/render.phtml');
Next I created adminhtml/di.xml to set preference for Magento\PageBuilder\Controller\Adminhtml\Stage\Render.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\PageBuilder\Controller\Adminhtml\Stage\Render" type="Fix\PageBuilder\Controller\Adminhtml\Stage\Render" />
</config>
Next in module.xml I add Magento_PageBuilder to sequence.
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Fix_PageBuilder" setup_version="1.0.0">
<sequence>
<module name="Magento_PageBuilder"/>
</sequence>
</module>
</config>
Thats all. Now Page Builder should work fine with enabled js minification.
@LordHansolo, Could you add my Skype: john.lou@msn.com or offer yours, Thanks. I have a little confuse about this, Thanks.
@mugua @LordHansolo If you have an active Magento Commerce subscription you can just ask the Commerce support and they'll send you a patch.
I have made module based on @LordHansolo reply,, it is working perfectly. https://github.com/kushaljindal92/magentoee-pagebuilder-fix
@Parakoopa Is this patch not listed in the Downloads section our accounts on Magento.com?
@dfelton As far as I know you have to open a support ticket and reference this GitHub issue. That's what we did and they sent us a patch.
@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.
Does anyone have a patch to fix this, I have try to fix it but it still doesn't work? I have used @kushaljindal92's module but it only fix js errors, it still can't save
Does Magento just not test? It seems pretty common for production instances to minify js files.
@minhducnho any solution
It's happening to me in Magento 2.4.6
Issue reported in 2.4.5 EE, especially while using google chrome with magento running on production mode and minified js enabled.
@anton-vidext did you use google chrome ? can you try using firefox? I'm beginning to think it's browser related issue
@anton-vidext did you use google chrome ? can you try using firefox? I'm beginning to think it's browser related issue
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.
Issue reported in 2.4.5 EE, especially while using google chrome with magento running on production mode and minified js enabled.
This is excatly what happens for me. Disabling minified doesn't help for me, but it only happens on Chrome.
Still reproducible in Magento 2.4.6
Hi @engcom-Bravo. 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:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. 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
events.on('pagebuilder:register', function (data) {
if (data.ns === self.ns) {
self.pageBuilderInstances.push(data.instance);
}
});
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):
diff --git a/vendor/magento/module-page-builder/view/adminhtml/web/js/form/form-mixin.js b/vendor/magento/module-page-builder/view/adminhtml/web/js/form/form-mixin.js
--- a/vendor/magento/module-page-builder/view/adminhtml/web/js/form/form-mixin.js
+++ b/vendor/magento/module-page-builder/view/adminhtml/web/js/form/form-mixin.js (date 1683647187438)
@@ -44,6 +44,16 @@
timeout,
locks;
+ let self = this;
+ if (_.isEmpty(this.pageBuilderInstances) & this.name === 'cms_page_form.cms_page_form') {
+ var registry = require('uiRegistry');
+ let contentComponent = registry.get(
+ "cms_page_form.cms_page_form.content.content"
+ );
+
+ self.pageBuilderInstances.push(contentComponent.pageBuilder);
+ }
+
if (_.isEmpty(this.pageBuilderInstances)) {
submit();
} else {
Hi @engcom-November. 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:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. Verified the issue on Magento 2.4-develop instance with enterprise edition modules enabled and the issue is reproducible. Hence confirming the issue.
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-8773 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Hi @LordHansolo Could you please explain about the
<?php if ($block->isJsMinificationEnabled()) : ?>
<?php endif ?>
Why did you add this in render.phtml because I have seen this template but I have not seen the script "" in this template maybe Magento remove this script from the latest version. if you can let me know the reason why you add this code then may I fix it in latest version thanks in advance
Hello @Bilalyounas1234
In Magento 2.3.3 EE the render template probably looked like in the link below.
Additionally You can see the Controller and the Block classes in version 1.6.0 looks different compared to version 1.1.0. Below I provide links to the render template, Render Block and Render Controller in version 1.1.0 and 1.6.0.
v.1.1.0
v.1.6.0
Looking at the solution I provided for Page Builder in Magento 2.3.3 EE, the code below was required to load min resolver in case js minification was enabled.
<?php if ($block->isJsMinificationEnabled()) : ?>
<script src="<?= $block->escapeUrl($block->getMinResolverAssetUrl()); ?>"></script>
<?php endif ?>
Hi @LordHansolo,
Tested on the latest 2.4-develop version. Enabled “Minify JavaScript Files” in the JavaScript Settings of Store Configuration. In production mode, attempted to edit a Block/Page and save it. Despite multiple edits, changes were successfully saved. After exhaustive attempts to reproduce this issue, it has been determined that the problem is no longer reproducible. Hence we are closing this issue.
https://github.com/magento/magento2/assets/51680745/127790b1-8e28-47cc-9ece-c42e1accce3b
Thanks.
Preconditions (*)
Steps to reproduce (*)
bin/magento deploy:mode:set production
Expected result (*)
Actual result (*)
Additional Information