diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 498a22c..a6ea2b9 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -715,10 +715,22 @@ export function CustomFormBuilder() { if (tag === "ol") return pushListItems(el, true, 0); if (tag === "ul") return pushListItems(el, false, 0); if (["p", "h1", "h2", "h3"].includes(tag)) { - const align = (el.style.textAlign as any) || "left"; + const align = ((el.style.textAlign as any) || "left") as + | "left" + | "center" + | "right" + | "justify"; const indentPx = parseInt(el.style.paddingLeft || "0", 10) || 0; const caption = el.getAttribute("data-caption") === "true"; const heading = tag === "h1" ? 1 : tag === "h2" ? 2 : tag === "h3" ? 3 : 0; + // If the block contains an , emit it as a separate image segment + const imgs = Array.from(el.querySelectorAll("img")); + if (imgs.length > 0) { + const imgAlign: "left" | "center" | "right" = + align === "center" ? "center" : align === "right" ? "right" : "left"; + imgs.forEach((img) => parseImg(img as HTMLImageElement, imgAlign)); + return; + } out.push({ kind: "text", runs: mergeRuns(collectRuns(el)),