
Troy Clark
Top achievements
Rank 1
Troy Clark
asked on 02 Nov 2010, 04:13 AM
Hi Guys,
We have just noticed that when pasting from word documents that there are <b> and <i> tags. We would prefer that they convert to <strong> and <em> respecively.
We added the MozEmStrong property to our configfile.xml but have found that this only works for Firefox (obviously!) and not for IE. Is there a way to make it work for IE??
Cheers,
clarky
We have just noticed that when pasting from word documents that there are <b> and <i> tags. We would prefer that they convert to <strong> and <em> respecively.
We added the MozEmStrong property to our configfile.xml but have found that this only works for Firefox (obviously!) and not for IE. Is there a way to make it work for IE??
Cheers,
clarky
4 Answers, 1 is accepted
0
Hi Clarky,
You can use the following custom content filter to convert <b> and <i> tags to <strong> and <em> respectively:
Regards,
Rumen
the Telerik team
You can use the following custom content filter to convert <b> and <i> tags to <strong> and <em> respectively:
<telerik:RadEditor runat=
"server"
ID=
"RadEditor1"
OnClientLoad=
"OnClientLoad"
></telerik:RadEditor>
<script type=
"text/javascript"
>
function
OnClientLoad(editor, args) {
editor.get_filtersManager().add(
new
MyFilter());
}
MyFilter =
function
() {
MyFilter.initializeBase(
this
);
this
.set_isDom(
false
);
this
.set_enabled(
true
);
this
.set_name(
"RadEditor filter"
);
this
.set_description(
"RadEditor filter description"
);
}
MyFilter.prototype =
{
getHtmlContent:
function
(content) {
var
newContent = content.replace(
new
RegExp(
"<b(\\s([^>])*?)?>"
,
"ig"
),
"<strong$1>"
);
newContent = newContent.replace(
new
RegExp(
"</b(\\s([^>])*?)?>"
,
"ig"
),
"</strong$1>"
);
newContent = newContent.replace(
new
RegExp(
"<i(\\s([^>])*?)?>"
,
"ig"
),
"<em$1>"
);
newContent = newContent.replace(
new
RegExp(
"</i(\\s([^>])*?)?>"
,
"ig"
),
"</em$1>"
);
return
newContent;
}
}
MyFilter.registerClass(
'MyFilter'
, Telerik.Web.UI.Editor.Filter);
</script>
Regards,
Rumen
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

Raj Gupta
Top achievements
Rank 1
answered on 29 Nov 2010, 05:37 AM
Hi Rumen,
I am using RadHtmlField (inside a SharePoint page layout) instead of RadEditor and tried your solution as follows:
1. Added the javascript you have provided to the master page inside the PlaceHolderAdditionalPageHead content place holder
2. Added the following to the Config.xml file:
<configuration>
...
<property name="OnClientLoad">OnClientLoad</property>
</configuration>
My page layout tags look like:
The reason I am trying to add the script to the master page is that I have several page layouits and was hoping that putting it in the master page and creating the Config.cml entry will minimise the need to change the various page layouts.
However, after doing this, I don't see the <b> or the <i> tags being replaced. I am not sure if I am missing something and would greatly appreciate your help.
Thank you,
Raj
I am using RadHtmlField (inside a SharePoint page layout) instead of RadEditor and tried your solution as follows:
1. Added the javascript you have provided to the master page inside the PlaceHolderAdditionalPageHead content place holder
2. Added the following to the Config.xml file:
<configuration>
...
<property name="OnClientLoad">OnClientLoad</property>
</configuration>
My page layout tags look like:
<%
@ Register TagPrefix="radE" Namespace="Telerik.SharePoint.FieldEditor" Assembly="RadEditorSharePoint, Version=5.8.0.0, Culture=neutral, PublicKeyToken=1f131a624888eeed" %>
<
radE:RadHtmlField ID="RichHtmlField1" CssClass="RadEditorControl" FieldName="AppPageContent1" runat="server" AllowScripts="true" AllowSpecialTags="true" />
The reason I am trying to add the script to the master page is that I have several page layouits and was hoping that putting it in the master page and creating the Config.cml entry will minimise the need to change the various page layouts.
However, after doing this, I don't see the <b> or the <i> tags being replaced. I am not sure if I am missing something and would greatly appreciate your help.
Thank you,
Raj
0
Hi Raj,
Can you please put the JavaScript code in the following JavaScript file:
/Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/MOSSEditorTools.js
This file will be loaded in all pages having RadEditor in them.
If you still experience any problems, troubleshoot them by adding an alert in the OnClientLoad function and make sure that it is executed. You should also check for JavaScript errors and debug them.
Sincerely yours,
Rumen
the Telerik team
Can you please put the JavaScript code in the following JavaScript file:
/Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/MOSSEditorTools.js
This file will be loaded in all pages having RadEditor in them.
If you still experience any problems, troubleshoot them by adding an alert in the OnClientLoad function and make sure that it is executed. You should also check for JavaScript errors and debug them.
Sincerely yours,
Rumen
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Raj Gupta
Top achievements
Rank 1
answered on 06 Dec 2010, 01:55 AM
Hi Rumen,
After putting the script into the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/MOSSEditorTools.js, it works!
Thanks for your help.
Raj
After putting the script into the /Program Files/Common Files/Microsoft Shared/web server extensions/wpresources/RadEditorSharePoint/5.x.x.0__1f131a624888eeed/Resources/MOSSEditorTools.js, it works!
Thanks for your help.
Raj