From 3da9919e918dda34b7f875f3b7fafce5fefb095d Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 18 Apr 2026 18:30:32 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index ed71a15..6949c63 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -675,8 +675,27 @@ export function CustomFormBuilder() { } }; + const parseImg = (img: HTMLImageElement, parentAlign: "left" | "center" | "right" = "left") => { + const src = img.getAttribute("src") || ""; + if (!src) return; + const w = parseInt(img.getAttribute("width") || "", 10); + const h = parseInt(img.getAttribute("height") || "", 10); + out.push({ + kind: "image", + src, + align: parentAlign, + widthPx: Number.isFinite(w) && w > 0 ? w : undefined, + heightPx: Number.isFinite(h) && h > 0 ? h : undefined, + alt: img.getAttribute("alt") || undefined, + }); + }; + const pushBlock = (el: HTMLElement) => { const tag = el.tagName.toLowerCase(); + if (tag === "img") { + parseImg(el as HTMLImageElement); + return; + } if (tag === "table") { const rows: TableCellSeg[][] = []; el.querySelectorAll("tr").forEach((tr) => {