Chapter I. Basic Integration
Prev | 2. Configuring edit-on Pro | Next

## 2. Configuring edit-on Pro

The default configuration and behaviour of the editor can be modified in many ways. For example, if you do not want your users to edit content in the "Source View", you can disable it. If you want to limit the number of characters to be entered, you can do so. All you have to do is to specify the settings you need in the editor's configuration file.

Example I.6. Loading a configuration file

    eop = new editOnPro(725, 350, "myEditor", "myId", "eop");
    eop.setCodebase(".");
    eop.setUIConfigURL("uiconfig.xml");
    eop.setConfigURL("config.xml");
    eop.loadEditor();

In the example above, we first instantiate a new editor object called `eop` , then set the editor's codebase and then call the methods `setUIConfigURL` and `setConfigURL` . We'll learn about the `setUIConfigURL` method in the next chapter. The method `setConfigURL` tells the editor where it can find the configuration file. The location of the file may be relative to the applet's codebase. The editor will search for the file at the location specified by the `setConfigURL` method and use the configuration settings specified in this file.

The configuration file is in XML format. The applet can be configured by setting the attributes of specific elements in this file.

For example, if we wanted the user to be able to create documents with 5000 characters at most, we'd look at the `documentcounter` element. Now we can see the `documentcounter` has two attributes, `limit` and `enforcelimit` . We'd also see the attribute `limit` is required while `enforcelimit` is not and has a default value of "false". This means if we use the element `documentcounter` in the configuration file we must indicate the maximum number of characters displayed by the counter. Whether this maximum number is enforced or not is determined by the attribute `enforcelimit` ; if this attribute is ignored, the maximum number of characters will only be displayed, but not enforced.

Example I.7. Setting and enforcing the maximum number of characters in a document

    <documentcounter limit="5000" enforcelimit="true" />

The principle described above applies to all elements in the configuration file. Each element has one or more attributes which are either optional or required. Some of the attributes have a default value; attributes having a default value are always optional. In the description of each element, you will see which element is its parent element, and which elements are its children, if any.

Some elements are wrappers for other elements, which are their child elements. For example, the element `fontsizes` is a wrapper for the `fontsize` element. Each `fontsize` element specifies a font size available in the font size selector box, while the element `fontsizes` represents all font sizes available in the selector box.

Example I.8. The elements `fontsizes` and `fontsize`

    <fontsizes>
        <fontsize size="12" />
        <fontsize size="14" />
        <fontsize size="36" />
    </fontsizes>

A complete reference of all elements that can be set this way can be found within the Configuration File chapter.

Prev | Up | Next
1. Integrating edit-on Pro in a Web Page | Home | 3. Adjusting the User Interface