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

RadHtmlField for SharePoint 2010 WCM

5 Answers 135 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Ishfaq Khan
Top achievements
Rank 1
Ishfaq Khan asked on 01 Aug 2010, 07:58 PM

Hi,

should I use RadHtmlField if I want to replace PublishingWebControls:RichHtmlField? I noticed that RadHtmlField doesnt have the onClientPasteHtml event. How can I then modify the content that has been pasted into RadEditor? Thanks in advance.

Sincerely,

Ishfaq Khan

5 Answers, 1 is accepted

Sort by
0
Stanimir
Telerik team
answered on 02 Aug 2010, 12:03 PM
Hi Ishfaq Khan,

Regarding the OnClientPasteHtml here is what you need to do:

1. Review the following article Set Properties Via Config File. Add the following element in the respective ConfigFile.xml or ListConfigFile.xml (for list scenarios, such as list, wiki, blog ...) files, which you can find in the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/6.x.x.0__1f131a624888eeed/Resources/ folder.

<propertyname="OnClientPasteHtml">OnClientPasteHtml</property>

2. Add the following javascript method in the page where the editor is loaded. One good place for this is the MOSSEditorTools.js file, which is in the mentioned above folder.
functionOnClientPasteHtml(editor, args)
{
    //method code
}


All the best,
Stanimir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Ishfaq Khan
Top achievements
Rank 1
answered on 02 Aug 2010, 01:20 PM

Hi,

and thanks for the quick reply.

I'm now replacing one of my PublishingWebControls:RichImageField fields with the RadHtmlField. It has been defined this way:

1. <%@ Register assembly="RadEditorSharePoint, Version=6.0.0.0, Culture=neutral, PublicKeyToken=1f131a624888eeed" namespace="Telerik.SharePoint.FieldEditor" tagprefix="cc1" %>

2. <cc1:RadHtmlField runat="server" ID="RadEditor1" />

3. In the ConfigFile.xml, I have defined the following property:

<property name="StripFormattingOptions">MSWordRemoveAll,Css,Span</property>

-----------------------------------------------------------------------------------------------------------------------------

Now, I am copying and pasting (Ctrl+V) in some text from Word and into the "Design" view of RadEditor. There are several issues that arises after the paste has been made:



* In IE 8, when I look at the "<> HTML" view, all Word related tags are removed and all styles as well. The only tag that doesn't get removed are the span tags. Please look at the attached image.



* In FF 3.6.8, when I look at the "<> HTML" view, I can see that no tags has been removed at all. So it seems that the StripFormattingOptions property was totally overlooked. Please look at the attached image.



* In FF 3.6.8, when using:



<property name="OnClientPasteHtml">OnClientPasteHtml</property>

it seems that this function is never run. In IE 8 this works as expected.



------------------------------------------------------------------------------------------------------------------------------



I read here: http://www.telerik.com/help/aspnet-ajax/editor-whats-new.html under the " What's new in Telerik RadEditor for ASP.NET AJAX Q2 2008" heading that:


Enabled the StripFormattingOptions options in Firefox 3. Content will be automatically processed now when the user pastes using Ctrl-V.


so shouldnt this be working under FF? I would really appreciate any input on these issues. Thanks in advance.



Sincerely,

Ishfaq Khan

0
Ishfaq Khan
Top achievements
Rank 1
answered on 02 Aug 2010, 02:55 PM

Hi again,

I continued with my test on the RadHtmlField. This time I copied some dummy text and a table from Word (see attached word document) and pasted (ctrl+v) this into the radeditor in IE 8.  I set the StripFormattingOptions property to MSWordRemoveAll,Css,Span.

* As seen on the attached picture, the designview and htmlview looks as expected except from the span tags that still shows up. In Htmlview, the table is still intact.

* Then I save the page, and I see that the table is gone (see attached picture). 

* When I look at the HTMLView of the RadEditor, I see that the table tag (tr,td,etc.) are all gone. (attached image).

Why is the html that gets saved different from what is shown in the HTMLview? And why is the table getting replaced by p tags ?

Sincerely,

Ishfaq Khan

0
Ishfaq Khan
Top achievements
Rank 1
answered on 03 Aug 2010, 02:23 PM

Hi,

I got most of this working now, but I still experience some problems when doing a "paste from word" with the following property set:

  <property name="StripFormattingOptions">MSWordRemoveAll,Font,Span,Css</property>

This works (almost) as expected, but I experience 2 problems:

* some of the style attributes are not removed: i.e. <p style="margin: 0cm 0cm 10pt;"> 

<table cellspacing="0" cellpadding="0" border="1" style="border-collapse:collapse;border:medium none">

* sometimes tables tags (table, tr, td, etc.) are removed and replaced by p-tags on save

Am I doing something wrong to get this result and what can I do to fix this?

Sincerely,

Ishfaq Khan

0
Stanimir
Telerik team
answered on 04 Aug 2010, 09:27 AM
Hello Ishfaq,

Could you provide us with a sample word document, which we can use to reproduce the issue on our test server? After I review it I will be able to advise you further.


Regards,
Stanimir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
WebParts for SharePoint
Asked by
Ishfaq Khan
Top achievements
Rank 1
Answers by
Stanimir
Telerik team
Ishfaq Khan
Top achievements
Rank 1
Share this question
or