This is a migrated thread and some comments may be shown as answers.

[Solved] Intro to customizing r.a.d. editor

8 Answers 234 Views
RadEditor
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anna Smith
Top achievements
Rank 1
Anna Smith asked on 29 Dec 2005, 10:26 AM
Hi there,

I'm looking for a basic intro to customizing r.a.d. editor - haven't got very far with it so far, perhaps because I'm finding the documentation a little hard to understand.

Here's what I want to do:

- Set basic properties in config.xml, which doesn't seem to be working at the moment.
For example, I'd like a carriage return to translate into <p> rather than <br>. I've edited config.xml to set NewLineBr to "false", and cleared the cache, but nothing seems to have happened - new lines are still translating to <br> rather than <p>. Please could you advise?
- Customize other global properties - for example, I'd like to customize the appearance of the toolbars, so that Bold and Italic don't appear by default, and r.a.d.editor web parts can't be minimized.
Can you let me know how to do this? Do I need to change ToolsFile.xml? If so, what do I need to change and how? I'm sure this is in the documentation somewhere, but I can't find it.
- Change the title of the Web Part from "r.a.d. editor", whenever it appears in SharePoint, to "Content Editor". Is this possible?

Thanks very much for your help. Sorry to ask such simple questions - the documentation looks very comprehensive, but I just need to know where to begin!

Cheers
Anna

8 Answers, 1 is accepted

Sort by
0
Anna Smith
Top achievements
Rank 1
answered on 29 Dec 2005, 10:45 AM
Re customizing global properties - I've tried setting e.g. <tool name="Bold" shortcut="CTRL+B" visible="false"/> in ToolsFile.xml, then clearing the cache, but the Bold button is still visible in the editor. What am I doing wrong?

Also, to clarify, I'd like to know how to set at a global level the properties that appear in the Web Part menu under Appearance/Layout/Advanced - e.g. allowing minimize, close, the title of the Web Part, whether the title bar is visible, etc.  Is there a way of defining a default for these when I insert a new r.a.d. editor Web Part?

Thanks again
Anna 
0
Atanas Korchev
Telerik team
answered on 29 Dec 2005, 04:07 PM

Hi Anna,

Thank you for your questions and your interest in r.a.d.editor SharePoint edition.

Now up to your questions:

  1. By default r.a.d.editor is not using the config file. That's why your changes in ConfigFile.xml are not applied. You need to alter ContentEditor.aspx and set the ContentEditor property of the RadEditor tag. This is described in detail here. However, you are absolutely right that this is not clearly stated in the documentation - we shall update it in the next release.
  2. To disable the bold tool, you should simple delete it (or comment it out) in the ToolsFile.xml. The <tool> tag does not support the visible attribute. You can for more info in the documentation under the "Setting and Customizing r.a.d.editor" topic.
  3. It is possible to change the default title of r.a.d.editor webpart. However, it will take effect only for newly added webparts. Those already added to web part pages need to be changed manually. Here is how to achieve it:
    • Open the RadWebParts_2.0.0.0__1f131a624888eeed_RadEditorWebPart.dwp file which would normally be in C:\Inetpub\wwwroot\wpcatalog. That file is used as reference when dropping a webpart in a webpart zone - you can customize the which properties will be set bye default.
    • To change the default title, just edit the contents of the <Title> tag:
      <?xml version="1.0" encoding="utf-8"?>
      <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
       <Title>Content Editor</Title>
       <Description>Rich content editing for SharePoint from telerik</Description>
       <Assembly>RadWebParts,Version=2.0.0.0,Culture=neutral,
      PublicKeyToken=1f131a624888eeed</Assembly>
       <TypeName>Telerik.WebParts.RadEditorWebPart</TypeName>
       <PartImageLarge>_WPR_/RadControls/EditorWebPart/RadEditor.gif</PartImageLarge>
      </WebPart>
    • Reset IIS (by running iisreset.exe) to apply the changes. Now r.a.d.editor will appear in the webpart list as "Content Editor". From now on all added web parts will be entitled "Content Editor".
  4. You can customize other properties of the webpart by editing the same dwp file. For a complete list of all common properties, you can check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/smpcWebPart_SV01014606.asp. For example to disallow minimizing you can use the following xml:
    <?xml version="1.0" encoding="utf-8"?>
    <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2" >
     <Title>Content Editor Title</Title>
     <Description>Rich content editing for SharePoint from telerik</Description>
     <Assembly>RadWebParts,Version=2.0.0.0,Culture=neutral,PublicKeyToken=1f131a624888eeed</Assembly>
     <TypeName>Telerik.WebParts.RadEditorWebPart</TypeName>
     <PartImageLarge>_WPR_/RadControls/EditorWebPart/RadEditor.gif</PartImageLarge>
        <AllowMinimize>false</AllowMinimize>
    </WebPart>
We hope that helped,
Albertthe telerik team
0
Anna Smith
Top achievements
Rank 1
answered on 29 Dec 2005, 05:13 PM
Hi telerik

Thanks very much for your reply.

1. There's already a line in my copy of [Program Files]\Common Files\Microsoft Shared\web server extensions\wpresources\RadWebParts\2.0.0.0__1f131a624888eeed\RadControls\EditorWebPart\Dialog\
ContentEditor.aspx which says

ConfigFile = "~/RadWebParts/2.0.0.0__1f131a624888eeed/RadControls/Editor/ConfigFile.xml"

(this is correct, as I'm using the GAC deployment) and I've set

 <property name="NewLineBr">false</property>

in RadControls\Editor\Config.xml and cleared the cache.

However, if I press Enter in r.a.d.editor, it still appears as <br> rather than <p>, so I'm concerned that changes to config.xml are not being picked up.

Is there anything I can do to test this?

2. Editing ToolsFile.xml in the way you suggested works - thank you very much!

3/4. Editing properties of the r.a.d. editor Web Parts via the .dwp file also works well - thank you.

My remaining question (see my other thread) is whether it's possible to include default content inside the .dwp definition for r.a.d. editor. For example, when you create a r.a.d. editor Web Part, it'd be really useful to have instructions saying "This is a r.a.d.editor Web Part. To edit the content here, click on... " etc, like the SharePoint Content Editor. Is there a way of including pre-formatted content inside the .dwp file?

I know you can use <Content> tags inside the SharePoint Content Editor .dwp file, so I was wondering if something similar was possible inside the r.a.d. editor Web Part.

I've had a look at the MS Web Part common properties link, and at the r.a.d. editor documentation, but can't immediately see anything about this.

Thanks again for your help - by the way, I really like the editor!

Cheers
Anna
0
Atanas Korchev
Telerik team
answered on 30 Dec 2005, 11:02 AM
Hi Anna,

Customizing the NewLineBr property through the config file should work. We made a quick test and all went ok.

Our suspicion is that the ConfigFile property is not set. You mentioned there was already a line saying

ConfigFile = "~/RadWebParts/2.0.0.0__1f131a624888eeed/RadControls/Editor/ConfigFile.xml"

but it is probably the one inside the comments (<%-- --%> tags). You should copy that line and paste it within the first RadEditor tag (the one immediately after <telerik:LoadingMessage runat="server" id="loadingMessage"></telerik:LoadingMessage>).

To test whether the config file has been successfully set, you can change the file name ( e.g. ConfigFile2.xml) - the dialog should show a server side error saying it cannot find the configuration file.

As for the other question - you should just add the following line in the dwp file:
<Text xmlns="Telerik.WebParts">This is a r.a.d.editor Web Part.</Text>

Regards,
Albert
the telerik team
0
Anna Smith
Top achievements
Rank 1
answered on 30 Dec 2005, 11:18 AM

Thanks for your reply.

I've tried pasting that line into the correct bit of ContentEditor.aspx, but am seeing a server-side error. Sorry, I'm probably making a stupid mistake, but I don't know what it is!

Server Error in '/_wpresources' Application.


Requested value true was not found.

Description: An unhandled exception occurred during the execution of the current web request.
Please review the stack trace for more information about the error and
where it originated in the code.

Exception Details: System.ArgumentException: Requested value true was
not found.

Here's the relevant bit of ContentEditor.aspx - can you let me know if this looks OK? The filepath looks fine to me, there is a Config.xml file located there on my system.

  <form id="mainForm" runat="server">
   <telerik:LoadingMessage runat="server" id="loadingMessage"></telerik:LoadingMessage>
    <radE:RadEditor ID="contentEditor"
     Runat="server"
     OnClientSubmit="OnSubmit"
     OnClientCancel="OnCancel"
     CacheLocalization="True"
     DocumentsFilters="*.*"
     AllowThumbGeneration = "True"
                                        ConfigFile = "~/RadWebParts/2.0.0.0__1f131a624888eeed/RadControls/Editor/ConfigFile.xml"

    >
    </radE:RadEditor>

I still get the same error message if I set the path as "~/wpresources/RadWebParts/..."

Anna

0
Anna Smith
Top achievements
Rank 1
answered on 30 Dec 2005, 11:32 AM
I think the problem has something to do with the "StripFormattingonPaste" property in Config.xml - if I change the value of this property, the error message also changes. If I comment out this property altogether, everything works fine - the editor doesn't throw an error message, and changes to Config.xml get picked up OK.

Here is the stack trace from the error message, with StripFormattingonPaste set to "false":

Stack Trace:

[ArgumentException: Requested value false was not found.]
   System.Enum.Parse(Type enumType, String value, Boolean ignoreCase) +906
   Telerik.WebControls.RadEditorConfigUtils.x87c053f2a4ef1215.
GetStripFormattingOptionsFromString(String name) +23 Telerik.WebControls.RadEditor.xc620866e4c727fa7() +6757 Telerik.WebControls.RadEditor.set_ConfigFile(String value) +54 ASP.ContentEditor_aspx.__BuildControlcontentEditor() +154 ASP.ContentEditor_aspx.__BuildControlmainForm() +171 ASP.ContentEditor_aspx.__BuildControlTree(Control __ctrl) +47 ASP.ContentEditor_aspx.FrameworkInitialize() +31 System.Web.UI.Page.ProcessRequest() +85 System.Web.UI.Page.ProcessRequest(HttpContext context) +18 System.Web.CallHandlerExecutionStep.System.Web.
HttpApplication+IExecutionStep.Execute() +179 System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +87

But everything seems to work OK as long as I comment out StripFormattingonPaste.

I've disabled a couple of the "Paste As..." buttons in ToolsFile.xml - don't know if that has something to do with it?

The editor works OK for me now, but let me know if you'd like me to try anything else.

Thanks very much for your help
Anna
0
Atanas Korchev
Telerik team
answered on 30 Dec 2005, 02:13 PM
Hello Anna,

The error you are getting is because the StripFormattingonPaste property is of enumeration type. The available options are:

  • None - pastes the clipboard content as is
  • MSWord - strips Word-specifics tags on Paste, preserving fonts and text sizes
  • MSWordNoFonts - strips Word-specifics tags on Paste, preserving text sizes only
  • MSWordRemoveAll - strips Word-specifics tags on Paste, removing both fonts and text sizes
  • Css - strips CSS styles on Paste
  • Font - strips Font tags on Paste
  • Span - strips Span tags on Paste
  • All - strips all HTML formatting and pastes plain text
So to turn it off you should use the following xml in the config file:

<property name="StripFormattingOnPaste">None</property>

You can find more information about the text stripping support of r.a.d.editor here.

Let us know how it goes,
Albert
the telerik team
0
Anna Smith
Top achievements
Rank 1
answered on 30 Dec 2005, 02:44 PM
Great. Thank you very much, and happy new year!

Anna
Tags
RadEditor
Asked by
Anna Smith
Top achievements
Rank 1
Answers by
Anna Smith
Top achievements
Rank 1
Atanas Korchev
Telerik team
Share this question
or