diff --git a/js/app.js b/js/app.js index 6e135ae..3ea3c1b 100644 --- a/js/app.js +++ b/js/app.js @@ -4290,8 +4290,22 @@ function buildCustomFieldRow(field, idx, rerender) { secretBtn.addEventListener('click', ev => { ev.stopPropagation(); field.is_secret = !field.is_secret; + // Update this row in place. rerender() rebuilds every row from scratch + // (list.innerHTML = ''), which the user sees as the panel flashing — + // and it would drop the focus and the auto-sized height too. + secretBtn.classList.toggle('is-on', field.is_secret); + secretBtn.textContent = field.is_secret ? '🔒' : '👁'; + secretBtn.title = field.is_secret + ? 'Stored as secret — masked every time it is opened. Click to make it public.' + : 'Public field — shown in clear. Click to store it as a secret.'; + if (field.multiline) + valueInput.classList.toggle('is-masked', field.is_secret); + else if (valueInput.tagName === 'INPUT') + valueInput.type = field.is_secret ? 'password' : 'text'; + eye.style.visibility = + (!field.is_secret || (valueInput.tagName !== 'INPUT' && !field.multiline)) + ? 'hidden' : ''; soDirtyCheck(); - rerender(); }); const copyBtn = el('button', { class: 'icon-btn icon-btn-sm', type: 'button',