fix(entries): toggle the secret flag in place instead of rebuilding every row

rerender() wipes the whole custom-fields list, which reads as the panel flashing and also drops focus and the auto-sized height of a multiline field.
This commit is contained in:
r-zakarya
2026-08-01 11:06:59 +01:00
parent 4b7f5ff599
commit 6705a8b478
+15 -1
View File
@@ -4290,8 +4290,22 @@ function buildCustomFieldRow(field, idx, rerender) {
secretBtn.addEventListener('click', ev => { secretBtn.addEventListener('click', ev => {
ev.stopPropagation(); ev.stopPropagation();
field.is_secret = !field.is_secret; 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(); soDirtyCheck();
rerender();
}); });
const copyBtn = el('button', { class: 'icon-btn icon-btn-sm', type: 'button', const copyBtn = el('button', { class: 'icon-btn icon-btn-sm', type: 'button',