grapesjs icon indicating copy to clipboard operation
grapesjs copied to clipboard

Style is not copying after cloning the element after Save

Open yashvirsoftobiz opened this issue 8 years ago • 2 comments

Hi @artf. At the first time before saving the template, When I make one element and clone it, the style is coming in the clonned element. That is running fine. But when I save the template using Ajax and Call the below code:-

const LandingPage = {
     html: editor.getHtml(),
     css: editor.getCss(),
     components: null,
     style: null,
   };
     $.ajax({
         type: "POST",
         url: BASE_API_URLss+"/api/addTemplateBuilder",
         headers: {
             'Authorization' : "Bearer " + this.userJson.token
         },
         data: {
             content: LandingPage.html,
             css: LandingPage.css, 
          
         },
         beforeSend: function() 
         {
             $('.save_template_btn').addClass('loading');
         },
         success: function(response)
         {
             editor.setComponents(response.content);
             editor.setStyle(response.css);
      
         },
         error: function(jqXHR, textStatus, errorThrown) 
         { 
            
         }
     });


and then clone the elements, their styling does not applies to the cloned elements. If I comment the editor.setComponents(response.content); and editor.setStyle(response.css); in success function then styling applies to the cloned elements but still does not style applies to the cloned elements after page refresh after save as editor.setComponents(response.content); and editor.setStyle(response.css); on page load and editor init . clonederror

Thanks for help in advance

yashvirsoftobiz avatar Jul 04 '18 12:07 yashvirsoftobiz

Follow the issue template and provide a live demo

artf avatar Jul 10 '18 21:07 artf

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Sep 17 '19 11:09 lock[bot]