I was asked to investigate the possibility of replacing the default FreeTextBox editor on our Community Server with a more sophisticated and easy-to-use editor. I took the challenge and it turned to be an easy one. The whole process took me about an hour - half for reading through the documentation and half for writing the code itself.
Lucky for me Community Server uses a provider model, similar to the one in DotNetNuke, that makes it easy for users to change the text editor they wish to use. The only requirement is that the new editor has an appropriate wrapper written for it.
Armed with the DNN experience and what I just read in the CS documentation about the ITextEditor interface, I set out to write an editor provider for r.a.d.editor
. There were only a few requirements that I had to follow - the wrapper class was supposed to inherit the default ASP.NET WebControl and implement the Community Server ITextEditor interface. This interface has some abstract properties that must also be used in the wrapper. Some of them - Width, Height, and most notably the ITextEditor.Text property, were tied to r.a.d.editor
's own width, height and Html content. I decided to create a new editor instance and add it to the WebControl's control collection. Since I did not know how to pass configuration settings to r.a.d.editor
from the Community Server itself, I decided to declare specific Tools and Configuration files (namely ToolsFileCS.xml and ConfigFileCS.xml) that would be used to configure the editor. Naturally if those files are not present the default editor configuration is used.
Once I had the compiled class library, containing the r.a.d.editor
Wrapper, I was ready to test it in a real CS environment. I modified the communityserver.config file, located in the root folder of the Community Server installation and set r.a.d.editor
as the default text editor. Similar to DotNetNuke, this is accomplished by simply changing the textEditorType property of the Core object. I copied all files required by r.a.d.editor to work on the Community Server web site - the RadEditor.dll
files, the RadControls
folder, and the r.a.d.editor
Finally I restarted the Community Server, which is simply done by saving the Web.config file. To my delight, the new text editor popped up instead of FreeTextBox.
Overall, replacing the editor was easily done. The unpleasant part is that with each new update of Community Server or r.a.d.editor
, the wrapper needs to be recompiled since it references both the CS and Telerik's assemblies.
The code for the r.a.d.editor
wrapper is available on the Telerik forums