Commit c4a6d643 authored by Ryan Herbert's avatar Ryan Herbert
Browse files

autocomplete.js samples ignore leading spaces

parent 2046cc47
......@@ -126,7 +126,7 @@ VidjilAutoComplete.prototype = {
var callbacks = self.getDefaultCallbacks()
callbacks.matcher = function(flag, subtext) {
var regex = /([:\s0-9a-z_\[\]\(\)\-]+)/ig;
var regex = /([:0-9a-z_\[\]\(\)\-]+\s*)+/ig;
var match = subtext.match(regex);
if (match) {
return match[0];
......@@ -166,7 +166,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