Merge in change to the Actions api
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 18 Jul 2014 09:44:56 +0000 (11:44 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Fri, 18 Jul 2014 09:44:56 +0000 (11:44 +0200)
src/editor/modules/documentToolbar/actionView.js
src/editor/modules/documentToolbar/documentToolbar.js
src/fnpjs/actions.js

index 74db332..5439045 100644 (file)
@@ -108,9 +108,7 @@ var ActionView = Backbone.View.extend({
         this.trigger('mousedown');
     },
     onExecute: function() {
-        this.action.execute(function(ret) {
-            this.trigger('actionExecuted', this.action, ret);
-        }.bind(this));
+        this.action.execute();
     },
     onSelectionChange: function(e) {
         var select = $(e.target),
index 9ae5c94..6e3d630 100644 (file)
@@ -27,7 +27,7 @@ return function(sandbox) {
             });
 
             group.append(view.dom);
-            view.on('actionExecuted', function(action, ret) {
+            action.on('actionExecuted', function(ret) {
                 sandbox.publish('actionExecuted', action, ret);
             });
 
index f380ed6..b8aa033 100644 (file)
@@ -72,9 +72,13 @@ _.extend(Action.prototype, Backbone.Events, {
         }
         return this._cache;
     },
-    execute: function(callback) {
+    execute: function() {
         var state = this.getState();
-        callback = callback || function() {};
+        
+        var callback = function(ret) {
+            this.trigger('actionExecuted', ret);
+        }.bind(this);
+
         if(state.allowed) {
             return state.execute.call(this, callback, this.params, this.appObject);
         }