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

PasteHTML behavior custom dialogue

6 Answers 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 2
Matt asked on 13 Aug 2008, 01:34 AM

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);

};

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 13 Aug 2008, 07:13 AM
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.
0
Yazhou
Top achievements
Rank 1
answered on 18 Feb 2009, 03:05 AM
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?

0
Rumen
Telerik team
answered on 20 Feb 2009, 06:49 PM
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.
0
Yazhou
Top achievements
Rank 1
answered on 25 Feb 2009, 06:47 AM

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

0
Rumen
Telerik team
answered on 27 Feb 2009, 03:22 PM
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.
0
Yazhou
Top achievements
Rank 1
answered on 02 Mar 2009, 10:35 AM
Thank you very much.
Tags
Grid
Asked by
Matt
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Yazhou
Top achievements
Rank 1
Share this question
or