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
677 B

var Backbone = require('backbone');
module.exports = Backbone.View.extend({
events: {
'mousedown': 'handleClick',
},
attributes: function () {
return this.model.get('attributes');
},
initialize: function(opts) {
this.editor = opts.config.editor;
},
handleClick: function() {
var command = this.model.get('command');
if (typeof command === 'function') {
command(this.editor);
}
if (typeof command === 'string') {
this.editor.runCommand(command);
}
},
render: function () {
var config = this.editor.getConfig();
this.el.className += ' ' + config.stylePrefix + 'toolbar-item';
return this;
},
});