feat: 优化 Mermaid 初始化配置,支持多种图表类型
- 添加 ER 图配置(需求 2.3) - 添加状态图配置(需求 2.4) - 添加类图、饼图、Git 图、用户旅程图配置 - 优化注释,明确标注需求对应关系 - 保持主题自动切换和安全级别配置(需求 2.1) - 完成任务 2.2
This commit is contained in:
@@ -4869,23 +4869,52 @@ void 0;
|
|||||||
const theme = this.getMermaidTheme();
|
const theme = this.getMermaidTheme();
|
||||||
|
|
||||||
// 配置 Mermaid
|
// 配置 Mermaid
|
||||||
|
// 需求 2.1-2.4: 支持多种图表类型,设置正确的主题和安全级别
|
||||||
try {
|
try {
|
||||||
window.mermaid.initialize({
|
window.mermaid.initialize({
|
||||||
startOnLoad: false, // 手动控制渲染时机
|
startOnLoad: false, // 手动控制渲染时机
|
||||||
theme: theme,
|
theme: theme, // 根据网站主题自动切换
|
||||||
securityLevel: 'loose', // 允许 HTML 标签
|
securityLevel: 'loose', // 允许 HTML 标签
|
||||||
logLevel: this.config.debugMode ? 'debug' : 'error',
|
logLevel: this.config.debugMode ? 'debug' : 'error',
|
||||||
|
// 流程图配置 (需求 2.2)
|
||||||
flowchart: {
|
flowchart: {
|
||||||
useMaxWidth: true,
|
useMaxWidth: true,
|
||||||
htmlLabels: true,
|
htmlLabels: true,
|
||||||
curve: 'basis'
|
curve: 'basis'
|
||||||
},
|
},
|
||||||
|
// 时序图配置
|
||||||
sequence: {
|
sequence: {
|
||||||
useMaxWidth: true,
|
useMaxWidth: true,
|
||||||
wrap: true
|
wrap: true
|
||||||
},
|
},
|
||||||
|
// 甘特图配置
|
||||||
gantt: {
|
gantt: {
|
||||||
useMaxWidth: true
|
useMaxWidth: true
|
||||||
|
},
|
||||||
|
// ER 图配置 (需求 2.3)
|
||||||
|
er: {
|
||||||
|
useMaxWidth: true,
|
||||||
|
layoutDirection: 'TB'
|
||||||
|
},
|
||||||
|
// 状态图配置 (需求 2.4)
|
||||||
|
stateDiagram: {
|
||||||
|
useMaxWidth: true
|
||||||
|
},
|
||||||
|
// 类图配置
|
||||||
|
class: {
|
||||||
|
useMaxWidth: true
|
||||||
|
},
|
||||||
|
// 饼图配置
|
||||||
|
pie: {
|
||||||
|
useMaxWidth: true
|
||||||
|
},
|
||||||
|
// Git 图配置
|
||||||
|
gitGraph: {
|
||||||
|
useMaxWidth: true
|
||||||
|
},
|
||||||
|
// 用户旅程图配置
|
||||||
|
journey: {
|
||||||
|
useMaxWidth: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user