feat: in-app Word document editor with formatting and autosave

↗ view on GitHub · Ethan Ward · 2026-08-18 · cc7f331e

Adds an always-on editor for .docx documents in the viewer: click and
type in the rendered document, a toolbar for bold/italic/underline and
alignment, and autosave a moment after you stop typing. Formatting is
written back into the real .docx, so the letterhead, header, footer,
fonts and signature block are preserved.

Backend (docxTrackedChanges.ts + routes/documents.ts):
- applyFormattedEdits: reconciles edited paragraphs (runs with
  bold/italic/underline/colour/size + alignment) against the current
  document, rebuilding only changed paragraphs and inheriting each
  paragraph's base run properties so fonts carry over.
- edit_document now adds and removes whole paragraphs (a blank line in
  the replacement starts a new paragraph; deleting a paragraph's text
  removes it) via tracked paragraph marks; new column document_edits.mark_w_ids.
- applyUserParagraphEdits (inline text reconcile) and a save-docx
  autosave target.
- New routes: /formatted-edit, /inline-edit, /save-docx, /paragraphs;
  each saves a user version (overwrites the working copy in place, or
  starts a fresh version on top of an upload/assistant edit).

Frontend:
- RichDocxEditor: always-on contentEditable on the rendered document,
  formatting toolbar, debounced autosave; DocPanel routes document-mode
  .docx to it.

Also: golden-rule letter drafting guidance in the assistant prompt.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018RCY6K4dNwdbo9gU3HQ9un
Repository wardethan2000-eng/mike
Author Ethan Ward <ethanward321@hotmail.com>
Authored
Parents 642d4475
Stats 11 files changed , +2789 , -31
Part of In-app DOCX editor

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-cc7f331e.md from inside the repo you want the change in.

⬇ Download capture-commit-cc7f331e.md