feat(ext/generator): colorize live password preview
This commit is contained in:
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
import { sendMessage } from '../../shared/state';
|
import { sendMessage } from '../../shared/state';
|
||||||
import type { GeneratorRequest, VaultSettings } from '../../shared/types';
|
import type { GeneratorRequest, VaultSettings } from '../../shared/types';
|
||||||
|
import { colorizePassword } from '../../shared/password-coloring';
|
||||||
|
|
||||||
interface UiKnobs {
|
interface UiKnobs {
|
||||||
kind: 'random' | 'bip39';
|
kind: 'random' | 'bip39';
|
||||||
@@ -138,7 +139,10 @@ export function openGeneratorPanel(opts: OpenPanelOpts): void {
|
|||||||
const d = resp.data as { password?: string; passphrase?: string };
|
const d = resp.data as { password?: string; passphrase?: string };
|
||||||
currentPreview = d.password ?? d.passphrase ?? '';
|
currentPreview = d.password ?? d.passphrase ?? '';
|
||||||
const el = host.querySelector('.preview__value');
|
const el = host.querySelector('.preview__value');
|
||||||
if (el) el.textContent = currentPreview;
|
if (el) {
|
||||||
|
el.textContent = '';
|
||||||
|
el.appendChild(colorizePassword(currentPreview));
|
||||||
|
}
|
||||||
updateValidation();
|
updateValidation();
|
||||||
}
|
}
|
||||||
}, 150);
|
}, 150);
|
||||||
|
|||||||
Reference in New Issue
Block a user