implemented mouse action on dropdown
Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
@@ -42,6 +42,16 @@
|
||||
console.warn(`${candidate.display} selected, but onSelect not overridden!`)
|
||||
}
|
||||
|
||||
async function ondblclick(evt){
|
||||
const select = evt.target;
|
||||
const idx = select.value;
|
||||
candidate = candidates[idx];
|
||||
candidates = [];
|
||||
selected = [];
|
||||
console.log(candidate);
|
||||
onSelect(candidate);
|
||||
}
|
||||
|
||||
async function onkeyup(ev){
|
||||
if (ignore.includes(ev.key)) return;
|
||||
if (ev.key == 'ArrowDown'){
|
||||
@@ -96,7 +106,7 @@
|
||||
<div>
|
||||
<input type="text" bind:value={candidate.display} {onkeyup} />
|
||||
{#if candidates && candidates.length > 0}
|
||||
<select bind:value={selected} multiple tabindex="-1">
|
||||
<select bind:value={selected} {ondblclick} multiple tabindex="-1">
|
||||
{#each candidates as candidate,i}
|
||||
<option value={i}>{candidate.display}</option>
|
||||
{/each}
|
||||
|
||||
Reference in New Issue
Block a user