fix(ui): add show/hide toggle for API key inputs and populate key on edit

Add eye toggle button for all API key input fields so users can verify their keys before saving.

Changes:

- BaseProviderForm: wrap single API key field (Gemini/Codex/Claude/Vertex) with passwordField + toggle button

- BaseProviderForm: wrap per-entry API key fields (OpenAI-compatible) with passwordField + toggle button

- BaseProviderForm: extract applyRawApiKey helper to populate apiKey from resource.raw in edit mode

- BaseProviderForm: sync initialFormSignature with applyRawApiKey to prevent false isDirty

- sharedForm.module.scss: add .passwordField, .passwordInput, .passwordToggle styles

- i18n: add showApiKey/hideApiKey keys to en, zh-CN, zh-TW, ru locale files

- accessibility: add aria-label and title attributes on both toggle buttons
This commit is contained in:
gwdgithubnom
2026-05-27 22:46:00 +08:00
parent d64210fd58
commit 3ef3c684b3
6 changed files with 186 additions and 33 deletions
@@ -490,6 +490,64 @@
}
}
.passwordField {
position: relative;
display: flex;
align-items: center;
}
.passwordInput {
width: 100%;
height: 36px;
padding: 8px 36px 8px 12px;
border-radius: var(--radius-md);
border: 1px solid var(--border-color);
background: var(--bg-primary);
color: var(--text-primary);
font-size: 13px;
font-family: inherit;
box-sizing: border-box;
&::placeholder {
color: var(--text-tertiary);
}
&:focus {
outline: none;
border-color: var(--primary-color);
box-shadow: 0 0 0 3px var(--primary-10);
}
&:disabled {
opacity: 0.6;
cursor: not-allowed;
}
}
.passwordToggle {
position: absolute;
right: 8px;
display: flex;
align-items: center;
justify-content: center;
padding: 4px;
border: none;
background: transparent;
color: var(--text-tertiary);
cursor: pointer;
border-radius: var(--radius-sm);
transition: color $transition-fast;
&:hover:not(:disabled) {
color: var(--text-primary);
}
&:disabled {
opacity: 0.5;
cursor: not-allowed;
}
}
.entriesList {
display: flex;
flex-direction: column;