fix: handling annotations

This commit is contained in:
Knut Sveidqvist 2022-01-18 23:21:09 +01:00
parent 44d7dfe993
commit 2210c73ae8
2 changed files with 4 additions and 5 deletions

View File

@ -44,7 +44,7 @@ function addHtmlLabel(node) {
}
const createLabel = (_vertexText, style, isTitle, isNode) => {
let vertexText = sanitizeTxt(_vertexText || '');
let vertexText = _vertexText || '';
if (typeof vertexText === 'object') vertexText = vertexText[0];
if (evaluate(getConfig().flowchart.htmlLabels)) {
// TODO: addHtmlLabel accepts a labelStyle. Do we possibly have that?

View File

@ -139,16 +139,15 @@ export const addMember = function (className, member) {
if (typeof member === 'string') {
// Member can contain white spaces, we trim them out
// const memberString = sanitizeText(member.trim());
const memberString = member.trim();
if (memberString.startsWith('<<') && memberString.endsWith('>>')) {
// Remove leading and trailing brackets
theClass.annotations.push(memberString.substring(2, memberString.length - 2));
theClass.annotations.push(sanitizeText(memberString.substring(2, memberString.length - 2)));
} else if (memberString.indexOf(')') > 0) {
theClass.methods.push(memberString);
theClass.methods.push(sanitizeText(memberString));
} else if (memberString) {
theClass.members.push(memberString);
theClass.members.push(sanitizeText(memberString));
}
}
};