Browse Source

Avoid undefined command in ButtonView

pull/652/head
Artur Arseniev 8 years ago
parent
commit
cdabf4e0b9
  1. 8
      dist/grapes.js
  2. 2
      src/panels/view/ButtonView.js

8
dist/grapes.js

@ -32462,12 +32462,12 @@ module.exports = Backbone.View.extend({
var model = this.model;
var context = model.get('context');
var parent = this.parentM;
var command = null;
var command = {};
var editor = this.em && this.em.get ? this.em.get('Editor') : null;
var commandName = model.get('command');
if (this.commands && (0, _underscore.isString)(commandName)) {
command = this.commands.get(commandName);
command = this.commands.get(commandName) || {};
} else if ((0, _underscore.isFunction)(commandName)) {
command = { run: commandName };
} else if (commandName !== null && (0, _underscore.isObject)(commandName)) {
@ -32479,7 +32479,7 @@ module.exports = Backbone.View.extend({
model.set('active', true, { silent: true }).trigger('checkActive');
parent && parent.set('active', true, { silent: true }).trigger('checkActive');
if (command && command.run) {
if (command.run) {
command.run(editor, model, model.get('options'));
editor.trigger('run:' + commandName);
}
@ -32491,7 +32491,7 @@ module.exports = Backbone.View.extend({
model.collection.deactivateAll(context);
parent && parent.set('active', false, { silent: true }).trigger('checkActive');
if (command && command.stop) {
if (command.stop) {
command.stop(editor, model, model.get('options'));
editor.trigger('stop:' + commandName);
}

2
src/panels/view/ButtonView.js

@ -208,7 +208,7 @@ module.exports = Backbone.View.extend({
var commandName = model.get('command');
if (this.commands && isString(commandName)) {
command = this.commands.get(commandName);
command = this.commands.get(commandName) || {};
} else if (isFunction(commandName)) {
command = { run: commandName };
} else if (commandName !== null && isObject(commandName)) {

Loading…
Cancel
Save