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', name: 'Left',
property: 'margin-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', name: 'Flex',
open: false, open: false,
@ -362,10 +350,9 @@ require(['config/require-config'], function() {
], ],
}, },
}
); });
window.editor = editor; window.editor = editor;
@ -393,8 +380,7 @@ require(['config/require-config'], function() {
if(sender) sender.set('active', false); if(sender) sender.set('active', false);
if(confirm('Are you sure to clean the canvas?')) { if(confirm('Are you sure to clean the canvas?')) {
var comps = editor.DomComponents.clear(); var comps = editor.DomComponents.clear();
localStorage.setItem('gjs-css', ''); localStorage.clear();
localStorage.setItem('gjs-html', '');
} }
}, },
attributes: { title: 'Empty canvas' } attributes: { title: 'Empty canvas' }

2
src/editor/config/config.js

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

4
src/editor/model/Editor.js

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

Loading…
Cancel
Save