Welcome Guest, you are in: Login

Subtext Project Site



RSS RSS

Navigation



Search the wiki
»

PoweredBy




Image Image

Configuring the Text Editor

RSS
Modified on 2010/01/15 14:50 by Travis Categorized as Customization
Subtext uses a provider model to enable webmasters to choose which text editor to use for editing post and article content. While you can create your own provider for any text editor control, the following providers come with Subtext out of the box:

* FreeTexBox * FCKeditor * Plain textarea

Provider Configuration

Taking advantage of the provider model used inside ASP.NET 2.0, the configuration of this provider is the same as all providers inside Subtext and ASP.NET 2.0 web applications (e.g., Membership/Role/Profile providers). This lets the user configure all providers always using the same syntax.

The available and selected providers appear in web.config in a RichTextEditor section. Below is an example snippet:

<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>

For each available provider there is an element that specifies...

* The friendly name of the provider * A description for the provider * The provider's full type name (complete class name and assembly)

Then, in the main element you use the defaultProvider attribute to specify which text editor provider to use.

For example, in the sample configuration snippet above, you see the defaultProvider is listed as FtbRichTextEditorProvider indicating the FreeTextBox provider. If you change that value to FCKeditorRichTextEditorProvider then FCKeditor will be the text editor instead of FreeTextBox.

Each provider's implementation has its own specific configuration parameters. While you can change them to suit your own needs, this is an advanced activity, so be warned and keep backups. In general, you probably don't want to mess with the individual provider settings that come out of the box with Subtext.

FreeTextBox Provider Configuration

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/"
    />

Configuration attribute descriptions:

  • 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 Provider Configuration

FCkeditor has a more complex configuration, since it allow the creation of custom link and image browsers.

<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&amp;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"
    />

Configuration attribute descriptions:

  • WebFormFolder: Points to the set of pages used by FCKeditor.
  • 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. 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 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.
  • LinkBrowserURL: This is the file that is used by the editor to browse the files available on the server and upload new ones.
  • ImageConnectorURL: This is the file that is requested by the ImageBrowser to get all available images and upload new ones.
  • LinkConnectorURL: This is the file that is requested by the LinkBrowser to get all available files.
  • 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 is just a 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"
    />

Configuration attribute descriptions:

  • cols: Number of columns of the textarea
  • rows: Number of rows of the textarea
  • cssClass: Optional CSS class applied to the textarea

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam.