Browse Source

Improve the recognition of stateless commands

pull/1874/head
Artur Arseniev 7 years ago
parent
commit
363a4e77a0
  1. 1
      src/commands/index.js
  2. 4
      src/panels/view/ButtonView.js

1
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);
}

4
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);

Loading…
Cancel
Save