Browse Source

Disable clearing on render by default, add store/load events

pull/80/head
Artur Arseniev 9 years ago
parent
commit
5609414d70
  1. 20
      src/demo.js
  2. 2
      src/editor/config/config.js
  3. 4
      src/editor/model/Editor.js

20
src/demo.js

@ -178,19 +178,7 @@ require(['config/require-config'], function() {
name: 'Left',
property: 'margin-left',
},],
}/*{
name : 'Center blocksss',
property : 'margins',
type : 'select',
defaults : '0',
list : [{
value : '0',
name : 'Normal',
},{
value : '0 auto',
name : 'Center',
}],
}*/],
}],
},{
name: 'Flex',
open: false,
@ -362,10 +350,9 @@ require(['config/require-config'], function() {
],
},
}
);
});
window.editor = editor;
@ -393,8 +380,7 @@ require(['config/require-config'], function() {
if(sender) sender.set('active', false);
if(confirm('Are you sure to clean the canvas?')) {
var comps = editor.DomComponents.clear();
localStorage.setItem('gjs-css', '');
localStorage.setItem('gjs-html', '');
localStorage.clear();
}
},
attributes: { title: 'Empty canvas' }

2
src/editor/config/config.js

@ -24,7 +24,7 @@ define(function () {
showOffsetsSelected: false,
// Clear the canvas when editor.render() is called
clearOnRender: true,
clearOnRender: false,
// Return JS of components inside HTML from 'editor.getHtml()'
jsInHtml: true,

4
src/editor/model/Editor.js

@ -413,6 +413,7 @@ define(['backbone', 'backboneUndo', 'keymaster', 'Utils', 'StorageManager', 'Dev
sm.store(store, clb);
this.set('changesCount', 0);
this.trigger('storage:store', store);
return store;
},
@ -437,7 +438,7 @@ define(['backbone', 'backboneUndo', 'keymaster', 'Utils', 'StorageManager', 'Dev
* @return {Object}
* @private
*/
getCacheLoad: function(force){
getCacheLoad: function(force) {
var f = force ? 1 : 0;
if(this.cacheLoad && !f)
return this.cacheLoad;
@ -457,6 +458,7 @@ define(['backbone', 'backboneUndo', 'keymaster', 'Utils', 'StorageManager', 'Dev
});
this.cacheLoad = sm.load(load);
this.trigger('storage:load', this.cacheLoad);
return this.cacheLoad;
},

Loading…
Cancel
Save