Issue #2921Opened July 27, 2020by Davidvlv4 reactions

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

Question

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

Answers (3)

artfAugust 26, 20204 reactions

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)

JoshmamroudJuly 30, 20200 reactions

@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

DavidvlvJuly 31, 20200 reactions

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.

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.