Fix newlines not showing up in Abstract/Extra fields

This commit is contained in:
Dan Stillman 2013-11-22 21:58:19 -05:00
parent 305edd893c
commit 64fb9efa76

View File

@ -1295,12 +1295,17 @@
var firstSpace = valueText.indexOf(" "); var firstSpace = valueText.indexOf(" ");
// To support newlines in 'extra' fields, we use multiple // To support newlines in Abstract and Extra fields, use multiple
// <description> elements inside a vbox // <description> elements inside a vbox
if (useVbox) { if (useVbox) {
var lines = valueText.split("\n"); var lines = valueText.split("\n");
for (var i = 0; i < lines.length; i++) { for (var i = 0; i < lines.length; i++) {
var descriptionNode = document.createElement("description"); var descriptionNode = document.createElement("description");
// Add non-breaking space to empty lines to prevent them from collapsing.
// (Just using CSS min-height results in overflow in some cases.)
if (lines[i] === "") {
lines[i] = "\u00a0";
}
var linetext = document.createTextNode(lines[i]); var linetext = document.createTextNode(lines[i]);
descriptionNode.appendChild(linetext); descriptionNode.appendChild(linetext);
valueElement.appendChild(descriptionNode); valueElement.appendChild(descriptionNode);