Browse Source

Fix loading saved CSS #73

pull/80/head
Artur Arseniev 9 years ago
parent
commit
10fdca00ac
  1. 9
      src/css_composer/main.js
  2. 11
      src/demo.js
  3. 2
      src/editor/config/config.js

9
src/css_composer/main.js

@ -107,17 +107,18 @@ define(function(require) {
* @param {Object} data Object of data to load
* @return {Object} Loaded rules
*/
load: function(data){
load: function(data) {
var d = data || '';
if(!d && c.stm)
d = c.em.getCacheLoad();
var obj = '';
if(d.style){
if(d.styles) {
try{
obj = JSON.parse(d.style);
obj = JSON.parse(d.styles);
}catch(err){}
}else if(d.css)
} else if (d.css) {
obj = c.em.get('Parser').parseCss(d.css);
}
if(obj)
rules.reset(obj);

11
src/demo.js

@ -15,6 +15,12 @@ require(['config/require-config'], function() {
fromElement: true,
clearOnRender: 0,
storageManager:{
autoload: 0,
storeComponents: 1,
storeStyles: 1,
},
/*
components: [{
//script: 'var el = this; setInterval(function(){el.style.marginLeft = Math.random() * 50 +"px";}, 1000)',
@ -71,11 +77,6 @@ require(['config/require-config'], function() {
}],
}],
*/
storageManager:{
autoload: 0,
storeComponents: 1,
storeStyles: 1,
},
commands: {
defaults : [{

2
src/editor/config/config.js

@ -36,7 +36,7 @@ define(function () {
width: '100%',
// CSS that could only be seen (for instance, inside the code viewer)
protectedCss: '*{box-sizing: border-box;}body{margin:0;height:auto;background:#fff}#wrapper{min-height:100%; overflow:auto}',
protectedCss: '*{box-sizing: border-box;}body{margin:0;height:auto;background-color:#fff}#wrapper{min-height:100%; overflow:auto}',
// CSS for the iframe which containing the canvas, useful if you need to custom something inside
// (eg. the style of the selected component)

Loading…
Cancel
Save