fix(palette): corriger les options de la palette de recherche inutilisables au clic (le re-rendu au survol detruisait l'element sous le curseur)
This commit is contained in:
+14
-1
@@ -2130,7 +2130,20 @@
|
|||||||
input.blur();
|
input.blur();
|
||||||
}
|
}
|
||||||
function toggle(){ state.open ? close() : open(); }
|
function toggle(){ state.open ? close() : open(); }
|
||||||
function setIndex(i){ if(i>=0 && i<state.items.length){ state.index=i; render(); } }
|
function setIndex(i){
|
||||||
|
if(i>=0 && i<state.items.length) state.index=i;
|
||||||
|
// Toggle the active class without rebuilding #fd-cp-list: re-rendering on
|
||||||
|
// hover destroys the element under the cursor and breaks the next click.
|
||||||
|
var nodes = list.querySelectorAll('.cmd-palette-item');
|
||||||
|
for(var j=0;j<nodes.length;j++){
|
||||||
|
if(parseInt(nodes[j].getAttribute('data-idx'),10)===state.index){
|
||||||
|
nodes[j].classList.add('active');
|
||||||
|
nodes[j].scrollIntoView({block:'nearest'});
|
||||||
|
} else {
|
||||||
|
nodes[j].classList.remove('active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
function choose(i){
|
function choose(i){
|
||||||
var it = state.items[i]; if(!it) return;
|
var it = state.items[i]; if(!it) return;
|
||||||
if(it.run){ var ok = it.run(); if(ok) close(); return; }
|
if(it.run){ var ok = it.run(); if(ok) close(); return; }
|
||||||
|
|||||||
Reference in New Issue
Block a user