HTML Editor Settings

HTML Editor Settings

HTML Editor Settings

  • HtmlEditor.DefaultConfigurationType - specifies the type used for setting up the Rich Text Editor
  • HtmlEditor.DefaultProfile - specifies the path to the default rich text editor toolbar configuration
  • HtmlEditor.LineBreak - specifies the tag that is inserted when someone presses the Enter key when working in the Rich Text Editor
  • HtmlEditor.SupportWebControls - indicates whether web controls are displayed as yellow boxes in the Rich Text Editor when they exist in the HTML markup
  • HtmlEditor.ValidatorServiceUrl - specifies the url that is used to validate XHtml
  • HtmlEditor.ImageTypes - identifies the list of file extensions to treat as images when uploading

Controls featured in this example:

  • Sitecore Web Control

Classes featured in this example:

  • Sitecore.Configuration.Settings.HtmlEditor
  • Sitecore.Data.Items.Item

Configuration Settings

  • <configuration>
  • <settings>
  • <setting name="HtmlEditor.DefaultConfigurationType" value="Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration,Sitecore.Client" /> 
    <setting name="HtmlEditor.DefaultProfile" value="/sitecore/system/Settings/Html Editor Profiles/Rich Text Default" /> 
    <setting name="HtmlEditor.LineBreak" value="p" /> 
    <setting name="HtmlEditor.SupportWebControls" value="true" /> 
    <setting name="HtmlEditor.ValidatorServiceUrl" value="http://validator.w3.org/check" /> 
    <setting name="ImageTypes" value="|gif|jpg|png|" />
  • </settings>
  • </configuration>

C# Web Control Code

Sitecore.Data.Items.Item item = this.GetItem(); 
if (item == null) return; 

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold; width:100%; clear:both"); 
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div); 
output.Write("C# Web Control Real-time Output"); 
output.RenderEndTag(); //Div 

output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-size:small; width:100%; clear:both"); 
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.Div); 
output.AddAttribute(System.Web.UI.HtmlTextWriterAttribute.Style, "font-weight:bold"); 
output.RenderBeginTag(System.Web.UI.HtmlTextWriterTag.P); 
string itemName = Sitecore.StringUtil.GetString(item.DisplayName, item.Name); 
//using &#58; for colon and &#63; for question mark and &#160; for space 
output.Write("{0}&#58;&#160;{1}", "Item", itemName); 
output.RenderEndTag(); //P 

string defaultConfigType = Sitecore.Configuration.Settings.HtmlEditor.DefaultConfigurationType; 
string defaultProfile = Sitecore.Configuration.Settings.HtmlEditor.DefaultProfile; 
string lineBreak = Sitecore.Configuration.Settings.HtmlEditor.LineBreak; 
string supportWebControls = Sitecore.Configuration.Settings.HtmlEditor.SupportWebControls.ToString(); 
string validatorSvcURL = Sitecore.Configuration.Settings.HtmlEditor.ValidatorServiceUrl; 

output.Write("{0}&#58;&#160;{1}", "Html Editor Config Type", "<b><br/>" + defaultConfigType + "</b><br/>"); 
output.Write("{0}&#58;&#160;{1}", "Html Editor Default Profile", "<b><br/>" + defaultProfile + "</b><br/>"); 
output.Write("{0}&#58;&#160;{1}", "Html Editor Line Break", "<b>" + lineBreak + "</b><br/>"); 
output.Write("{0}&#63;&#160;{1}", "Html Editor Supports Web Controls", "<b>" + supportWebControls + "</b><br/>"); 
output.Write("{0}&#58;&#160;{1}", "HTML Editor Validator Service URL", "<b>" + validatorSvcURL + "</b>"); 
output.RenderEndTag(); //Div


C# Web Control Real-time Output

Item: HTML Editor Settings

Html Editor Config Type: 
Sitecore.Shell.Controls.RichTextEditor.EditorConfiguration,Sitecore.Client

Html Editor Default Profile: 
/sitecore/system/Settings/Html Editor Profiles/Rich Text Default

Html Editor Line Break: p
Html Editor Supports Web Controls? True
HTML Editor Validator Service URL: http://validator.w3.org/check