mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-09 17:19:45 +02:00
wip: some nullability changes...?
This commit is contained in:
@@ -85,7 +85,7 @@ export class FlowDB implements DiagramDB {
|
|||||||
return common.sanitizeText(txt, this.config);
|
return common.sanitizeText(txt, this.config);
|
||||||
}
|
}
|
||||||
|
|
||||||
private sanitizeNodeLabelType(labelType: string) {
|
private sanitizeNodeLabelType(labelType?: string) {
|
||||||
switch (labelType) {
|
switch (labelType) {
|
||||||
case 'markdown':
|
case 'markdown':
|
||||||
case 'string':
|
case 'string':
|
||||||
@@ -219,7 +219,7 @@ export class FlowDB implements DiagramDB {
|
|||||||
|
|
||||||
if (doc?.label) {
|
if (doc?.label) {
|
||||||
vertex.text = doc?.label;
|
vertex.text = doc?.label;
|
||||||
vertex.labelType = this.sanitizeNodeLabelType(doc?.labelType ?? 'markdown');
|
vertex.labelType = this.sanitizeNodeLabelType(doc?.labelType);
|
||||||
}
|
}
|
||||||
if (doc?.icon) {
|
if (doc?.icon) {
|
||||||
vertex.icon = doc?.icon;
|
vertex.icon = doc?.icon;
|
||||||
@@ -279,7 +279,7 @@ export class FlowDB implements DiagramDB {
|
|||||||
if (edge.text.startsWith('"') && edge.text.endsWith('"')) {
|
if (edge.text.startsWith('"') && edge.text.endsWith('"')) {
|
||||||
edge.text = edge.text.substring(1, edge.text.length - 1);
|
edge.text = edge.text.substring(1, edge.text.length - 1);
|
||||||
}
|
}
|
||||||
edge.labelType = linkTextObj.type;
|
edge.labelType = this.sanitizeNodeLabelType(linkTextObj.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type !== undefined) {
|
if (type !== undefined) {
|
||||||
@@ -714,7 +714,7 @@ You have to call mermaid.initialize.`
|
|||||||
title: title.trim(),
|
title: title.trim(),
|
||||||
classes: [],
|
classes: [],
|
||||||
dir,
|
dir,
|
||||||
labelType: _title.type,
|
labelType: this.sanitizeNodeLabelType(_title?.type),
|
||||||
};
|
};
|
||||||
|
|
||||||
log.info('Adding', subGraph.id, subGraph.nodes, subGraph.dir);
|
log.info('Adding', subGraph.id, subGraph.nodes, subGraph.dir);
|
||||||
|
Reference in New Issue
Block a user