에디터 인라인/속성 패널 리팩터링 및 폼 전송 기본 기능 추가
CI / pr_and_merge (push) Blocked by required conditions
CI / test (push) Has been cancelled

This commit is contained in:
2025-11-20 00:53:39 +09:00
parent 211b0f8230
commit a6ef5f01cd
29 changed files with 3371 additions and 1052 deletions
+85
View File
@@ -0,0 +1,85 @@
"use client";
import type { Block, SectionBlockProps, TextBlockProps } from "@/features/editor/state/editorStore";
export function createFaqTemplateBlocks(opts: {
sectionId: string;
createId: () => string;
}): { blocks: Block[]; lastSelectedId: string } {
const { sectionId, createId } = opts;
const columns: SectionBlockProps["columns"] = [
{ id: `${sectionId}_col_1`, span: 12 },
];
const sectionProps: SectionBlockProps = {
background: "default",
paddingY: "md",
columns,
} as any;
const sectionBlock: Block = {
id: sectionId,
type: "section",
props: sectionProps,
sectionId: null,
columnId: null,
};
const firstColumnId = `${sectionId}_col_1`;
const faqPairs = [
{
question: "자주 묻는 질문 1",
answer: "첫 번째 질문에 대한 답변을 여기에 입력하세요.",
},
{
question: "자주 묻는 질문 2",
answer: "두 번째 질문에 대한 답변을 여기에 입력하세요.",
},
{
question: "자주 묻는 질문 3",
answer: "세 번째 질문에 대한 답변을 여기에 입력하세요.",
},
];
const faqBlocks: Block[] = faqPairs.flatMap((pair) => {
const qId = createId();
const aId = createId();
const questionProps: TextBlockProps = {
text: pair.question,
align: "left",
size: "lg",
} as any;
const answerProps: TextBlockProps = {
text: pair.answer,
align: "left",
size: "sm",
} as any;
const questionBlock: Block = {
id: qId,
type: "text",
props: questionProps,
sectionId,
columnId: firstColumnId,
};
const answerBlock: Block = {
id: aId,
type: "text",
props: answerProps,
sectionId,
columnId: firstColumnId,
};
return [questionBlock, answerBlock];
});
const blocks: Block[] = [sectionBlock, ...faqBlocks];
const lastSelectedId = faqBlocks[faqBlocks.length - 1]?.id ?? sectionId;
return { blocks, lastSelectedId };
}