Client Side Configuration

Rich Text Editor for PHP

Configuration for RichTextEditor can be set in the client side in conjunction with server side settings. The client-side settings are collected in a javascript file (richtexteditor\scripts\config.js). Unlike server side settings change configuration specifically for that instance of the Editor, the client-side settings will apply all instances of your editor objects.

A client side configuration file example:

// this file stores the default settings for RichTextEditor
// some settings are overrided by server settings
window.RTE_Configuration =
{
      version          :    "2012-08-20-A",
      skin             :    "office2007blue",//sets the skin for how the toolbar is draw
      toolbar          :    "full",//auto configures the toolbar with a set of buttons
      autofocus        :    false,//specifies whether the editor grabs focus when the page loads
      readonly         :    false,//specifies whether editor is read-only
      showrulers       :    false,//specifies whether to display horizontal and/or vertical rulers
      showlinkbar      :    true,//specifies whether to display the link editing box
      showtoolbar      :    true,//specifies whether to display the editor toolbar
      showtoolbar_code :    true,//specifies whether to display the code mode toolbar
      showtoolbar_view :    true,//specifies whether to display the preview toolbar    
      showbottombar    :    true,//specifies whether to display the editor bottom bar        
      showeditmode     :    true,//specifies whether to display the edit mode button in the bottom bar
      showcodemode     :    true,//specifies whether to display the code mode button in the bottom bar
      showpreviewmode  :    true,//specifies whether to display the preview mode button in the bottom bar   
      showtaglist      :    true,//specifies whether to display the tag selector in the bottom bar
      showzoomview     :    true,//specifies whether to display a zoom factor drop down in the bottom bar
      showstatistics   :    true,//specifies whether to display the content statistics in the bottom bar
      showresizecorner :    true,//specifies whether to display the resize handle at the corner of the editor    
      resize_mode      :    "resizeboth",     //"disabled","autoadjustheight","resizeheight","resizewidth","resizeboth" gets or sets the resize mode  
      enabledragdrop   :    true,//specifies whether to enable drag-and-drop support for the editor
      enablecontextmenu:    true,//specifies whether to display the context menu
      enableobjectresizing: true,//specifies whether to enable the object resizing  
      autoparseclasses :    true,//specifies whether or not the Editor should automatically parse the CSS classes from ContentCss    
      initialtabmode   :    "edit",    //"edit","code","view"
      initialfullscreen:    false,//specifies whether the Editor is used in a full-screen mode
      initialtoggleborder:  true,//specifies the ToggleBorder state
      maxhtmllength    :    0,//specifies the maximum number of characters including the HTML tags allowed. Default is 0, indicating no maximum
      maxtextlength    :    0,//specifies the maximum number of characters excluding the HTML tags allowed. Default is 0, indicating no maximum
      editorbodyclass  :    "",//specifies the class name that will be added to the body of the editor document
      editorbodystyle  :    "",//specifies the css style that will be applied to the body of the editor document
      insertparagraph  :    'p',//default tag for insertparagraph
      unlistparagraph  :    'p',//default tag for unlistparagraph
      justifyparagraph :    'p',//default tag for justifyparagraph
      enterkeytag      :    'p',//default tag for enterkeytag
      shiftenterkeytag :    'br',//default tag for shiftenterkeytag  
      insertbodyline   :    '<p>&nbsp;</p>',//default code for inserttopline 
      ...
}

Modifying the configuration using server side method:

The modifying in the client side configuration file will apply all instances of your editor objects. However when you upgrade your RTE with newer versions, this file may be overwritten. To avoid losting the changes, we suggest you use the following server side method (Editor1.SetConfig) overwrite the setting.

Editor1.SetConfig("skin","office2010blue");
Editor1.SetConfig("showrulers",true);
Editor1.SetConfig("showbottombar",false);

Modifying the configuration using client side method:

It is also very easy to overwrite the configuration using client side method.

<script type='text/javascript'>
function RichTextEditor_OnLoader(loader)
{
	var config=loader._config;
	config.showrulers=true; //Shows horizontal and vertical rulers.
	config.showbottombar=false;//Shows the editor bottom bar.
	config.skin="office2010blue";//Sets the skin.
}
</script>
<script type='text/javascript'>
function RichTextEditor_OnLoad(editor)
{
    editor.SetWidth(1000); //Sets the width.
    editor.SetHeight(500); //Sets the height.
}
</script>

Send feedback about this topic to CuteSoft. © 2003 - 2012 CuteSoft Components Inc. All rights reserved.