Hi All,
I want to share some improvements I had to make to umbracoForms, perhaps these can be folded into the product.
These changes are to preserve line spacing in user input.
I added a custom.css file with this rule
.umb-forms-entry-main .umb-control-group div div {
white-space: pre-wrap;
}
And in my email templates I added this, in theory this preserves line-break compatibility with outlook (unfortunately not other whitespace) and also ensures any malicious input is encoded.
if (field.GetValue() is string stringValue)
{
var lines = stringValue.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
<p style="margin: 0;white-space: pre-wrap;">@for (int i = 0; i < lines.Length; i++){@lines[i] @if (i < lines.Length - 1){<br />}}</p>
}
else
{
<p style="margin: 0;">@field.GetValue()</p>
}