Browse Source

Fix loading saved CSS #73

pull/80/head
Artur Arseniev 10 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 * @param {Object} data Object of data to load
* @return {Object} Loaded rules * @return {Object} Loaded rules
*/ */
load: function(data){ load: function(data) {
var d = data || ''; var d = data || '';
if(!d && c.stm) if(!d && c.stm)
d = c.em.getCacheLoad(); d = c.em.getCacheLoad();
var obj = ''; var obj = '';
if(d.style){ if(d.styles) {
try{ try{
obj = JSON.parse(d.style); obj = JSON.parse(d.styles);
}catch(err){} }catch(err){}
}else if(d.css) } else if (d.css) {
obj = c.em.get('Parser').parseCss(d.css); obj = c.em.get('Parser').parseCss(d.css);
}
if(obj) if(obj)
rules.reset(obj); rules.reset(obj);

11
src/demo.js

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

2
src/editor/config/config.js

@ -36,7 +36,7 @@ define(function () {
width: '100%', width: '100%',
// CSS that could only be seen (for instance, inside the code viewer) // 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 // CSS for the iframe which containing the canvas, useful if you need to custom something inside
// (eg. the style of the selected component) // (eg. the style of the selected component)

Loading…
Cancel
Save