diff --git a/src/dom_components/config/config.js b/src/dom_components/config/config.js index 7b92d98b1..19a17bcf1 100644 --- a/src/dom_components/config/config.js +++ b/src/dom_components/config/config.js @@ -32,9 +32,11 @@ module.exports = { // Open assets manager on create of image component oAssetsOnCreate: true, - // TODO to remove - // Editor should also store the wrapper informations, but as this change might - // break stuff I set ii as an opt-in option, for now. + // Generally, if you don't edit the wrapper in the editor, like + // custom attributes, you don't need the wrapper stored in your JSON + // structure, but in case you need it you can use this option. + // If you have `config.avoidInlineStyle` disabled the wrapper will be stored + // as we need to store inlined style. storeWrapper: 0, // List of void elements diff --git a/src/dom_components/index.js b/src/dom_components/index.js index 4f7b1dd8c..d9a90af4d 100644 --- a/src/dom_components/index.js +++ b/src/dom_components/index.js @@ -363,9 +363,10 @@ module.exports = () => { } if (keys.indexOf('components') >= 0) { - const toStore = c.storeWrapper - ? this.getWrapper() - : this.getComponents(); + const { em } = this; + const storeWrap = + (em && !em.getConfig('avoidInlineStyle')) || c.storeWrapper; + const toStore = storeWrap ? this.getWrapper() : this.getComponents(); obj.components = JSON.stringify(toStore); }