Adding "replace all" functionality to replace find & replace tool
[redakcja.git] / redakcja / static / js / wiki / view_search.js
index 740c913..e41f19d 100644 (file)
@@ -7,6 +7,7 @@
         var old_callback = options.callback || function() { };
 
         this.noupdate_hash_onenter = true;
+        this.vsplitbar = 'ZNAJDŹ I ZAMIEŃ';
 
         options.callback = function(){
             var self = this;
         else {}
         self.searchCursor.select();
         self.searchCursor.replace(query);
-        self.search();
+        if(self.options['replace-all']) {
+            while(self.search())
+                self.replace();
+        }
     };
 
     SearchPerspective.prototype.onEnter = function(success, failure){
         self.$searchCursor = null;
 
         $('.vsplitbar').not('.active').trigger('click');
+        $(".vsplitbar-title").html("↓ ZNAJDŹ I ZAMIEŃ ↓");        
+        
         if ($.wiki.activePerspective() != 'CodeMirrorPerspective')
             $.wiki.switchToTab('#CodeMirrorPerspective');
     };
 
     $.wiki.SearchPerspective = SearchPerspective;
 
-})(jQuery);
\ No newline at end of file
+})(jQuery);