refresh editor after pasteHtml(args)

2 posts, 0 answers
  1. Fit2Page
    Fit2Page avatar
    345 posts
    Member since:
    Feb 2007

    Posted 19 Nov 2009 Link to this post

    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
  2. Rumen
    Admin
    Rumen avatar
    12851 posts

    Posted 24 Nov 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top