PasteHTML behavior custom dialogue

7 posts, 0 answers
  1. Matt
    Matt avatar
    11 posts
    Member since:
    Jun 2007

    Posted 12 Aug 2008 Link to this post

    I have a custom dialog for Quicktime movies I'm just using a simple
    object embed etc..

    so I am returning a file name and using the editor.pasteHTML method

    when I use the editor.pasteHTML it is not pasting the <param> tags in my string, its like it is stripping them out completely

    heres the code, why woulkd it be doing this???


    var myCallbackFunction = function(sender, args)

    {

    if(content == "")

    {

    content = args.name;

    }

    editor.pasteHtml(String.format(

    "<div><div style=\"background: #000; vertical-align: middle; text-align: center\"><object style=\"background-color: #000000\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" height=\"376\" width=\"640\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\"><param name=\"SRC\" VALUE=\"/assets/Media/{0}\"><param name=\"AUTOPLAY\" VALUE=\"true\"><param name=\"AUTOSTART\" VALUE=\"true\"><param name=\"CONTROLLER\" VALUE=\"true\"><param name=\"kioskmode\" VALUE=\"true\"><param name=\"bgcolor\" value=\"#000000\" ><EMBED SRC=\"/assets/Media/{0}\" originalAttribute="SRC" originalPath="\"/assets/Media/{0}\"" WIDTH=\"640\" HEIGHT=\"376\" kioskmode=\"true\" AUTOPLAY=\"true\" CONTROLLER=\"true\" PLUGINSPAGE=\"http://www.apple.com/quicktime/download/\"></EMBED></object></div></div>", args.name))

    }

    editor.showDialog(

    "InsertVideo", {}, myCallbackFunction);

    };

  2. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 13 Aug 2008 Link to this post

    Hi Matt,

    This is Internet Explorer browser behavior to strip the inner PARAM tags of the OBJECT tag and you can verify that by testing the editor in Firefox.

    Nevertheless, I found the following workaround which will help you to solve the problem:


    <telerik:radeditor runat="server" ID="RadEditor1"></telerik:radeditor>
    <input type="button" value="Paste Content" onclick="InsertSpan();return false;" />
    <script type="text/javascript">
    function InsertSpan()
    {                 
      var editor = $find("<%=RadEditor1.ClientID%>"); //get a reference to the editor
      var args = {};
      args.name = "test";
      editor.set_mode(2);//set the editor in Html mode
      editor.pasteHtml(String.format("<div><div style=\"background: #000; vertical-align: middle; text-align: center\"><object style=\"background-color: #000000\" codebase=\"http://www.apple.com/qtactivex/qtplugin.cab\" height=\"376\" width=\"640\" classid=\"clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B\"><param name=\"SRC\" VALUE=\"/assets/Media/{0}\"><param name=\"AUTOPLAY\" VALUE=\"true\"><param name=\"AUTOSTART\" VALUE=\"true\"><param name=\"CONTROLLER\" VALUE=\"true\"><param name=\"kioskmode\" VALUE=\"true\"><param name=\"bgcolor\" value=\"#000000\" ><EMBED SRC=\"/assets/Media/{0}\" WIDTH=\"640\" HEIGHT=\"376\" kioskmode=\"true\" AUTOPLAY=\"true\" CONTROLLER=\"true\" PLUGINSPAGE=\"http://www.apple.com/quicktime/download/\"></EMBED></object></div></div>", args.name)) ;
      editor.set_mode(1); //switch back to Design mode
    }
    </script>


    Sincerely yours,
    Rumen
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Yazhou
    Yazhou avatar
    4 posts
    Member since:
    Feb 2009

    Posted 17 Feb 2009 Link to this post

    Hi,
    I have the same problem. First i use the method:

    editor.set_mode(2);
      editor.pasteHtml(phtml);
    editor.set_mode(1);

    and this resovled the problem, but another quetion is , the phtml is pasted at the beginning of the editor.
    how to paste the phtml  to the cursor position?

  5. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 20 Feb 2009 Link to this post

    Hi Yazhou,

    Please, does not use the set_mode() method any more because it causes the reported side effect. Internet Explorer automatically strips all param elements in the object tag when you paste the content. To workaround this browser issue, we have created a special content filter, which saves the param tags. You should run this filter on the html content before you paste it in the editor:

    var flashContent = "<object type=\"application/x-shockwave-flash\" data=\"FlowPlayerWhite.swf\"" 
                    +"width=\"320\" height=\"240\">
                    +"<param name=\"allowScriptAccess\" value=\"sameDomain\" />
                    +"<param name=\"movie\" value=\"FlowPlayerWhite.swf\" />
                    +"<param name=\"quality\" value=\"high\" />
                    +"<param name=\"scale\" value=\"Scale\" />
                    +"<param name=\"wmode\" value=\"transparent\" />
                    +"<param name=\"flashvars\" value=\"config={videoFile: 'users/20071214171739381/stewsterl63FE7EA9A89E95419AB6CEB6C4F79399D/Videos/flv/9a770edb-6.flv' , showMenu: false , loop: false , showLoopButton: false}\" />
                    +"</object> "; 
    var filterIE = $find("RadEditor1").get_filtersManager().getFilterByName("IEKeepObjectParamsFilter"); 
    flashContent = (filterIE)?filterIE.getDesignContent(flashContent):flashContent; 
    $find("RadEditor1").pasteHtml(flashContent);  


    In Firefox you can use this filter:

    flashContent = (filterMozz)?filterMozz.getDesignContent(flashContent):flashContent;

    All the best,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Yazhou
    Yazhou avatar
    4 posts
    Member since:
    Feb 2009

    Posted 25 Feb 2009 Link to this post

    Hi ,

    Can this solution work for Editor Lite(MOSS)?

    Now when i try to use your code, there is  a javascript error, "Object doesn't support this property or method.", when  the code runs to get_filtersManager(). method.



    Thanks

  7. Rumen
    Admin
    Rumen avatar
    12849 posts

    Posted 27 Feb 2009 Link to this post

    Hi Yazhou,

    Yes, this code should work for MOSS, but you should replace the $find("RadEditor1") method with your reference to RadEditor, e.g.

    var filterIE = editor.get_filtersManager().getFilterByName("IEKeepObjectParamsFilter");

    All the best,
    Rumen
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  8. Yazhou
    Yazhou avatar
    4 posts
    Member since:
    Feb 2009

    Posted 02 Mar 2009 Link to this post

    Thank you very much.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017