silexlabs / Silex

Silex live web creation, free/libre no-code website builder, next gen Webflow for the static web
http://www.silex.me
GNU Affero General Public License v3.0
2.15k stars 573 forks source link

few successive ctrl+Z delete all #1569

Closed oliviermgx closed 4 months ago

oliviermgx commented 4 months ago

Using ctrl+Z in the interface works at the beginning, but if we make few ctrl+Z one after others, at about 10 times or less, all the site is deleted.

lexoyo commented 4 months ago

Ok i reproduce it, thank you !

I believe the problem comes from these lines... In case you want to check it out (and for me to remember if I do it) https://github.com/silexlabs/Silex/blob/dev/src/ts/client/index.ts#L94

Probably they execute before grapesjs had time to parse the data or something

There is an event that i recently discobered which might be worth listening to, it may come after the parsing: canvas:frame:load. It is a GrapesJS event and here is how i used it. It might be a good idea to check if it would fix the bug by using this event in place of the setTimeout, or in addition to it. The event doc is here

Talk to you soon!

oliviermgx commented 4 months ago

solved see ctrlZ_branch_v2

lexoyo commented 4 months ago

ok great @oliviermgx !!! this is merged and will be live in the next release :fireworks: