diff --git a/dist/grapes.js b/dist/grapes.js index f4e794e2c..141dcfb2b 100644 --- a/dist/grapes.js +++ b/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); } diff --git a/src/panels/view/ButtonView.js b/src/panels/view/ButtonView.js index 7f2c1fa50..8219d8968 100644 --- a/src/panels/view/ButtonView.js +++ b/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)) {