Grapesjs: BUG: Autosave not working on style manager when classes are disabled

Created on 27 Jul 2020  路  3Comments  路  Source: artf/grapesjs

Version: 0.16.18

Are you able to reproduce the bug from the demo?

[x ] Yes: https://jsfiddle.net/ju1a0onx/

What is the expected behavior?

Autosave should always call the "store" command after a style change, even when the classes are disabled

What is the current behavior?

When you disable all classes on an element (Or set them all to private - not shown in this sample) and make a style change, the Autosave doesn't kick in, and your changes aren't saved.

Are you able to attach screenshots, screencasts or a live demo?

[x ] Yes
Grapesjs autosave bug.zip

Most helpful comment

Thanks for the report, there is a bug with the editor.load method, which could be currently patched in this way

editor.load(() => {
 const em = editor.getModel();
 em.get('storables').forEach(md => md.postLoad && md.postLoad(em));
});

Actually, if you have used editor.load() only because it doesn't load on start, that because you have to define your custom storage in a plugin, in that way the autoload (true by default) will work correctly (without any temporary patch on your side)

All 3 comments

@Davidvlv I'm experiencing the same issue. I believe it's a combination of the avoidInlineStyles: 1 in the config and no class being selected. It seems to work as expected with avoidInlineStyles: 0

I've tried it out, and that setting does stop it from not saving when it should, but it introduces some other issues on our end with how we're using the output later on. We turned on avoidInlineStyles to avoid these issues.

Thanks for the report, there is a bug with the editor.load method, which could be currently patched in this way

editor.load(() => {
 const em = editor.getModel();
 em.get('storables').forEach(md => md.postLoad && md.postLoad(em));
});

Actually, if you have used editor.load() only because it doesn't load on start, that because you have to define your custom storage in a plugin, in that way the autoload (true by default) will work correctly (without any temporary patch on your side)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

desilvaNSP picture desilvaNSP  路  3Comments

tribulant picture tribulant  路  3Comments

andre2 picture andre2  路  3Comments

adam-gpc picture adam-gpc  路  3Comments

crazyxhz picture crazyxhz  路  3Comments