Ju99ernaut / grapesjs-template-manager

Template and page manager for grapesjs
MIT License
79 stars 35 forks source link

Storage Re-names element IDs #44

Open wunksert opened 10 months ago

wunksert commented 10 months ago

I've built Template manager from source so I can specify where the break is happening

Reproduce

  1. Set editor.storageManager.autosave: true
  2. Create a new layout
  3. Add a basic text element with padding
  4. autosave should trigger
  5. refresh and open the layout you just created
  6. the padding is gone, because the element's ID has changed from id123 to id123-2 so the CSS selector #id123 doesn't select any more

The storage:store and storage:load events are also fired like 10 times. Why is it built like that?

Ju99ernaut commented 10 months ago

For ids setting -2 refer to this issue https://github.com/Ju99ernaut/grapesjs-template-manager/issues/25 also if you’re using autosave save will get triggered on minimal changes such as component selection so those events will be fired multiple times.

wunksert commented 10 months ago

@Ju99ernaut - I uploaded a screen capture to demonstrate. It seems like this is a lot of update calls (storage:store) for adding just one element, doesn't it?

https://github.com/Ju99ernaut/grapesjs-template-manager/assets/12617956/a9463461-a621-4b77-8edd-e14c8f6895a0