feat(autofill): "Clear the field before typing" setting (default ON)
The Ctrl+A + Del sent before each field misbehaves on targets where Ctrl+A isn't select-all (terminals, some remote desktops). New synced setting (autofillClearField, Settings > Autofill) gates it: JS appends clear=0 to cmd://autofill/execute when off; ExecuteAutofill wraps the three SendSelectAllAndDelete calls behind AClearFirst. Absent param = ON, so existing behavior is unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -141,7 +141,8 @@ const Bridge = (() => {
|
||||
cmd('cmd://autofill/execute?username=' + encodeURIComponent(username) +
|
||||
'&password=' + encodeURIComponent(password) +
|
||||
(hideAfter ? '&hide_after=1' : '') +
|
||||
(field === 'user' ? '&field=user' : ''));
|
||||
(field === 'user' ? '&field=user' : '') +
|
||||
(state.autofillClearField ? '' : '&clear=0'));
|
||||
},
|
||||
|
||||
// Ask Delphi to bring the main window to front (used when the
|
||||
@@ -643,6 +644,7 @@ const state = {
|
||||
quickUnlockEnabled: localStorage.getItem('quickUnlockEnabled') === '1',
|
||||
recoveryConfigured: false, // refreshed by refreshRecoveryStatus on Settings open
|
||||
autofillEnabled: localStorage.getItem('autofillEnabled') !== '0', // default ON
|
||||
autofillClearField: localStorage.getItem('autofillClearField') !== '0', // default ON
|
||||
// Hotkey combos. Each combo = { ctrl, shift, alt, win, key }.
|
||||
// key is the uppercase character or VK label ('A'..'Z', '0'..'9',
|
||||
// 'F1'..'F12'). Default: Ctrl+Shift+L / Ctrl+Shift+P. Combos are
|
||||
@@ -6341,6 +6343,7 @@ function openSettings() {
|
||||
$('#settingFaviconsRow').style.display = Bridge.active ? '' : 'none';
|
||||
$('#settingFaviconActionsRow').style.display = Bridge.active ? 'flex' : 'none';
|
||||
$('#settingAutofill').checked = state.autofillEnabled;
|
||||
$('#settingAutofillClear').checked = state.autofillClearField;
|
||||
$('#settingAutofillRow').style.display = Bridge.active ? '' : 'none';
|
||||
// Hotkey capture buttons — labels reflect current combos.
|
||||
$('#settingAutofillFullCombo').textContent = autofillComboLabel(state.autofillHotkeyFull);
|
||||
@@ -6750,6 +6753,9 @@ const SYNCED_SETTING_KEYS = [
|
||||
// Unlock method (pw / pin / both). The PIN blob itself is device-local
|
||||
// DPAPI so this synced setting only carries the user's preferred mode.
|
||||
'unlockMode',
|
||||
// Send Ctrl+A + Del before typing each autofill field (default ON).
|
||||
// OFF for targets where Ctrl+A isn't select-all (terminals, RDP).
|
||||
'autofillClearField',
|
||||
];
|
||||
|
||||
// Sets `data-editor-position` on <body> so CSS can swap the slideover
|
||||
@@ -6830,6 +6836,9 @@ async function loadServerSettings() {
|
||||
case 'unlockMode':
|
||||
localStorage.setItem('unlockMode', String(v || 'pw'));
|
||||
break;
|
||||
case 'autofillClearField':
|
||||
localStorage.setItem('autofillClearField', v ? '1' : '0');
|
||||
break;
|
||||
}
|
||||
});
|
||||
// Apply visual settings immediately.
|
||||
@@ -7660,6 +7669,11 @@ async function init() {
|
||||
const lbl = autofillComboLabel(state.autofillHotkeyFull);
|
||||
toast(state.autofillEnabled ? ('Autofill enabled (' + lbl + ')') : 'Autofill disabled');
|
||||
});
|
||||
$('#settingAutofillClear').addEventListener('change', e => {
|
||||
state.autofillClearField = e.target.checked;
|
||||
localStorage.setItem('autofillClearField', e.target.checked ? '1' : '0');
|
||||
saveServerSettings();
|
||||
});
|
||||
|
||||
// ---- Hotkey capture buttons ----
|
||||
// Click → button label becomes "Press combo…" → next keydown captures.
|
||||
|
||||
Reference in New Issue
Block a user