Fixed saved pleading load & sig

X-Lovable-Edit-ID: edt-04e36f67-f4cc-4d17-b3ae-dbf305c2ae3c
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-04-18 19:56:24 +00:00
co-authored by renee-png
3 changed files with 11 additions and 6 deletions
@@ -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 || "<p></p>", { emitUpdate: false });
if (!editor) return;
const current = editor.getHTML();
const incoming = value || "<p></p>";
if (incoming !== current) {
editor.commands.setContent(incoming, { emitUpdate: false });
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [value === ""]);
}, [value, editor]);
if (!editor) return null;
+1 -1
View File
@@ -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())) {
+1 -1
View File
@@ -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;