Free and Open source Web Builder Framework. Next generation tool for building templates without coding
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

34 lines
671 B

var Backbone = require('backbone');
var CssRule = require('./CssRule');
module.exports = Backbone.Collection.extend({
initialize(models, opt) {
// Inject editor
if(opt && opt.sm)
this.editor = opt.sm;
this.model = (attrs, options) => {
var model;
if(!options.sm && opt && opt.sm)
options.sm = opt.sm;
switch(1){
default:
model = new CssRule(attrs, options);
}
return model;
};
},
add(models, opt) {
if(typeof models === 'string')
models = this.editor.get('Parser').parseCss(models);
return Backbone.Collection.prototype.add.apply(this, [models, opt]);
},
});