mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-14 09:44:51 +01:00
Grammar/rendering for setting style on class node
This commit is contained in:
@@ -84,6 +84,7 @@ export const addClass = function (_id: string) {
|
||||
methods: [],
|
||||
members: [],
|
||||
annotations: [],
|
||||
styles: [],
|
||||
domId: MERMAID_DOM_ID_PREFIX + name + '-' + classCounter,
|
||||
} as ClassNode;
|
||||
|
||||
@@ -454,6 +455,24 @@ export const addClassesToNamespace = function (id: string, classNames: string[])
|
||||
}
|
||||
};
|
||||
|
||||
export const setCssStyle = function (id: string, style: string[]) {
|
||||
if (style !== undefined && style !== null) {
|
||||
const thisClass = classes[id];
|
||||
if (thisClass !== undefined) {
|
||||
style.forEach(function (s) {
|
||||
if (s.includes(',')) {
|
||||
const styles = s.split(',');
|
||||
styles.forEach(function (newStyle) {
|
||||
thisClass.styles.push(newStyle);
|
||||
});
|
||||
} else {
|
||||
thisClass.styles.push(s);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
setAccTitle,
|
||||
getAccTitle,
|
||||
@@ -490,4 +509,5 @@ export default {
|
||||
addClassesToNamespace,
|
||||
getNamespace,
|
||||
getNamespaces,
|
||||
setCssStyle,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user