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
677 B
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;
|
|
},
|
|
|
|
});
|
|
|