ConversationWebView: Fix plain text emails sometimes being too wide

Using `whitespace: pre-wrap` to format plain text email sometimes
causes additional width to be allocated by the plain text blocks that
then does not get used due to the constraints on the HTML element.
The allocated space remains however and hence an un-needed horizontal
scrollbar appears.

Using `break-spaces` instead seems to help since it allows breaks after
a space character, leading to the additional space not otherwise being
allocated.
This commit is contained in:
Michael Gratton 2020-10-17 13:45:23 +11:00
parent 0e783de5bf
commit ec3057daf7
6 changed files with 6 additions and 6 deletions

View file

@ -60,6 +60,6 @@ blockquote {
}
pre {
white-space: pre-wrap;
white-space: break-spaces;
margin: 0;
}

View file

@ -264,7 +264,7 @@ ComposerPageState.prototype = {
},
tabOut: function() {
document.execCommand(
"inserthtml", false, "<span style='white-space: pre-wrap'>\t</span>"
"inserthtml", false, "<span style='white-space: break-spaces'>\t</span>"
);
},
tabIn: function() {

View file

@ -77,7 +77,7 @@ blockquote {
}
pre {
white-space: pre-wrap;
white-space: break-spaces;
}
/**

View file

@ -213,7 +213,7 @@ ConversationPageState.prototype = {
if (ConversationPageState.isDescendantOf(
ancestor, "DIV", "plaintext", false)) {
dummy.classList.add("plaintext");
dummy.setAttribute("style", "white-space: pre-wrap;");
dummy.setAttribute("style", "white-space: break-spaces;");
includeDummy = true;
}
dummy.appendChild(range.cloneContents());