Update packages/mermaid/src/diagrams/class/classDb.ts

Co-authored-by: Sidharth Vinod <sidharthv96@gmail.com>
This commit is contained in:
Justin Greywolf
2023-12-05 07:57:39 -08:00
committed by GitHub
parent e25515a960
commit 02b2d71eb3

View File

@@ -457,21 +457,17 @@ export const addClassesToNamespace = function (id: string, classNames: string[])
} }
}; };
export const setCssStyle = function (id: string, style: string[]) { export const setCssStyle = function (id: string, styles: string[]) {
if (style !== undefined && style !== null) {
const thisClass = classes[id]; const thisClass = classes[id];
if (thisClass !== undefined) { if (!styles || !thisClass) {
style.forEach(function (s) { return;
}
for (const s of styles) {
if (s.includes(',')) { if (s.includes(',')) {
const styles = s.split(','); thisClass.styles = thisClass.styles.concat(s.split(','));
styles.forEach(function (newStyle) {
thisClass.styles.push(newStyle);
});
} else { } else {
thisClass.styles.push(s); thisClass.styles.push(s);
} }
});
}
} }
}; };