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

refresh editor after pasteHtml(args)

1 Answer 51 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Fit2Page asked on 19 Nov 2009, 08:13 AM
Hi,

I created a custom tool for insertion of YouTube embed code.
pasteHtml works perfect but how do I refresh the editor screen after the pasteHtml command?

When I switch to Code and the back to Design then the screen is updated with the movie placeholder.

Thanks,
Marc

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 24 Nov 2009, 12:29 PM
Hi Marc,

Here is an example how to use the editor's filters to paste Flash content in the editor:

<telerik:RadEditor ID="RadEditor1" runat="server"></telerik:RadEditor>
 
<script type="text/javascript">
 
function insert()
{
    var editor = $find('<%=RadEditor1.ClientID %>');
    var html = '<object height="150" width="150" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="Movie" value="/demos/aspnet/Prometheus/Editor/Img/UserDir/Marketing/ASP Overivewpage banner.swf"><param name="play" value="true"><param name="quality" value="high"><param name="wmode" value="transparent"><param name="loop" value="false"><param name="menu" value="false"><embed src="/demos/aspnet/Prometheus/Editor/Img/UserDir/Marketing/ASP Overivewpage banner.swf" originalAttribute="src" originalPath="/demos/aspnet/Prometheus/Editor/Img/UserDir/Marketing/ASP Overivewpage banner.swf" originalAttribute="src" originalPath="/demos/aspnet/Prometheus/Editor/Img/UserDir/Marketing/ASP Overivewpage banner.swf" width="150" height="150" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" quality="high" wmode="transparent" loop="false" menu="false"></embed></object>';
 
    var filterIE = editor._filtersManager.getFilterByName("IEKeepObjectParamsFilter");
    var filterMozz = editor._filtersManager.getFilterByName("MozillaKeepFlashString");
    html = (filterIE)?filterIE.getDesignContent(html):html;
    html = (filterMozz)?filterMozz.getDesignContent(html):html;
    editor.pasteHtml(html, "Insert Flash");
}
</script>
<input type="button" value="click" onclick="insert();" />

In other case the browser will modify the pasted flash content and it will not play.

If this does not help, you can also programmatically switch between the Html and Design modes of RadEditor using the

editor.set_mode() method. You can try

editor.set_mode(2);
editor.set_mode(1);
editor.pasteHtml(" flash content");

Kind regards,
Rumen
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.
Tags
Editor
Asked by
Fit2Page
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Rumen
Telerik team
Share this question
or