HI all,
i need to capture the new content of the editor in paste command.
i checked all the forums and i didn't get any solution for this.
please help me in this issue.
in which i can get the new value of editor.
Thanks & Regards,
Krishnakanth
1 Answer, 1 is accepted
0
Rumen
Telerik team
answered on 20 Feb 2009, 12:17 PM
Hi Krishnakanth,
In the upcoming Q1 2009 "Futures" release of RadControls for ASP.NET AJAX, the OnClientPasteHtml event of RadEditor will be fired when the onpaste browser event is executed. This will allow the developer to obtain and modify / clean only the pasted, but not the whole content inside the editor.
Here is a sample example that demonstrates how to attach to the Paste command:
<script type="text/javascript">
function OnClientPasteHtml(sender, args)
{
var commandName = args.get_commandName();
var value = args.get_value(); //this is the pasted content
if (commandName == "Paste")
{
alert("original pasted content: " + value);
var newContent = "modified content"; //write here a regular expression that will strip the <h1>, <h2>, <h3>, etc tags
alert("modified pasted content" + newContent);
args.set_value(newContent); //insert the modified content in the editor
}
}
</script>
<telerik:RadEditor runat="server"
OnClientPasteHtml="OnClientPasteHtml"
ImageManager-ViewPaths="~/"
ID="RadEditor1">
</telerik:RadEditor>
The onpaste event will be executed only when the StripFormattingOptions property is not set toNoneSupressCleanMessage, because then the editor does not execute any code to handle the pasted content and it is pasted without modifications by the browser itself.