Просмотр исходного кода

💄 (dashboard-v6): 标题里的术语等 antd 组件继承标题字号

antd 6 给 .ant-typography 写死了 font-size: var(--ant-font-size)(14px),
MarkupView 渲染的标题里,术语(Typography.Link / Text)因此比标题小。

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
visuddhinanda 5 часов назад
Родитель
Сommit
24e3f06dad

+ 5 - 1
dashboard-v6/src/components/markup/MarkupView.tsx

@@ -3,6 +3,7 @@ import type { CSSProperties } from "react";
 
 import { renderNodes } from "./render";
 import type { MarkupNode } from "./types";
+import "./markup.css";
 
 const { Text } = Typography;
 
@@ -21,7 +22,10 @@ const MarkupView = ({ nodes, className, placeholder, style }: IWidget) => {
     return <Text type="secondary">{placeholder}</Text>;
   }
   return (
-    <Text className={className} style={style}>
+    <Text
+      className={className ? `markup-view ${className}` : "markup-view"}
+      style={style}
+    >
       {renderNodes(nodes)}
     </Text>
   );

+ 9 - 0
dashboard-v6/src/components/markup/markup.css

@@ -0,0 +1,9 @@
+/*
+ * antd 6 给每个 .ant-typography 都写死了 font-size: var(--ant-font-size)(14px),
+ * 标题里的术语、链接等模板组件(Typography.Link / Text)因此不随标题变大。
+ * 标题里的一律继承标题的字号与行高。
+ */
+.markup-view :is(h1, h2, h3, h4, h5, h6) .ant-typography {
+  font-size: inherit;
+  line-height: inherit;
+}