magento2-page-builder icon indicating copy to clipboard operation
magento2-page-builder copied to clipboard

Page builder template append instead of replace

Open afourmeaux opened this issue 2 years ago • 2 comments

Description (*)

Applying page builder templates shouldn't be replacing the current content and it would be more useful if it appended the template to the content. For the time being if i want to use a template for a block that's added in a cms page, i need to create a CMS block that wil be displayed in my CMS page by using the "Block" page builder element. That's a lot of steps to use a template in a full page without saving the full page as a template.

Expected behavior (*)

When applying a template, the content is appended after the existing content.

Benefits

Make the page builder template functionality more useful and reduce the number of CMS block created to manage only a row on a CMS page.

afourmeaux avatar Dec 02 '22 09:12 afourmeaux

Hi @afourmeaux. Thank you for your report. To speed up processing of this issue, make sure that you provided sufficient information.

Add a comment to assign the issue: @magento I am working on this


m2-assistant[bot] avatar Dec 02 '22 09:12 m2-assistant[bot]

I made a patch to make this happen, it would be cleaner if a confirm popin asked if we wanted to remove the existing content to let the choice to the user, but for me this work for the time being.

+++ b/vendor/magento/module-page-builder/view/adminhtml/web/js/modal/template-manager-modal.js
@@ -41,8 +41,6 @@
          */
         applySelected: function (template) {
             if (template) {
-                // Destroy the old content in the stage
-                this.stage.pageBuilder.destroy();
                 $('body').trigger('processStart');

                 stageBuilder(this.stage, template).then(function () {

afourmeaux avatar Jul 17 '24 08:07 afourmeaux