From 363a4e77a0f4bd13c2c034cfcd8920bc70d4256e Mon Sep 17 00:00:00 2001 From: Artur Arseniev Date: Fri, 8 Mar 2019 02:00:04 +0100 Subject: [PATCH] Improve the recognition of stateless commands --- src/commands/index.js | 1 + src/panels/view/ButtonView.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/commands/index.js b/src/commands/index.js index f690aadb2..bee7c7bc1 100644 --- a/src/commands/index.js +++ b/src/commands/index.js @@ -371,6 +371,7 @@ module.exports = () => { * @private * */ create(command) { + if (!command.stop) command.noStop = 1; const cmd = CommandAbstract.extend(command); return new cmd(c); } diff --git a/src/panels/view/ButtonView.js b/src/panels/view/ButtonView.js index 7e83ddc4c..67173af93 100644 --- a/src/panels/view/ButtonView.js +++ b/src/panels/view/ButtonView.js @@ -97,8 +97,8 @@ module.exports = Backbone.View.extend({ model.set('active', true, { silent: true }).trigger('checkActive'); commands.runCommand(command, { ...options, sender: model }); - // Disable button if the command was just a function - cmdIsFunc && model.set('active', false); + // Disable button if the command has no stop method + command.noStop && model.set('active', false); } else { this.$el.removeClass(this.activeCls); model.collection.deactivateAll(context);