1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
aceeditors = [];
function highlight(id, word){
clearHighlights();
for(var x = 0; x < id.length; x++) {
var Search = require("ace/search").Search;
var editor = ace.edit(id[x]);
srch = new Search();
srch.set({needle:word});
numbers = [];
numbers = srch.findAll(editor.getSession());
for(var i = 0; i < numbers.length;i++){
editor.getSession().addMarker(numbers[i], "highlighted", "text",false);
}
}
}
function highlightrows(id, from, to){
clearHighlights();
for(var x = 0; x < id.length; x++) {
var Range = require("ace/range").Range;
var editor = ace.edit(id[x]);
editor.getSession().addMarker(new Range(from, 0, to, Number.POSITIVE_INFINITY), "highlighted", "text",false);
}
}
function clearHighlights(){
for(var i = 0; i < aceeditors.length; i++){
var editor = ace.edit(aceeditors[i]);
markers = editor.getSession().getMarkers(false);
$.each(markers, function(index, value){
if(value.clazz == "highlighted") {
editor.getSession().removeMarker(index);
}
});
}
}
|