You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Our implementation has values with javascript reserved characters like open round brackets which causes atwho to error out on the highlighter callback:
Uncaught SyntaxError: Invalid regular expression:
/>\s*([^<]?)((1)([^<])\s*</: Unterminated group
at new RegExp ()
at EditableController.highlighter (:130:14)
at View.render (:1227:53)
at EditableController.Controller.renderView (:538:22)
at EditableController._callback (:624:21)
at i (:3:6336)
at Model.query (:964:14)
at EditableController.Controller._lookUp (:630:23)
at EditableController.Controller.lookUp (:577:12)
at App.dispatch (:337:22)
Our implementation has values with javascript reserved characters like open round brackets which causes atwho to error out on the highlighter callback:
Uncaught SyntaxError: Invalid regular expression:
/>\s*([^<]?)((1)([^<])\s*</: Unterminated group
at new RegExp ()
at EditableController.highlighter (:130:14)
at View.render (:1227:53)
at EditableController.Controller.renderView (:538:22)
at EditableController._callback (:624:21)
at i (:3:6336)
at Model.query (:964:14)
at EditableController.Controller._lookUp (:630:23)
at EditableController.Controller.lookUp (:577:12)
at App.dispatch (:337:22)
highlighter: function(li, query) {
var regexp;
if (!query) {
return li;
}
regexp = new RegExp(">\s*([^\<]?)(" + query.replace("+", "\+") + ")([^\<])\s*<", 'ig');
return li.replace(regexp, function(str, $1, $2, $3) {
return '> ' + $1 + '' + $2 + '' + $3 + ' <';
});
The function only escapes the + sign and not the others.
As a workaround I have overwritten the highlighter callback:
highlighter = function(li, query){
var regexp;
if (!query) {
return li;
}
query = query.replace(/[-[]/{}()*+?.\^$|]/g, "\$&");
regexp = new RegExp(">\s*([^\<]?)(" + query + ")([^\<])\s*<", 'ig');
return li.replace(regexp, function(str, $1, $2, $3) {
return '> ' + $1 + '' + $2 + '' + $3 + ' <';
});
};
This should be part of the base product.
The text was updated successfully, but these errors were encountered: