Use 'white-space: pre-line' for multi-line compliment.

This commit is contained in:
ubertao
2018-09-24 23:01:17 +08:00
parent d76c924ad1
commit ba428c6cfe
2 changed files with 7 additions and 8 deletions

View File

@@ -128,6 +128,10 @@ sup {
text-overflow: ellipsis;
}
.pre-line {
white-space: pre-line;
}
/**
* Region Definitions.
*/

View File

@@ -157,15 +157,10 @@ Module.register("compliments", {
getDom: function() {
var complimentText = this.randomCompliment();
var compliment = document.createTextNode(complimentText);
var wrapper = document.createElement("div");
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright";
complimentText.split("\n").forEach(function(line, index) {
if (index > 0) {
wrapper.appendChild(document.createElement("br"));
}
wrapper.appendChild(document.createTextNode(line));
});
wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright pre-line";
wrapper.appendChild(compliment);
return wrapper;
},