wip: some nullability changes...?

This commit is contained in:
Anthony Juckel
2025-06-05 08:47:23 -05:00
parent 44a6434e59
commit b7b05f4a55

View File

@@ -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);