fix: 预览里 normalize.css 盖掉了学生自己写的样式

normalize 放在学生的 <style> 后面,同样写法的规则后加载的赢,学生写的 body { margin: 20px }、
h1 { margin: 0 } 等都不生效(实测 body 边距始终是 0)。挪到学生样式前面。
挑战预览、批改、作品展、提示词链、下载的文件都走 buildPreviewDocument,一起修好。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
xuyueandClaude Opus 5.5 committed 2026-10-27 15:04:53 +08:00
1 parent 6f0dd33de3
commit 54003fd404
1 file changed
+2 -1
+2 -1
View File
@@ -30,8 +30,9 @@ export function buildPreviewDocument({
<title>预览</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
${assetBaseUrl ? `<base href="${assetBaseUrl}">` : ""}
<style>${css}</style>
<!-- normalize 要在学生的样式前面,否则同样写法的规则(body、h1 的边距等)会被它盖掉 -->
<link rel="stylesheet" href="/normalize.min.css" />
<style>${css}</style>
</head>
<body>
${html}