Browse Source

Store the wrapper if `avoidInlineStyle` is false

pull/1518/head
Artur Arseniev 8 years ago
parent
commit
6703c01b5f
  1. 8
      src/dom_components/config/config.js
  2. 7
      src/dom_components/index.js

8
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

7
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);
}

Loading…
Cancel
Save