analogwp / analogwp-templates

Style Kits for Elementor adds a number of intuitive styling controls in the Elementor editor that allow you to apply styles globally or per page.
https://analogwp.com
27 stars 7 forks source link

Re-render editor page config on kit save #481

Closed lushkant closed 3 years ago

lushkant commented 3 years ago

Addresses #479

Solution

We are now re-rendering page config on kit save as, this fixes two things, first is to update the page Style Kit control to have the newly created kit and second is to avoid an error while we call the setExternalChange option to set/apply this newly created kit as the current page kit.

Remaining problem

While setting the newly created kit to Page Settings > Style Kit control via ang-action.js goes away when the page triggers Kit editor to load new kit styles.

How to replicate this

  1. From Elementor editor screen, open the Theme Style editor aka kit editor.
  2. Now go to the Style Kits panel and then Theme Style Kit tab, Resave current kit with any name.
  3. It'll now re-render the page and set the Style Kit control to the newly created id.
  4. After this the kit editor gets triggered to load the newly created kit styles, now close this kit editor and go back to initial Elementor page edit screen.
  5. Check the Style Kit control at Page settings it will have the previously set kit as current kit instead of the new kit.

A look at the code

I'm open to any solution you suggest @mauryaratan

lushkant commented 3 years ago

After looking at countless ways of persisting Style Kit control change at Page Settings for a newly created kit, I have found this solution doable, please check and let me know. Please go ahead if you think there is a better way to achieve this 😃

lushkant commented 3 years ago

Merged in #482