diff --git a/src/components/documents/rich-text-editor.tsx b/src/components/documents/rich-text-editor.tsx index 330cd27..5ccd75b 100644 --- a/src/components/documents/rich-text-editor.tsx +++ b/src/components/documents/rich-text-editor.tsx @@ -59,13 +59,18 @@ export function RichTextEditor({ }, }); - // Keep editor in sync when value is reset externally + // Keep editor in sync when value is reset/loaded externally (e.g. opening a saved pleading). + // Only re-sync when the incoming value differs meaningfully from the current editor HTML so + // we don't fight the user's typing on every keystroke. useEffect(() => { - if (editor && value !== editor.getHTML()) { - editor.commands.setContent(value || "
", { emitUpdate: false }); + if (!editor) return; + const current = editor.getHTML(); + const incoming = value || ""; + if (incoming !== current) { + editor.commands.setContent(incoming, { emitUpdate: false }); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [value === ""]); + }, [value, editor]); if (!editor) return null; diff --git a/src/lib/docx-pleading.ts b/src/lib/docx-pleading.ts index 062bc81..44df40f 100644 --- a/src/lib/docx-pleading.ts +++ b/src/lib/docx-pleading.ts @@ -336,7 +336,7 @@ export function buildPleadingDoc(input: PleadingInput): Document { // Signature block (above footnotes, after body) — right-side, indented ~2/3 of page width const sig = input.signature; - const SIG_INDENT = 6240; // ~4.33" from left margin (page content is 9360 dxa wide) + const SIG_INDENT = 5160; // ~3.58" from left margin (shifted 0.75" left of prior 6240) const sigParagraph = (children: TextRun[]) => new Paragraph({ indent: { left: SIG_INDENT }, children }); if (sig && (sig.block?.trim() || sig.imageBytes || sig.typed?.trim())) { diff --git a/src/lib/pdf-pleading.ts b/src/lib/pdf-pleading.ts index afa29f9..9f1cbd5 100644 --- a/src/lib/pdf-pleading.ts +++ b/src/lib/pdf-pleading.ts @@ -327,7 +327,7 @@ export async function downloadPleadingPdf(input: PleadingInput, filename: string // Signature block (above footnotes) — right-side, indented ~2/3 of page width const sig = input.signature; - const SIG_X = MARGIN + CONTENT_W * (2 / 3) - 54; // shifted 0.75" left + const SIG_X = MARGIN + CONTENT_W * (2 / 3) - 108; // shifted 1.5" left of the 2/3 mark if (sig && (sig.block?.trim() || sig.imageDataUrl || sig.typed?.trim())) { ensureSpace(LINE_H * 6); y += LINE_H * 1.5;