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

Problem using RadHtmlField in MOSS-PageLayout with custom ImageManager

2 Answers 94 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Ricky Mattischeck
Top achievements
Rank 1
Ricky Mattischeck asked on 21 Oct 2009, 04:22 PM
Hi there,

I try to use the RADEditor in a SharePoint PageLayout as a substiture for the PublishingWebControls:RichHtmlField.

First I tried to use telerik:RadHtmlField instead of the default MOSS-Tag. But I want to set my own, individual (dynamical) paths for the Editor's ImageManager, DocumentManager, etc. so I can't use the config-file. As a matter of this, I created my own class which has Telerik.SharePoint.FieldEditor.RadHtmlField as base-class and a public method that returns the radEditorControl:

    public class SLRADHtmlField : Telerik.SharePoint.FieldEditor.RadHtmlField 
    { 
        public MOSSRadEditor GetMOSSRADEditorControl() 
        { 
            return radEditorControl; 
        } 
    } 


Now I can replace <telerik:RadHtmlField id="..." FieldName="Resolution".../> by my own tag <sl:SLRadHtmlField id="..." FieldName="Resolution".../>

In the overridden OnLoadComplete-Method in my CodeBehind-Class now I have access to the RadEditor-Control by using the following code:

MOSSRadEditor RadEditor = SLRADHtmlField.GetMOSSRADEditorControl(); 


After this, I can modify ImageManager-settings and so on...

First trying seemed to be successful, the entered text was saved after submitting. So I tried some little more like formatting in bold, italic, underline. That was successfully too.. partial. The underline-style was not saved. After that, I tried to insert an image. Adding the image to the editor-field was successful too but after saving, the image was gone.

I had a look to the html-tab in the editor and both, the <span>-tag for the underlining and the <img>-tag were removed.
After a lot of googling and reading other threads in this forum, I found this page about contentfilters. Now I added this line to my code:

RadEditor.ContentFilters = EditorFilters.None; 


It prevents that the underline-tag is stored as <span> but remains as <u>-tag.
This solved the problem with the disappearing underline but not with the disappearing <img>-tag.

It seems that some special tags (like <span> or <img>) are stripped out completely but I haven't looked yet which other tags are also removed.

Meanwhile I don't have any ideas no more...

Could you please give me some guidance?

I installed the radeditormoss.wsp and added references in my Visual Studio project to the RadEditorSharePoint.dll Version 5.5.1.0 and because of that to the Telerik.Web.UI.dll Version 2009.2.826.20.

Greetings from Germany,
Ricky Mattischeck

2 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 22 Oct 2009, 07:03 AM
Hi Ricky,

Please send us sample with HTMlL code, which is stripped on save and I will run some tests on our test server. How ever what you should know is that you can see the code that is send to the server, when you are in Html mode of the RadEditor. When you set the Editor's ContentFilters to None there are no modifications of the code done by the RadEditor.

Keep in mind that this might be yet another problem, caused by the MOSS content filter. When you submit the page, MOSS will validate it and automatically make changes if the content is not valid. You can verify this by trying to enter the same content with the original SharePoint rich text editor.



Greetings,
Stanimir
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Ricky Mattischeck
Top achievements
Rank 1
answered on 22 Oct 2009, 01:38 PM
Hi Stanimir,

nevermind, I found the reason for this behaviour.

After a lot of digging and comparing between created page-layout-aspx-file, fields and contenttypes created by me in xml and created by ui, I discovered, that the setting for the RichTextMode-attribute in the column of my contenttype attached to the pages-list is "Compatible" but in the field directly added to the site collection it is set to "FullHTML". This was my mistake! The correctly written value has to be "FullHtml" (small letters). So while programmatically attaching the conttenttype to the pages-list sharepoint couldn't recognize the value "FullHTML" in the SPRichTextMode-enumeration and sets the default-value which is "Compatible".

Now everything works like a charm.

Greetings,
Ricky Mattischeck
Tags
WebParts for SharePoint
Asked by
Ricky Mattischeck
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Ricky Mattischeck
Top achievements
Rank 1
Share this question
or