Hi Matthias,
Thank you for your positive response.
It is indeed annoying that the settings are reset to default when you use the block editor. That is certainly not the intention. I’ll look into it and hopefully fix it.
The first step is of course to reproduce it, then I will come back with a solution direction and an estimate of the lead time.
Could you help me by indicating which WP version and plugin version you are using.
Kind regards,
Bram
Hi Bram,
I use WP 6.2.2 and your plugin version 2.1.3.
When I just go in to the editor and save all is fine, but when I click on your block, the layout is reset. The layout field only, not the text fields.
Although, wait, I can’t reproduce the error. Now the settings are kept. Maybe it had to do with migrating the site serveral times or an interfering caching.
Sorry, but as long as I can’t reproduce I mark that as resolved.
Thanks for your time and quick reply.
Matthias
Hi Matthias,
I’m glad it’s not so urgent anymore. Now I can take a slower pace and see if I can make the behavior of the ‘layout’ field a bit more robust and reliable.
Thanks for your efforts.
Regards Bram
-
This reply was modified 1 year, 3 months ago by bramwaas.
I found a way to reproduce the issue and at the same time found that I had already solved it (partly) in version 2.1.3. without mentioning it in the changelog. I have now added this in the changelog.
If you save the block in a version before 2.1.3 (2.1.2 or 2.1.1) the value of the layout field is saved as a character in stead of an integer. (“layout”:”1″ in stead of “layout”:1).
In the front-end this is no problem Php converts it to the correct integer and you see the hierarchical layout.
In the block-editor it is. Javascript doesn’t see an integer value and assigns the default value of 3 (old style). In version 2.1.3 I have solved it at some point during testing by adding an extra parseInt before saving. This works if you save the block with version 2.1.3 but not if the block is saved in an earlier version. But after you change the value in the block editor in v 2.1.3 and save it the issue is gone.
Woah, great, that explains, why I could not reproduce the error twice after migration. Thank you very much.