fix(ext/popup): close 3 critical regressions from slice-2 code review
- C1: escapeHtml now escapes " and ' so values stored in data-field-value attributes (concealed rows, copyable rows) round-trip correctly. Prior impl silently truncated passwords containing quotes. +3 regression tests. - C2: centralize view-teardown. login.ts exports teardown() that stops the TOTP ticker and removes the active keydown handler; item-detail.ts and item-form.ts dispatchers call it before rendering the next view; each button handler also calls teardown() locally for belt-and-suspenders. - C3: restore alpha's keyboard shortcuts on login detail view: c (copy username), p (copy password), t (copy TOTP), f (autofill), e (edit), d (trash), plus Escape (back). All gated by the is-editable-target guard so they don't eat keystrokes inside form fields. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,9 +13,12 @@ import { renderSettings } from './components/settings';
|
||||
|
||||
// --- Escape HTML to prevent XSS ---
|
||||
export function escapeHtml(str: string): string {
|
||||
const div = document.createElement('div');
|
||||
div.textContent = str;
|
||||
return div.innerHTML;
|
||||
return str
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.replace(/'/g, ''');
|
||||
}
|
||||
|
||||
// --- State ---
|
||||
|
||||
Reference in New Issue
Block a user