feat(hotkeys): chaque raccourci se desactive (Suppr pendant la capture)
Off = vk 0, non enregistre : la combinaison reste libre pour les autres applis. Combinaisons retenues en pref DPAPI et rejouees au demarrage, pour qu'un raccourci coupe le reste coffre ferme. Esc annule enfin la capture au lieu de fermer les reglages. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+4
-1
@@ -51,7 +51,7 @@ function renderHotkeyConflicts() {
|
||||
|
||||
// Format a combo for human display: "Ctrl+Shift+L".
|
||||
function autofillComboLabel(c) {
|
||||
if (!c || !c.key) return '— not set —';
|
||||
if (!c || !c.key) return 'Off';
|
||||
const parts = [];
|
||||
if (c.ctrl) parts.push('Ctrl');
|
||||
if (c.alt) parts.push('Alt');
|
||||
@@ -92,6 +92,9 @@ function autofillComboValid(c) {
|
||||
function autofillCaptureFromEvent(e) {
|
||||
const k = e.key;
|
||||
if (k === 'Escape') return 'cancel';
|
||||
// Suppr / Retour arriere pendant la capture = raccourci DESACTIVE : il
|
||||
// n'est plus enregistre, la combinaison reste libre pour une autre appli.
|
||||
if (k === 'Delete' || k === 'Backspace') return 'off';
|
||||
// Ignore pure-modifier keydowns (user is still building the combo).
|
||||
if (k === 'Control' || k === 'Shift' || k === 'Alt' ||
|
||||
k === 'Meta' || k === 'OS') return null;
|
||||
|
||||
@@ -8043,6 +8043,9 @@ async function init() {
|
||||
if (e.key !== 'Escape') return;
|
||||
if (!$('#settingsPanel').classList.contains('is-open')) return;
|
||||
if (document.querySelector('.modal:not(.is-hidden)')) return;
|
||||
// Capture de raccourci armee : Esc l'annule (son propre ecouteur,
|
||||
// enregistre APRES celui-ci), il ne ferme pas les reglages.
|
||||
if (document.querySelector('[data-capturing="1"]')) return;
|
||||
// Busy overlay up (sync/backup running) — don't close under it.
|
||||
if ($('#busyOverlay') && !$('#busyOverlay').classList.contains('is-hidden')) return;
|
||||
// When the search box has focus AND a query, the input's own
|
||||
@@ -8390,7 +8393,7 @@ async function init() {
|
||||
btn.dataset.capturing = '1';
|
||||
btn.classList.add('is-capturing');
|
||||
const original = btn.textContent;
|
||||
btn.textContent = 'Press combo… (Esc to cancel)';
|
||||
btn.textContent = 'Press combo… (Esc cancel · Del off)';
|
||||
// Free our own combos so they reach this listener instead of
|
||||
// firing their hotkey. Restored by finish() / the success path.
|
||||
hotkeyPushSilent = true;
|
||||
@@ -8445,6 +8448,20 @@ async function init() {
|
||||
return;
|
||||
}
|
||||
if (captured === 'cancel') { finish(true); return; }
|
||||
// Cle vide = vk 0 : Delphi n'enregistre pas ce raccourci.
|
||||
if (captured === 'off') {
|
||||
const off = { ctrl: false, shift: false, alt: false, win: false, key: '' };
|
||||
if (kind === 'full') state.autofillHotkeyFull = off;
|
||||
else if (kind === 'password') state.autofillHotkeyPwd = off;
|
||||
else if (kind === 'totp') state.autofillHotkeyTotp = off;
|
||||
else if (kind === 'quickSearch') state.quickSearchHotkey = off;
|
||||
else /* newEntry */ state.newEntryHotkey = off;
|
||||
btn.textContent = autofillComboLabel(off);
|
||||
finish(false);
|
||||
autofillPushHotkeys();
|
||||
saveServerSettings();
|
||||
return;
|
||||
}
|
||||
if (captured === 'invalid'){
|
||||
toast('Unsupported key — use a letter, digit or F-key', 'warning');
|
||||
finish(true);
|
||||
|
||||
Reference in New Issue
Block a user