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

Commit 66a1f59

Browse files
author
Max Schmidt
committed
FIX: search prompt event handling
1 parent 11d10cb commit 66a1f59

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

lib/util.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export default class Util {
138138

139139
edit.onDidChange(function() {
140140
var text = edit.getText();
141+
$('#prompt-list').find('.list-item').off('click');
141142
$('#prompt-list').find('.list-item, .notice').remove();
142143
var filteredItems = options.listItems.filter(function(element) {
143144
text = text.toLowerCase();
@@ -178,6 +179,16 @@ export default class Util {
178179
if(options.icons.length > 0) {
179180
IconHelper.colorize('colored-svg');
180181
}
182+
183+
$('#prompt-list').find('.list-item').on('click',function(e) {
184+
if($(e.target).hasClass('value')) {
185+
var value = $(e.target).data('id');
186+
} else {
187+
var value = $(e.target).find('.value').data('id');
188+
}
189+
modal.destroy();
190+
callback(value);
191+
});
181192
});
182193
var handleCancel = function(e) {
183194
window.removeEventListener('keyup',handleKey,true);
@@ -189,7 +200,7 @@ export default class Util {
189200
handleCancel();
190201
}
191202
}
192-
$('#search-prompt').find('.list-item').on('click',function(e) {
203+
$('#prompt-list').find('.list-item').on('click',function(e) {
193204
if($(e.target).hasClass('value')) {
194205
var value = $(e.target).data('id');
195206
} else {

0 commit comments

Comments
 (0)