From 1377af9576d1d80f08e49a794622d39b28eedab3 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 16:31:00 +0000 Subject: [PATCH] Changes Co-authored-by: renee-png <262607627+renee-png@users.noreply.github.com> --- src/components/forms/custom-form-builder.tsx | 28 +++++++++++++++++--- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/components/forms/custom-form-builder.tsx b/src/components/forms/custom-form-builder.tsx index 638baf8..b135bb9 100644 --- a/src/components/forms/custom-form-builder.tsx +++ b/src/components/forms/custom-form-builder.tsx @@ -356,19 +356,39 @@ export function CustomFormBuilder() { const INDENT_STEP = 36; // ~0.5" + const activeIndentNode = (): "heading" | "paragraph" | null => { + if (!editor) return null; + if (editor.isActive("heading")) return "heading"; + if (editor.isActive("paragraph")) return "paragraph"; + return null; + }; + const indent = () => { if (!editor) return; - const cur = Number(editor.getAttributes("paragraph").indent ?? 0); - editor.chain().focus().updateAttributes("paragraph", { indent: cur + INDENT_STEP }).run(); + // Lists: nest the item instead of changing padding + if (editor.isActive("listItem")) { + editor.chain().focus().sinkListItem("listItem").run(); + return; + } + const node = activeIndentNode(); + if (!node) return; + const cur = Number(editor.getAttributes(node).indent ?? 0); + editor.chain().focus().updateAttributes(node, { indent: cur + INDENT_STEP }).run(); }; const outdent = () => { if (!editor) return; - const cur = Number(editor.getAttributes("paragraph").indent ?? 0); + if (editor.isActive("listItem")) { + editor.chain().focus().liftListItem("listItem").run(); + return; + } + const node = activeIndentNode(); + if (!node) return; + const cur = Number(editor.getAttributes(node).indent ?? 0); editor .chain() .focus() - .updateAttributes("paragraph", { indent: Math.max(0, cur - INDENT_STEP) }) + .updateAttributes(node, { indent: Math.max(0, cur - INDENT_STEP) }) .run(); };