grapesjs_codeapps
Version:
Free and Open Source Web Builder Framework/SC Modification
35 lines (29 loc) • 741 B
JavaScript
const Component = require('./Component');
module.exports = Component.extend(
{
defaults: {
...Component.prototype.defaults,
type: 'row',
tagName: 'tr',
draggable: ['thead', 'tbody', 'tfoot'],
droppable: ['th', 'td']
},
initialize(o, opt) {
Component.prototype.initialize.apply(this, arguments);
// Clean the row from non cell components
const cells = [];
const components = this.get('components');
components.each(model => model.is('cell') && cells.push(model));
components.reset(cells);
}
},
{
isComponent(el) {
let result = '';
if (el.tagName == 'TR') {
result = { type: 'row' };
}
return result;
}
}
);