mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
#18607: Replacing new lines with <br /> in Text fields
Work Item: 18607 --HG-- branch : 1.x
This commit is contained in:
@@ -39,9 +39,7 @@ namespace Orchard.Core.Common.Drivers {
|
|||||||
var settings = field.PartFieldDefinition.Settings.GetModel<TextFieldSettings>();
|
var settings = field.PartFieldDefinition.Settings.GetModel<TextFieldSettings>();
|
||||||
object fieldValue = field.Value;
|
object fieldValue = field.Value;
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(settings.Flavor)) {
|
fieldValue = new HtmlString(_htmlFilters.Aggregate(field.Value, (text, filter) => filter.ProcessContent(text, settings.Flavor)));
|
||||||
fieldValue = new HtmlString(_htmlFilters.Aggregate(field.Value, (text, filter) => filter.ProcessContent(text, settings.Flavor)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return shapeHelper.Fields_Common_Text(Name: field.Name, Value: fieldValue);
|
return shapeHelper.Fields_Common_Text(Name: field.Name, Value: fieldValue);
|
||||||
});
|
});
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
@{
|
@using Orchard.Utility.Extensions;
|
||||||
|
@{
|
||||||
string name = Model.ContentField.DisplayName;
|
string name = Model.ContentField.DisplayName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@if (HasText(name) && HasText(Model.Value)) {
|
@if (HasText(name) && HasText(Model.Value)) {
|
||||||
<p class="text-field"><span class="name">@name:</span> <span class="value">@Model.Value</span></p>
|
<p class="text-field"><span class="name">@name:</span> <span class="value">@(new MvcHtmlString(Html.Encode((HtmlString) Model.Value).ReplaceNewLinesWith("<br />$1")))</span></p>
|
||||||
}
|
}
|
Reference in New Issue
Block a user