#1295 Bugfix for descriptions

This commit is contained in:
Knut Sveidqvist
2020-04-26 16:01:17 +02:00
parent 76b4b88e4b
commit 507582f40b
5 changed files with 31 additions and 13 deletions

View File

@@ -2,8 +2,12 @@ const createLabel = (vertexText, style, isTitle) => {
const svgLabel = document.createElementNS('http://www.w3.org/2000/svg', 'text');
svgLabel.setAttribute('style', style.replace('color:', 'fill:'));
let rows = [];
if (vertexText) {
if (typeof vertexText === 'string') {
rows = vertexText.split(/\\n|\n|<br\s*\/?>/gi);
} else if (Array.isArray(vertexText)) {
rows = vertexText;
} else {
rows = [];
}
for (let j = 0; j < rows.length; j++) {