Introduction
In SubText 1.0, FreeTextBox was used as the editor for creating blog posts. But now on the market there are a lot of other RichTextEditors. Just to name the most well known: FCKeditor, XStandard, Web Wiz Rich Text Editor, RichTextBox.
Starting with version 1.5, Subtext now has a provider to enable webmasters to choose which RichText Editor to use for editing post and article content. The following providers are currently implemented:
- FreeTexBox
- FCKeditor
- Plain textarea
Provider Configuration
Taking advantage of the provider model used inside ASP.NET 2.0 (ported to ASP.NET 1.1), the configuration of this provider is the same as all providers inside SubText as well all providers used in all ASP.NET 2.0 web applications, like the Membership/Role/Profile providers. This lets the user configure all providers always using the same syntax.
<RichTextEditor defaultProvider="FtbRichTextEditorProvider">
<providers>
<add name="FtbRichTextEditorProvider"
type="Subtext.Web.Providers.RichTextEditor.FTB.FtbRichTextEditorProvider,
Subtext.Web"
description="FreeTextBox RichTextEditor Provider"
...
/>
<add name="FCKeditorRichTextEditorProvider"
type="Subtext.Providers.RichTextEditor.FCKeditor.FCKeditorRichTextEditorProvider,
Subtext.Providers.RichTextEditor.FCKeditor"
description="FCKeditor RichTextEditor Provider"
...
/>
<add name="PlainTextRichTextEditorProvider"
type="Subtext.Web.Providers.RichTextEditor.PlainText.PlainTextRichTextEditorProvider,
Subtext.Web"
description="Plain text RichTextEditor Provider"
...
/>
</providers>
</RichTextEditor>
Above you can see the web.config section that specifies how the richtexteditor is configured: for each available provider there is an <add> element that specifies
- the friendly name of the provider
- a description for the provider
- and most important, its full type (complete class name and assembly)
Then, in the main <RichTextEditor> element it's important to specify which is the defaultProvider to use for this feature.
For backward compatibility SubText 1.5 will be released with the current editor, FreeTextBox, as the default provider. But in just in case the webmaster wants to change the default what does she have to do?
She just needs to replace the defaultProvider with one of the other two available providers: "FCKeditorRichTextEditorProvider" or if she is really hardcore, "PlainTextRichTextEditorProvider".
Each provider's implementation has its own specific configuration parameters.
Let's see them starting from FreeTexBox.
FreeTexBox Configuration
For the moment FreeTextBox has the following configuration attributes, and I don't recommend that you change them
<add name="FtbRichTextEditorProvider"
type="Subtext.Web.Providers.RichTextEditor.FTB.FtbRichTextEditorProvider,
Subtext.Web"
description="FreeTextBox RichTextEditor Provider"
toolbarlayout="Bold,Italic,Underline,Strikethrough;Superscript,
Subscript,RemoveFormat|FontFacesMenu,FontSizesMenu,FontForeColorsMenu
|InsertTable|JustifyLeft,JustifyRight,JustifyCenter,JustifyFull;BulletedList,
NumberedList,Indent,Outdent;CreateLink,Unlink,Insert,InsertRule|
Cut,Copy,Paste;Undo,Redo|ieSpellCheck,WordClean|InsertImage,
InsertImageFromGallery"
FormatHtmlTagsToXhtml="true"
RemoveServerNamefromUrls="false"
WebFormFolder="~/Providers/RichTextEditor/FTB/"
/>
Let's see what each configuration attibute means:
- toolbarlayout
- Specify which button add in the editor toolbar
- FormatHtmlTagsToXhtml
- This instructs the editor to format tags in XHtml wellformed tags
- RemoveServerNamefromUrls
- If set to true, all urls in links and image will be without the hostname
- WebFormFolder
- This attribute must not be changed unless you want to move the pages for the provider to another folder, and this is not a recommended operation
FCKeditor Configuration
FCkeditor has a more complex configuration, since it allow the creation of custom link and image browsers. But if using the provider as it is released from by the SubText team, it's better to leave all the configuration attibutes as they are in the default web.config file.
<add name="FCKeditorRichTextEditorProvider"
type="Subtext.Providers.RichTextEditor.FCKeditor.FCKeditorRichTextEditorProvider,
Subtext.Providers.RichTextEditor.FCKeditor"
description="FCKeditor RichTextEditor Provider"
WebFormFolder="~/Providers/RichTextEditor/FCKeditor/"
ToolbarSet="SubText"
Skin="office2003"
ImageBrowserURL="~/Providers/RichTextEditor/FCKeditor/editor/filemanager/
browser/default/browser.html?Type=Image&Connector={0}"
LinkBrowserURL="~/Providers/RichTextEditor/FCKeditor/editor/filemanager/
browser/default/browser.html?Connector={0}"
ImageConnectorURL="~/Providers/RichTextEditor/FCKeditor/editor/filemanager/
browser/default/connectors/aspx/connector.aspx"
LinkConnectorURL="~/Providers/RichTextEditor/FCKeditor/editor/filemanager/
browser/default/connectors/aspx/connector.aspx"
FileAllowedExtensions=".*"
ImageAllowedExtensions="jpg|gif|png"
/>
Let's see what each configuration attibute means:
- WebFormFolder
- This attribute should not be changed unless you want to move the pages for the provider to another folder, and this is not a recommended operation.
- ToolbarSet
- The toolbar set to display in to editor. The possible default values are SubText which is optimized for SubText, Default which includes all the available toolbar buttons and Basic which includes only the simple bold, italic and few other buttons.
But you can add your own toolbar sets editing the ROOT\Providers\RichTextEditor\FCKeditor\customConfiguration\subtextconfig.js file. - Skin
- The color schema and the button types used in the editor interface. The possible default values are default, office2003 and silver. More skins can be added into the
ROOT\Providers\RichTextEditor\FCKeditor\editor\skins folder. - ImageBrowserURL
- This is the file that is used by the editor to browse the images available on the server. As for the WebFormFolder, should not be changes unless you intend to develop you own ImageBrowser.
- LinkBrowserURL
- This is the file that is used by the editor to browse the files available on the server and upload new ones. As for the WebFormFolder, should not be changes unless you intend to develop you own LinkBrowser.
- ImageConnectorURL
- This is the file that is requested by the ImageBrowser to get all available images and upload new ones. As for the WebFormFolder, should not be changes unless you intend to develop you own ImageBrowser.
- LinkConnectorURL
- This is the file that is requested by the LinkBrowser to get all available files. As for the WebFormFolder, should not be changes unless you intend to develop you own LinkBrowser.
- FileAllowedExtensions
- Specify which file extensions must be shown inside the file list (.* means all)
- ImageAllowedExtensions
- Specify which file extensions must be shown inside the image list (.* means all)
PlainText Configuration
PlainText was initially written to test the provider definition, but was released with SubText since someone may still want to use the plain old standard HTML textarea.
<add name="PlainTextRichTextEditorProvider"
type="Subtext.Web.Providers.RichTextEditor.PlainText.PlainTextRichTextEditorProvider,
Subtext.Web"
description="Plain text RichTextEditor Provider"
cols="10"
rows="10"
cssClass="txt"
/>
Now so many as the previous ones, but here are the configuration attributes:
- cols
- Number of columns of the textarea
- rows
- Number of rows of the textarea
- cssClass
- Optional class applied to the textarea