Changes
Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com>
This commit is contained in:
co-authored by
renee-png
parent
0aa50282dd
commit
8b64649cf8
@@ -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 <img>, 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)),
|
||||
|
||||
Reference in New Issue
Block a user