From 089cb54011ba25518bbed915c52968636033dd63 Mon Sep 17 00:00:00 2001 From: chenxing Date: Mon, 28 Sep 2026 12:52:45 +0800 Subject: [PATCH] =?UTF-8?q?[CMS-VISUAL]=20F2:=20=E9=97=A8=E6=88=B7?= =?UTF-8?q?=E5=B8=83=E5=B1=80=E5=8C=BA=E5=9D=97=E8=BE=93=E5=87=BA=E7=A8=B3?= =?UTF-8?q?=E5=AE=9A=20id=20+=20data-plb-id=20=E9=94=9A=E7=82=B9=EF=BC=88d?= =?UTF-8?q?isplay:contents=20=E9=9B=B6=E5=B8=83=E5=B1=80=E5=BD=B1=E5=93=8D?= =?UTF-8?q?=EF=BC=89+=20postMessage=20=E9=A2=84=E8=A7=88=E7=9B=91=E5=90=AC?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=EF=BC=88=E9=97=A8=E6=88=B7=E4=BE=A7=2050=20?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=BB=BF=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/portal/PortalPageRenderer.java | 6 ++- .../templates/themes/campus-glow/home.html | 3 ++ .../themes/common/fragments/home-blocks.html | 54 ++++++++++++++++++- .../templates/themes/default/home.html | 6 ++- .../templates/themes/scholar-blue/home.html | 3 ++ 5 files changed, 69 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/yunhai/cms/controller/portal/PortalPageRenderer.java b/src/main/java/com/yunhai/cms/controller/portal/PortalPageRenderer.java index b071ede..ced5540 100644 --- a/src/main/java/com/yunhai/cms/controller/portal/PortalPageRenderer.java +++ b/src/main/java/com/yunhai/cms/controller/portal/PortalPageRenderer.java @@ -353,10 +353,14 @@ public class PortalPageRenderer { } } - /** 区块公共头:type/title,并合成为 category.name 供主题 fragment 复用(block.category.name 取标题) */ + /** 区块公共头:type/title,并合成为 category.name 供主题 fragment 复用(block.category.name 取标题)。 + * F2(docs/20):透传区块 id(编辑器实时预览 postMessage 重排的 DOM 锚点 data-plb-id)。 */ private Map baseBlock(Map spec, String type, String fallbackTitle) { Map block = new HashMap<>(); block.put("type", type); + if (spec.get("id") != null) { + block.put("id", String.valueOf(spec.get("id"))); + } String title = spec.get("title") == null ? "" : String.valueOf(spec.get("title")).trim(); if (title.isEmpty()) { title = fallbackTitle; diff --git a/src/main/resources/templates/themes/campus-glow/home.html b/src/main/resources/templates/themes/campus-glow/home.html index 7bae0f5..4ae4c82 100644 --- a/src/main/resources/templates/themes/campus-glow/home.html +++ b/src/main/resources/templates/themes/campus-glow/home.html @@ -30,7 +30,9 @@ 注意坑④:th:replace(优先级 100)先于 th:case(300)执行——case 必须放父元素、replace 放子元素。 --> + +
@@ -48,6 +50,7 @@ +
diff --git a/src/main/resources/templates/themes/common/fragments/home-blocks.html b/src/main/resources/templates/themes/common/fragments/home-blocks.html index e8c6665..42ad261 100644 --- a/src/main/resources/templates/themes/common/fragments/home-blocks.html +++ b/src/main/resources/templates/themes/common/fragments/home-blocks.html @@ -83,11 +83,17 @@ .plb-notice-warn{background:var(--plb-warn-bg);border-color:var(--plb-warn-border)} .plb-notice-warn .plb-notice-tag{color:var(--plb-warn-fg)} /* 全宽区块必须跨满整行:网格型主题(mint-breeze 系 .home-main 是三列)会把它们塞进单列, - 非网格父容器下 grid-column 无副作用,故由骨架自带。 */ + 非网格父容器下 grid-column 无副作用,故由骨架自带。 + F2(docs/20):布局区块经 .plb-anchor(display:contents 预览锚点)包裹时按子选择器等效覆盖。 */ main > .plb-ticker{grid-column:1 / -1} main > .plb-newshot{grid-column:1 / -1} main > .plb-section{grid-column:1 / -1} main > .plb-notice-bar{grid-column:1 / -1} +main > .plb-anchor{display:contents;grid-column:auto} +main > .plb-anchor > .plb-ticker{grid-column:1 / -1} +main > .plb-anchor > .plb-newshot{grid-column:1 / -1} +main > .plb-anchor > .plb-section{grid-column:1 / -1} +main > .plb-anchor > .plb-notice-bar{grid-column:1 / -1} @media (max-width:768px){ .plb-grid2{columns:1} .plb-imagewall{grid-template-columns:repeat(2,1fr)} @@ -326,3 +332,49 @@ main > .plb-notice-bar{grid-column:1 / -1} th:text="${block['noticeText']}">公告正文 + + + + + diff --git a/src/main/resources/templates/themes/default/home.html b/src/main/resources/templates/themes/default/home.html index e8d41de..1a90f94 100644 --- a/src/main/resources/templates/themes/default/home.html +++ b/src/main/resources/templates/themes/default/home.html @@ -26,8 +26,12 @@ + + - +
+ +
diff --git a/src/main/resources/templates/themes/scholar-blue/home.html b/src/main/resources/templates/themes/scholar-blue/home.html index 64034fe..fa161e8 100644 --- a/src/main/resources/templates/themes/scholar-blue/home.html +++ b/src/main/resources/templates/themes/scholar-blue/home.html @@ -30,7 +30,9 @@ 否则未命中的 case 分支也会求值 fragment 表达式(缺键 Map 访问直接抛错整页 500)。 --> + +
@@ -48,6 +50,7 @@ +