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 @@ +