Skip to content
This repository was archived by the owner on Dec 12, 2021. It is now read-only.

Commit ee3bca5

Browse files
author
Max Schmidt
committed
FIX: Insertion search
1 parent 085ec81 commit ee3bca5

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/util.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,21 @@ export default class Util {
9595
var text = edit.getText();
9696
$('#prompt-list').find('.list-item').remove();
9797
var filteredItems = options.listItems.filter(function(element) {
98-
return element.includes(text);
98+
element = element.toLowerCase();
99+
text = text.toLowerCase();
100+
if(text !== '' && text !== ' ' && text !== null && text !== undefined) {
101+
return (element.indexOf(text) > -1 ? true : false);
102+
} else {
103+
return true;
104+
}
99105
});
100106
var listDOMstring = '';
101107
filteredItems.forEach(function(currentValue) {
102108
listDOMstring += '<li class="list-item"><p class="value">';
103109
listDOMstring += currentValue;
104110
listDOMstring += '</p></li>';
105111
});
106-
$('#search-prompt').append(listDOMstring);
112+
$('#prompt-list').append(listDOMstring);
107113
})
108114
$('#search-prompt').find('.list-item').on('click',function(e) {
109115
if($(e.target).hasClass('value')) {

0 commit comments

Comments
 (0)