Implement search on front end

This commit is contained in:
Toby Zerner
2015-06-03 18:10:56 +09:30
parent ea510b5ea0
commit 5d89618bbd
18 changed files with 717 additions and 202 deletions

View File

@ -0,0 +1,13 @@
export default function(string, regexp) {
if (!regexp) {
return string;
}
if (!(regexp instanceof RegExp)) {
regexp = new RegExp(regexp, 'gi');
}
return m.trust(
$('<div/>').text(string).html().replace(regexp, '<mark>$&</mark>')
);
}