The Font size dropdown of Rich Text Editor by default displays a predefined set of font sizes. You can create your own font size list programmatically or by editing the static configuration file: richtexteditor\dialogs\setfontsize.xml.

Online demo:

Dynamically populate the dropdown menu

The source code of this example can be found in the download package.

How to disable Font size dropdown?

RichTextEditor allows you disable individual toolbar icons using Editor.DisabledItems property. If you want to disable the Font size Dropdown, you can add "fontsize" into Editor.DisabledItems list.


<RTE:Editor runat="server" ID="Editor1" DisabledItems="fontsize" />

Edit the setfontsize.xml file

The setfontsize.xml file can be found in the richtexteditor/config folder. In setfontsize.xml file you can find the following code which defines the font sizes information within RichTextEditor.

Here is the default font size setting:

var sizelist=editor._config.fontsizelist||'8px,9px,10px,11px,12px,13px,14px,16px,18px,20px,24px,36px';

Edit the client side configuration file

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.

Here is the font size default setting:

fontsizelist	:	'8px,9px,10px,11px,12px,13px,14px,16px,18px,20px,24px,36px',

Use 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("fontsizelist", "9px,13px,16px,20px,24px,32px");

Use client side method

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


<script type="text/javascript">
    var editor;
    function RichTextEditor_OnLoader(loader) {
        var config = loader._config;

        //set font size list by javascript code
        config.fontsizelist = "9px,13px,16px,20px,24px,32px";
    }
</script>

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