Skip to content

Commit e8ebe00

Browse files
author
Ben Herila
committed
Added configuration option to support HTML escaping by deafult.
1 parent afcd659 commit e8ebe00

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

docs/n2cms.configuration.xsd

+1
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@
362362
<xs:attribute name="castleConfiguration" type="xs:string" use="optional" />
363363
<xs:attribute name="multipleSitesConfiguration" type="xs:string" use="optional" />
364364
<xs:attribute name="dynamicDiscovery" type="xs:boolean" use="optional" />
365+
<xs:attribute name="defaultHtmlEscape" type="xs:boolean" use="optional" />
365366
<xs:attribute name="castleSection" type="xs:string" use="optional" />
366367
<xs:attribute name="engineType" type="xs:string" use="optional" />
367368
<xs:attribute name="containerType" type="xs:string" use="optional" />

src/Framework/N2/Configuration/EngineSection.cs

+11
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ public bool DynamicDiscovery
4646
set { base["dynamicDiscovery"] = value; }
4747
}
4848

49+
/// <summary>
50+
/// Default to escape HTML in titles and other single-entry fields.
51+
/// </summary>
52+
[ConfigurationProperty("defaultHtmlEscape", DefaultValue = false)]
53+
public bool DefaultHtmlEscape
54+
{
55+
get { return (bool)base["defaultHtmlEscape"]; }
56+
set { base["defaultHtmlEscape"] = value; }
57+
}
58+
59+
4960
/// <summary>Additional assemblies assemblies investigated while investigating the environemnt, e.g. to find item definitions.</summary>
5061
[ConfigurationProperty("assemblies")]
5162
public AssemblyCollection Assemblies

src/Framework/N2/Details/WithEditableTitleAttribute.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Web;
33
using System.Web.UI;
44
using System.Web.UI.WebControls;
5+
using N2.Configuration;
56
using N2.Web.UI.WebControls;
67

78
namespace N2.Details
@@ -34,7 +35,7 @@ public WithEditableTitleAttribute()
3435
public WithEditableTitleAttribute(string title, int sortOrder)
3536
: base(title, "Title", sortOrder)
3637
{
37-
AllowHtml = true; // TODO: Load default value from web.config
38+
AllowHtml = N2.Context.Current.Resolve<EngineSection>().DefaultHtmlEscape;
3839
Required = true;
3940
}
4041

0 commit comments

Comments
 (0)