Skip to content
Snippets Groups Projects
Commit 2c70fd21 authored by Mingsong Hu's avatar Mingsong Hu
Browse files

New feature:Support multiple words search

parent bca6eba7
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,24 @@ ...@@ -54,7 +54,24 @@
"multiple": false, "multiple": false,
}, },
search: { search: {
show_only_matches: true show_only_matches: true,
"search_callback": function(str, node) {
//search for any of the words entered
var word, words = [];
var searchFor = str.toLowerCase().replace(/^\s+/g, '').replace(/\s+$/g, '');
if (searchFor.indexOf(' ') >= 0) {
words = searchFor.split(' ');
} else {
words = [searchFor];
}
for (var i = 0; i < words.length; i++) {
word = words[i];
if ((node.text || "").toLowerCase().indexOf(word) >= 0) {
return true;
}
}
return false;
}
}, },
plugins: ["search", "dnd"] plugins: ["search", "dnd"]
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment