Commit 9d7f8143 authored by Alfredo Sumaran's avatar Alfredo Sumaran Committed by Douglas Barbosa Alexandre

Merge branch '25681-network-graph-long-commit-msg' into 'master'

Account for newlines in commit messages on network graph

Closes #25681 and #21086

See merge request !8131
parent 70efd615
...@@ -356,7 +356,7 @@ ...@@ -356,7 +356,7 @@
icon = this.image(gon.relative_url_root + commit.author.icon, x, y, 20, 20); icon = this.image(gon.relative_url_root + commit.author.icon, x, y, 20, 20);
nameText = this.text(x + 25, y + 10, commit.author.name); nameText = this.text(x + 25, y + 10, commit.author.name);
idText = this.text(x, y + 35, commit.id); idText = this.text(x, y + 35, commit.id);
messageText = this.text(x, y + 50, commit.message); messageText = this.text(x, y + 50, commit.message.replace(/\r?\n/g, " \n "));
textSet = this.set(icon, nameText, idText, messageText).attr({ textSet = this.set(icon, nameText, idText, messageText).attr({
"text-anchor": "start", "text-anchor": "start",
font: "12px Monaco, monospace" font: "12px Monaco, monospace"
...@@ -368,6 +368,7 @@ ...@@ -368,6 +368,7 @@
idText.attr({ idText.attr({
fill: "#AAA" fill: "#AAA"
}); });
messageText.node.style["white-space"] = "pre";
this.textWrap(messageText, boxWidth - 50); this.textWrap(messageText, boxWidth - 50);
rect = this.rect(x - 10, y - 10, boxWidth, 100, 4).attr({ rect = this.rect(x - 10, y - 10, boxWidth, 100, 4).attr({
fill: "#FFF", fill: "#FFF",
...@@ -404,16 +405,21 @@ ...@@ -404,16 +405,21 @@
s.push("\n"); s.push("\n");
x = 0; x = 0;
} }
x += word.length * letterWidth; if (word === "\n") {
s.push(word + " "); s.push("\n");
x = 0;
} else {
s.push(word + " ");
x += word.length * letterWidth;
}
} }
t.attr({ t.attr({
text: s.join("") text: s.join("").trim()
}); });
b = t.getBBox(); b = t.getBBox();
h = Math.abs(b.y2) - Math.abs(b.y) + 1; h = Math.abs(b.y2) + 1;
return t.attr({ return t.attr({
y: b.y + h y: h
}); });
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment