The Dojo attributes toolbarType and toolbar of a Rich Rext control in the XPages

The Rich Text control of a xpage is derived from CKEditor from lotus 8.5.2, however in previous versions it was a Dojo rich text editor.
A CKEditor control just created in a xpage doesn’t have Dojo attribute explicitly defined as shown in the figure below:

The toolbarType attribute is implicitly set to “Medium”, its default value, and defines a particular toolbar.

Setting toolbarType you choose the functionality of the toolbar at the top of the rich text and it can take 3 values which correspond to three different toolbars:

  • Slim
  • Medium
  • Large

You can customize the toolbar with the attribute toolbar which is a JavaScript array containing the elements to be displayed in the toolbar.
For example, to set a basic toolbar, create an attribute “toolbar” and set its value as JavaScript (ServerSide) to:

var customToolbar="[['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-', 'Link', 'Unlink','-','About']]";
return customToolbar;

If you want a full toolbar the value of “toolbar” is:

var customToolbar="[['Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates'],"
+"['Find','Replace','-','SelectAll','-','SpellChecker', 'Scayt'],"
+"['Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField'],"
+"['Maximize', 'ShowBlocks','-','About']]";
return customToolbar;

To obtain an empty toolbar, set “toolbar” to:

var customToolbar="[]";
return customToolbar;

CKEditor 3.x Developer’s Guide


2 responses to “The Dojo attributes toolbarType and toolbar of a Rich Rext control in the XPages”

  1. I just created myself a custom toolbar and noticed that the Cut and Copy are greyed out and not clickable for me also. This is regardless of where I am in the CKEditor control. I even typed in new text to see if I could highlight and copy without luck. I also tried to use the ‘Full’ toolbarType and used Simple Binding rather than a scoped variable with same result. Will continue to investigate and post reply if I find something.

  2. J. Parker Avatar

    If I add the ‘Cut’,’Copy’,’Paste’ icons, they appear in the toolbar but Cut and Copy are greyed out and not clickable. I am able to use keyboard shortcuts ctrl-c and ctrl-v, but they work correctly with or without the icons. How do I enable the icons so they function properly?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.