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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user