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 * @private
* */ * */
create(command) { create(command) {
if (!command.stop) command.noStop = 1;
const cmd = CommandAbstract.extend(command); const cmd = CommandAbstract.extend(command);
return new cmd(c); 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'); model.set('active', true, { silent: true }).trigger('checkActive');
commands.runCommand(command, { ...options, sender: model }); commands.runCommand(command, { ...options, sender: model });
// Disable button if the command was just a function // Disable button if the command has no stop method
cmdIsFunc && model.set('active', false); command.noStop && model.set('active', false);
} else { } else {
this.$el.removeClass(this.activeCls); this.$el.removeClass(this.activeCls);
model.collection.deactivateAll(context); model.collection.deactivateAll(context);

Loading…
Cancel
Save