X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/73ef2b8442dc95f8b7279de812c30ac8626d5f39..dbbc27e1f646dece854dc54425a6fc5fc22e5eae:/redakcja/static/js/button_scripts.js?ds=inline

diff --git a/redakcja/static/js/button_scripts.js b/redakcja/static/js/button_scripts.js
index 6e729157..37f37a7d 100644
--- a/redakcja/static/js/button_scripts.js
+++ b/redakcja/static/js/button_scripts.js
@@ -307,22 +307,26 @@ ScriptletCenter.prototype.callInteractive = function(opts) {
 
 	$.blockUI({message: $progress, showOverlay: false});
 
+    $('#save-button').attr('disabled', true);
     var input = self.XMLEditorSelectedText(opts.context);
-	self.scriptlets[opts.action](opts.context, opts.extra, input, 0, 0, function(output, move_forward, move_up){
-	    /*if(timer)
-	        clearTimeout(timer);
-	    else */
-        if (input != output) {
-            self.XMLEditorReplaceSelectedText(opts.context, output)
-        }
-        if (move_forward || move_up) {
-            try {
-                self.XMLEditorMoveCursorForward(opts.context, move_forward, move_up)
+    window.setTimeout(function() {
+        self.scriptlets[opts.action](opts.context, opts.extra, input, 0, 0, function(output, move_forward, move_up){
+            /*if(timer)
+                clearTimeout(timer);
+            else */
+            if (input != output) {
+                self.XMLEditorReplaceSelectedText(opts.context, output)
             }
-            catch(e) {}
-        }
-	    $.unblockUI(); // done
-	});
+            if (move_forward || move_up) {
+                try {
+                    self.XMLEditorMoveCursorForward(opts.context, move_forward, move_up)
+                }
+                catch(e) {}
+            }
+            $.unblockUI({onUnblock: function() { $('#save-button').attr('disabled', null)}}); // done
+        });
+    }, 0);
+
 }
 
 ScriptletCenter.prototype.XMLEditorSelectedText = function(editor) {