Skip to content

Rich Text Notes Editor for Invoice Description #501

Description

@Kingsman-99

Description

The invoice description field is a plain <textarea> that cannot format text, embed links, or organize long notes, limiting the usefulness of invoice descriptions for complex engagements. A lightweight rich text editor that serializes to a safe HTML or Markdown string should replace the plain textarea.

Technical Context

src/components/invoice/NotesEditor.tsx (new) integrates the @tiptap/react editor with the StarterKit extension for bold, italic, lists, and links. The editor stores its output as a sanitized HTML string using DOMPurify before saving to the API via src/hooks/useInvoiceForm.ts. The public invoice status page renders the notes as sanitized HTML using dangerouslySetInnerHTML with the same DOMPurify sanitization. Toolbar buttons use accessible aria-label attributes and role="toolbar".

Acceptance Criteria

  • The notes field on the invoice creation and edit forms renders a toolbar with bold, italic, bullet list, and link buttons
  • Editor output is sanitized with DOMPurify before storage and before rendering on the public page
  • Pasting HTML from an external source strips disallowed tags and attributes
  • The editor is keyboard-navigable: Tab moves to the toolbar, Enter activates toolbar buttons
  • The saved notes render as formatted HTML on src/app/invoice/[id]/page.tsx and the public status page
  • All CI checks (npm test, npm run build, ESLint/TypeScript) pass and the branch has no merge conflicts

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions