Hello girls & guys,
I need help implementing an CKEditor plugin which let me add some JavaScript. Really important is the need to represent the code even if you are in WYSIWYG mode. It should also be possible to make changes later on, by doubleclicking the item.
I used the iFrame-Plugin as example and got a working dialog which let me insert elements and keep them drag- and dropable even in WYSIWYG mode (fake obj). The problem is now, the transformation for- and backwards into my JavaScript snipped when I switch to source code mode.
My idea is so far to transform the code via regex if the user switches modes. My problem is, I don't know how to "hack into" the transformation event. I read something about DataProcessor's, but couldn't figure how to apply it to my problem.
The fake obj I have so far looks like:
The code I get so far is this (in source view):
<tag allowtracking="true" height="100" src="www.google.de" trackingfilename="url" trackingtitel="urlTitle" width="100"></tag>
The code I want to get:
<div id="playerDiv1" style="background-color: #000; width: 300px; height: 150px; display: block;"> <script language="JavaScript" type="text/javascript"> $(document).ready(function() { tagger('playerDiv1').setup( configCKEditor('www.google.de', 300, 150, 'url', 'urlTitle') ); }); </script>
Thanks for helping,
-lony
P.S.: If you could not help with this problem, but you have an alternative idea please be free to answer also.