feat(ext/popup/field-history): colorize revealed password entries
Import colorizePassword and post-process .revealed value cells after innerHTML render, replacing escaped-HTML text with colored spans via the valueStore plaintext lookup.
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
/// Field history view — shows password/concealed field history for an item.
|
/// Field history view — shows password/concealed field history for an item.
|
||||||
|
|
||||||
import { getState, setState, sendMessage, navigate, escapeHtml } from '../../shared/state';
|
import { getState, setState, sendMessage, navigate, escapeHtml } from '../../shared/state';
|
||||||
|
import { colorizePassword } from '../../shared/password-coloring';
|
||||||
import type { FieldHistoryView } from '../../shared/types';
|
import type { FieldHistoryView } from '../../shared/types';
|
||||||
|
|
||||||
function relativeTime(unixSec: number): string {
|
function relativeTime(unixSec: number): string {
|
||||||
@@ -103,6 +104,16 @@ export async function renderFieldHistory(app: HTMLElement): Promise<void> {
|
|||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
// Colorize revealed entries: replace plain-text content with colorized spans
|
||||||
|
app.querySelectorAll<HTMLElement>('.history-entry__value.revealed').forEach((el) => {
|
||||||
|
const key = el.closest<HTMLElement>('.history-entry')?.dataset.entry ?? '';
|
||||||
|
const plaintext = valueStore.get(key);
|
||||||
|
if (plaintext !== undefined) {
|
||||||
|
el.textContent = '';
|
||||||
|
el.appendChild(colorizePassword(plaintext));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Wire handlers
|
// Wire handlers
|
||||||
app.querySelector<HTMLButtonElement>('#back-btn')?.addEventListener('click', () => navigate('detail'));
|
app.querySelector<HTMLButtonElement>('#back-btn')?.addEventListener('click', () => navigate('detail'));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user