fix: raccourcis palette — Ctrl+Shift+Espace fichiers, Ctrl+Alt+Espace commandes
Some checks failed
CI / lint (push) Failing after 4s
CI / test (push) Has been skipped
CI / build (push) Has been skipped
CI / security (push) Successful in 12s

This commit is contained in:
Bruno Charest 2026-06-02 14:01:35 -04:00
parent fc6452d4a4
commit 800a8c34a1

View File

@ -41,12 +41,13 @@ function createDOM() {
<div class="command-palette">
<div class="cp-header">
<input type="text" class="cp-input" placeholder="Rechercher un fichier... (tapez > pour les commandes)" spellcheck="false" autocomplete="off">
<span class="cp-hint">Alt+P</span>
<span class="cp-hint">Ctrl+Shift+Espace</span>
</div>
<div class="cp-results"></div>
<div class="cp-footer">
<span> naviguer</span>
<span> ouvrir</span>
<span>Tab commandes</span>
<span>Esc fermer</span>
</div>
</div>
@ -265,23 +266,15 @@ function escapeHtml(str) {
// ── Init: Register global keyboard shortcut ──
export function initCommandPalette() {
document.addEventListener('keydown', (e) => {
// Alt+P — open palette (Alt+Shift+P for command mode)
if (e.altKey && !e.ctrlKey && !e.metaKey && e.key === 'p') {
// Ctrl+Shift+Espace — open file palette
if ((e.ctrlKey || e.metaKey) && e.shiftKey && !e.altKey && (e.key === ' ' || e.code === 'Space')) {
e.preventDefault();
if (isOpen()) {
close();
} else {
open('');
}
if (isOpen()) { close(); } else { open(''); }
}
// Alt+Shift+P — open in command mode
if (e.altKey && e.shiftKey && !e.ctrlKey && !e.metaKey && e.key === 'p') {
// Ctrl+Alt+Espace — open command palette
if ((e.ctrlKey || e.metaKey) && e.altKey && !e.shiftKey && (e.key === ' ' || e.code === 'Space')) {
e.preventDefault();
if (isOpen()) {
close();
} else {
open('> ');
}
if (isOpen()) { close(); } else { open('> '); }
}
});
}