Tutorial :add embedded elements in fckeditor plugin



Question:

I am try to create a new fckeditor plugin similar to fck flash plugin, that will write html in the following format

<object id="id">  </object>  <script type="text/javascript">      someJavascriptcode();  </script>  

I can create object element using

e = FCK.EditorDocument.createElement( 'object' ) ;  SetAttribute( e, 'id', 'id1' ) ;  

how do I wrap the javascript code (as html text or something)

oEditor.FCK.InsertHtml('<p>test</p>');  

works, but when I wrap the javascript code (with imports), it does not work, html html code is not inserted.

ok. looks like fckeditor is removing the script tags.. how do I stop this behavior.


Solution:1

I was able to add by adding javascript on the protected source on fckconfig.js file

FCKConfig.ProtectedSource.Add( /<javascript>[\s\S]*?&lt;\/javascript&gt;/g );  


Solution:2

Try this, works in the regex tester anyway.

FCKConfig.ProtectedSource.Add( /<script>[\s\S]*?<\/script>/g );  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »