mirror of https://github.com/artf/grapesjs.git
nocodeframeworkdrag-and-dropsite-buildersite-generatortemplate-builderui-builderweb-builderweb-builder-frameworkwebsite-builderno-codepage-builder
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
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]);
|
|
},
|
|
|
|
});
|
|
|