I’m a huge fan of the Telerik RadEditor for rich-text editing in SharePoint 2007, however, since it’s release, there has been a very frustrating issue with the Reusable Content functionality in the control. It hasn’t worked.
The core of the issue is that the relationship between the Reusable Content fragment and the Reusable Content list is severed when the page is saved.
You can read about the issue on WebGrizzly’s blog, as well as on Telerik’s site both here and here. There’s even a post where Telerik says that they have done all they can and don’t think it’s possible to have Reusable Content in the RadEditor.
I didn’t like the sound of this, as I HAD to have this working in the RadEditor for a custom Feature I was working on, so in I dove. By walking down the path that the content takes in SharePoint’s default rich-text-editor, I found that it’s a combination of both client-side and server-side code that makes Reusable Content possible.
In order to fix the RadEditor, you have to do a bit of custom coding. I’m not going to go into Solutions or Features here, as you already should know how to create them if you want to fix the control, and to make things easier, I’ve posted the class file on CodePlex. Essentially, you need to create your own custom implementation of the RadEditor by inheriting from the RadHtmlField and drawing the code out a little further to add the needed client-side and server-side processing to wire up the functionality.
If the task of creating your own implementation of the RadEditor seems a little daunting, trust me, it’s not that bad, and it’s completely worth it. As you already know, the RadEditor is awesome, and Telerik’s controls are some of the best out there. The controls in Telerik’s ASP.NET AJAX suite even work in SharePoint, and if you get the full version of the RadEditor for SharePoint, you actually are getting the full suite.
Download the RadEditor Reusable Content fix
So – you may be wondering, have you shared this code with Telerik?
I actually contacted Telerik and was surprised by the response I got. I was asked if I had tested this fix with the blog and wiki editors, as well as the web part editor. Telerik was also curious if I was able to fix the Reusable Content fragment selection dialog box (_layouts/ReusableTextPicker.aspx) in Firefox, as they were hesitant to implement code that still exposed some issues related with Reusable Content. I responded with my opinion that it shouldn’t matter as Reusable Content is a component of the Publishing Feature – the classname of the ResusableTextPicker is Microsoft.SharePoint.Publishing.Internal.CodeBehind.ReusableTextPickerPage – and the button for adding Reusable Content is on the toolbar of the out-of-box text editor for Publishing Fields. The blog and wiki templates are part of WSS, not SharePoint, and the content editor web part, even added to pages on Publishing sites, does not have the ability to add Reusable Content.
As for the errors on the ReusableTextPicker page in FireFox, I don’t feel that it should be Telerik’s responsibility (or mine of that matter) to fix it. That problem is caused by the JavaScript used to retrieve the values of the expando attributes on the table rows of the page as it’s shipped by Microsoft. If only they had used JQuery…
One final thing – this is not supported by Telerik! If you implement, you have to give thought about your upgrade path when Telerik releases a new version of the assembly. Also, I’m leaving my code in beta for right now as I’m the only one i know of that’s used it, so if you give it a shot, please let me know how it works out for you.