views:

329

answers:

1

I am working on a jQuery-based plugin as a drupal module that will tweak the comment form for a content type so that it appears inline on clicking certain content. When I try to clone() the comment form and append it to a hidden div so that I can access it later, the TinyMCE iframe does not come with the cloning, so I'm left with an empty iframe which I cannot enter text into.

I've tried to go into the iframe contentDocument and individually clone the child elements, but that hasn't worked. I've also tried to rearrange the module load order by altering the weight field in the drupal system table, so that my JS loads before the WYSIWYG module and TinyMCE library JS, but haven't been able to change the module load order either. I even used the Util drupal module to change modules weights with no luck. Any ideas on how to get a functioning TinyMCE iframe within a cloned div?

Thanks, Dakota

A: 

If you don't load the js for tinyMCE you can do your DOM manipulations first and then load the tinyMCE js with your own js. I haven't tested this and looked into how tinyMCE does things. But if you want your script to run first, that solution should work.

googletorp
Thanks, this is probably the simplest way to go about it, though may not be of help to others who are looking to initialize TinyMCE instances for new textareas they create. I think this is certainly the best way to go about this and will credit your answer in a week if there's no other activity. Thanks for your help.
Dakota R.