fnp
/
redakcja.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Tighter editor layout with icons.
[redakcja.git]
/
src
/
redakcja
/
static
/
js
/
wiki
/
view_search.js
diff --git
a/src/redakcja/static/js/wiki/view_search.js
b/src/redakcja/static/js/wiki/view_search.js
index
b49671c
..
e8f9e1b
100644
(file)
--- a/
src/redakcja/static/js/wiki/view_search.js
+++ b/
src/redakcja/static/js/wiki/view_search.js
@@
-6,8
+6,7
@@
function SearchPerspective(options){
var old_callback = options.callback || function() { };
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;
options.callback = function(){
var self = this;
@@
-49,10
+48,10
@@
old_callback.call(this);
};
old_callback.call(this);
};
- $.wiki.Perspective.call(this, options);
+ $.wiki.
Sidebar
Perspective.call(this, options);
};
};
- SearchPerspective.prototype = new $.wiki.Perspective();
+ SearchPerspective.prototype = new $.wiki.
Sidebar
Perspective();
SearchPerspective.prototype.search = function(){
var self = this;
SearchPerspective.prototype.search = function(){
var self = this;
@@
-62,14
+61,21
@@
self.editor = $.wiki.perspectiveForTab('#CodeMirrorPerspective').codemirror
if (!self.searchCursor) {
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.searchCursor = self.editor.getSearchCursor(
self.$searchInput.val(),
- s
elf.options['search-from-cursor'],
- !self.options['search-case-sensitive']
+ s
tart,
+ options
);
}
if (self.searchCursor.findNext()) {
);
}
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.$replaceButton.removeAttr("disabled");
return true;
}
@@
-88,7
+94,10
@@
self.search();
}
else {}
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();
self.searchCursor.replace(query);
if(self.search() && self.options['replace-all']) {
self.replace();
@@
-98,12
+107,9
@@
SearchPerspective.prototype.onEnter = function(success, failure){
var self = this;
SearchPerspective.prototype.onEnter = function(success, failure){
var self = this;
- $.wiki.Perspective.prototype.onEnter.call(this);
+ $.wiki.
Sidebar
Perspective.prototype.onEnter.call(this);
self.$searchCursor = null;
self.$searchCursor = null;
- $('.vsplitbar').not('.active').trigger('click');
- $(".vsplitbar-title").html("↓ ZNAJDŹ I ZAMIEŃ ↓");
-
if ($.wiki.activePerspective() != 'CodeMirrorPerspective')
$.wiki.switchToTab('#CodeMirrorPerspective');
};
if ($.wiki.activePerspective() != 'CodeMirrorPerspective')
$.wiki.switchToTab('#CodeMirrorPerspective');
};