|
|
|
@ -209,8 +209,14 @@ function(Backbone, require) { |
|
|
|
var command = null; |
|
|
|
var editor = this.em && this.em.get ? this.em.get('Editor') : null; |
|
|
|
var commandName = this.model.get('command'); |
|
|
|
if(this.commands) |
|
|
|
|
|
|
|
if (this.commands && typeof commandName === 'string') { |
|
|
|
command = this.commands.get(commandName); |
|
|
|
} else if (commandName !== null && typeof commandName === 'object') { |
|
|
|
command = commandName; |
|
|
|
} else if (typeof commandName === 'function') { |
|
|
|
command = {run: commandName}; |
|
|
|
} |
|
|
|
|
|
|
|
if(this.model.get('active')){ |
|
|
|
|
|
|
|
@ -220,7 +226,7 @@ function(Backbone, require) { |
|
|
|
if(this.parentM) |
|
|
|
this.parentM.set('active', true, { silent: true }).trigger('checkActive'); |
|
|
|
|
|
|
|
if(command){ |
|
|
|
if(command && command.run){ |
|
|
|
command.run(editor, this.model, this.model.get('options')); |
|
|
|
editor.trigger('run:' + commandName); |
|
|
|
} |
|
|
|
@ -232,7 +238,7 @@ function(Backbone, require) { |
|
|
|
if(this.parentM) |
|
|
|
this.parentM.set('active', false, { silent: true }).trigger('checkActive'); |
|
|
|
|
|
|
|
if(command){ |
|
|
|
if(command && command.stop){ |
|
|
|
command.stop(editor, this.model, this.model.get('options')); |
|
|
|
editor.trigger('stop:' + commandName); |
|
|
|
} |
|
|
|
@ -315,4 +321,4 @@ function(Backbone, require) { |
|
|
|
}, |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|