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) => {