Commit 672091d6 authored by Ryan Herbert's avatar Ryan Herbert
Browse files

autocomplete.js allow leading spaces for set completion

parent bf4c380c
......@@ -129,6 +129,12 @@ VidjilAutoComplete.prototype = {
var regex = /([:0-9a-z_\[\]\(\)\-]+\s*)*/ig;
var match = subtext.match(regex);
if (match) {
var filtered = match.filter(function(word) {
return word.length > 0
});
if (filtered.length) {
return filtered[0];
}
return match[0];
}
return null;
......@@ -168,7 +174,7 @@ VidjilAutoComplete.prototype = {
if (!query) {
return li;
}
regexp = new RegExp(">([\\(\\)\\[\\]A-Za-z0-9\\-]*\\s*)+(" + query.replace(/([\+\[\]\(\)\-])/g, function(str, s) { return "\\" + s; }) + ")([\\(\\)\\[\\]A-Za-z0-9\\s\\-]*)<", 'ig');
regexp = new RegExp(">([\\(\\)\\[\\]A-Za-z0-9\\-\\s]*)+(" + query.replace(/([\+\[\]\(\)\-])/g, function(str, s) { return "\\" + s; }) + ")([\\(\\)\\[\\]A-Za-z0-9\\s\\-]*)<", 'ig');
return li.replace(regexp, function(str, $1, $2, $3) {
return '> ' + $1 + '<strong>' + $2 + '</strong>' + $3 + ' <';
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment