The Richtext Editor - Help

Creating an instance of the editor

To create an instance of the editor embedded into a web page, the object element must be used.  The following sample code will create an instance of the editor that fills the current browser window.

<object id="richedit" style="BACKGROUND-COLOR: buttonface" data="richedit.html"
width="100%" height="100%" type="text/x-scriptlet" VIEWASTEXT>
</object>

The id="richedit" is used to allow control of the editor object from JavaScript.  The data="richedit.html" identifies the source for the editor object.  The path specified in the data attribute should point to where the richtext editor is installed on your server.

The Editor Object interface

Having created an instance of the richtext editor object, it's properties and methods can be accessed through the id assigned to is (richedit in our example).  This object has a public interface comprising of methods and properties.

Properties

Name Access Description
docHtml Read/Write This property is used feed and extract the HTML being edited.  When read, this property returns the current contents of the document (HTML) being edited.  When written to, the contents of the editor window are replaced with the supplied HTML.
options Read/Write This property is used to enable/disable features of the editor @ runtime.  More features are being made optional through this property. 

The property is similar in syntax to the window options of the window.open() method of the W3C DOM.  It comprises a semicolon separated list of name=value pairs.  The names are case insensitive as are the values (unless otherwise specified). An example use of the options property might be:

richedit.options = "source=on;styleBar=off";

There are several levels of options, some options disable a toolbar of features whilst others disable individual features. The following table will describe each option in turn:

Option Options Default Description
history on/off off This option is used to control the history feature.  This is currently disabled by default as there are still several issues with this feature.
source on/off off This option allows the source of the HTML being edited to be viewed and to a certain extend edited.  Again, due to occasional problems occurring with this feature it has been disabled by default.
dragdrop on/off off Enable or Disable drag and drop functionality.  This option is currently disabled because there is no proper handling of drag and drop events.
       
styleBar on/off on This option allows the style tool bar to be enabled/disabled.  The style toolbar comprises the Style, Font, Size and Colour tools.
style on/off on This option allows the style selector to be enabled/disabled.
font on/off on This option allows the font selector to be enabled/disabled.
fontSize on/off on This option allows the font size selector to be enabled/disabled.
colour on/off on This option allows the colour selector(s) to be enabled/disabled.
       
     

Methods

addField