function SearchPerspective(options){
var old_callback = options.callback || function() { };
- this.noupdate_hash_onenter = true;
- this.vsplitbar = 'ZNAJDŹ I ZAMIEŃ';
+ this.vsplitbar = 'ZNAJDŹ I ZAMIEŃ';
options.callback = function(){
var self = this;
old_callback.call(this);
};
- $.wiki.Perspective.call(this, options);
+ $.wiki.SidebarPerspective.call(this, options);
};
- SearchPerspective.prototype = new $.wiki.Perspective();
+ SearchPerspective.prototype = new $.wiki.SidebarPerspective();
SearchPerspective.prototype.search = function(){
var self = this;
self.editor = $.wiki.perspectiveForTab('#CodeMirrorPerspective').codemirror
if (!self.searchCursor) {
+ var options = {};
+ options.caseFold = !self.options['search-case-sensitive'];
+ var start = 0;
+ if (self.options['search-from-cursor']) {
+ start = self.editor.getCursor();
+ }
self.searchCursor = self.editor.getSearchCursor(
self.$searchInput.val(),
- self.options['search-from-cursor'],
- !self.options['search-case-sensitive']
+ start,
+ options
);
}
if (self.searchCursor.findNext()) {
- self.searchCursor.select();
+ self.editor.setSelection(self.searchCursor.from(), self.searchCursor.to());
+ self.editor.scrollIntoView({from: self.searchCursor.from(), to: self.searchCursor.to()}, 20);
self.$replaceButton.removeAttr("disabled");
return true;
}
self.search();
}
else {}
- self.searchCursor.select();
+
+ self.editor.setSelection(self.searchCursor.from(), self.searchCursor.to());
+ self.editor.scrollIntoView({from: self.searchCursor.from(), to: self.searchCursor.to()}, 20);
+
self.searchCursor.replace(query);
if(self.search() && self.options['replace-all']) {
self.replace();
SearchPerspective.prototype.onEnter = function(success, failure){
var self = this;
- $.wiki.Perspective.prototype.onEnter.call(this);
+ $.wiki.SidebarPerspective.prototype.onEnter.call(this);
self.$searchCursor = null;
- $('.vsplitbar').not('.active').trigger('click');
- $(".vsplitbar-title").html("↓ ZNAJDŹ I ZAMIEŃ ↓");
-
if ($.wiki.activePerspective() != 'CodeMirrorPerspective')
$.wiki.switchToTab('#CodeMirrorPerspective');
};