feat: 补齐模板预览区域与编辑绑定

This commit is contained in:
que01 committed 2026-10-09 16:14:06 +08:00
1 parent 541304a763
commit c5db30f817
9 files changed
+115 -4

No files matched your search

@@ -253,7 +253,7 @@ export function PresentationEditor({
? trustQuery.data?.find((item) => item.id === selection?.recordId)
: undefined;
const editableSections = filterSectionsForPreviewTarget(
visibleSections.filter((section) => section.target === "brand"),
visibleSections.filter((section) => section.target === "brand" || section.target === "inquiry"),
selectedTarget?.key,
);
const recordSection = useMemo(
@@ -191,10 +191,18 @@ const templateContent = {
page: "home",
target: "brand",
previewTargets: [
{ key: "food.home.identity", label: "主理人身份" },
{ key: "food.home.location", label: "服务地点" },
{ key: "food.home.offerings-heading", label: "餐品区域标题" },
],
fields: [
{
key: "identity",
binding: "brand.config.founder",
previewTarget: "food.home.identity",
label: "主理人姓名",
input: "text",
},
{
key: "stallTitle",
binding: "brand.config.visualPresentation.home.stallTitle",
@@ -295,6 +303,9 @@ test("Admin 按通用预览目标筛选字段并同步品牌草稿", async ({ pa
await expect(page.getByText("小程序页面配置")).toBeVisible();
const preview = page.locator(".component-template-preview");
await expect(preview.locator(".food-home .name")).toContainText("测试主理人");
await preview.locator('[data-editor-target="food.home.identity"]').click();
await expect(page.getByLabel("主理人姓名")).toBeVisible();
await page.keyboard.press("Escape");
const dimensions = await preview.evaluate((element) => {
const canvas = element.querySelector(".component-template-preview__canvas")!;
const name = element.querySelector(".name")!;