November Happy Hour will be moved to Thursday December 5th.

Editor Plug-in

Vote:
 

Hi,

I'm creating an Editor Plug-in. The plug-in need to put som javascript in the editor, here is a part of my code:

function OnMovieDialogClosed(returnValue, callbackArguments)

{

var plugin = callbackArguments;

var sHTML = '';

var range = plugin.editorDocument.selection.createRange();

sHTML = "<SCRIPT type='text/javascript'>function test { }</SCRIPT><DIV id='moviePlugin'></DIV>";

range.pasteHTML(sHTML);

}

When I run this the only thing that ends up in the editor is the DIV, the SCRIPT part is ignored. Is there any way to do this? It is possible to put javascript code manually in the editor. I can't find any documentation on the editor API.

 /Ola.

#20243
May 23, 2008 14:12
Vote:
 

There are some limitations in Internet Explorer:

 a) The first tag cannot be a SCRIPT tag
 b) You must have some text in the editor

So, this HTML should work:

<DIV id=moviePlugin>movie</DIV>
<SCRIPT type=text/javascript>function test { }</SCRIPT>

#20250
May 23, 2008 16:37
Vote:
 

Excellent! Now it works!

 Thank you!

#20251
May 24, 2008 14:35
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.