refactor: 将模板示例内容移入模板包

This commit is contained in:
que01 committed 2026-09-25 08:32:57 +08:00
1 parent dd55af8d73
commit 6218ed395b
7 files changed
+517 -18

No files matched your search

+12 -2
View File
@@ -225,6 +225,7 @@ export interface TemplatePackageManifest {
fields: readonly { key: string; binding: string; label: string; required?: boolean }[];
}[];
};
sampleContent?: Partial<Record<BrandTemplateKey, TemplateSampleContent>>;
}
export const templatePackageRegistry: readonly TemplatePackageManifest[] =
@@ -270,7 +271,13 @@ export interface TemplateSampleContent {
categoryKey: string;
}>;
trustContent: Array<{ type: string; title: string; content: string }>;
fields: Array<{ key: string; label: string; type: string; required: boolean }>;
fields: Array<{
key: string;
label: string;
type: string;
required: boolean;
options?: Array<{ label: string; value: string }>;
}>;
capabilityKey: string;
}
@@ -380,7 +387,10 @@ export const templateSampleContent: Record<BrandTemplateKey, TemplateSampleConte
};
export function getTemplateSampleContent(templateKey: string): TemplateSampleContent | undefined {
return templateSampleContent[templateKey as keyof typeof templateSampleContent];
const packageSample = templatePackageRegistry.find((item) =>
item.supportedIndustryTemplates.includes(templateKey as BrandTemplateKey),
)?.sampleContent?.[templateKey as BrandTemplateKey];
return packageSample ?? templateSampleContent[templateKey as keyof typeof templateSampleContent];
}
const linjingEditorialManifest: VisualTemplateManifest = {