I'm writing an inline CMS where content is edited by admins by hitting 'edit' buttons on the front end.
I need web forms containing multiple tinymces to open in a lightbox and need an elegant solution. I have the web forms working at their own urls (for non js users), and am loading these in with ajax into a colorbox lightbox. This is what I have so far:
jQuery(document).ready(function(){
jQuery(".ajax").colorbox({
onComplete : function(){ tinyMCE.execCommand('mceAddControl', true, "mytextarea"); },
onClosed : function(){ tinyMCE.execCommand('mceRemoveControl', true, "mytextarea");}
});
});
...
<a class='ajax' href="/mywebformurl #mywebform">Edit</a>
I have three problems:
This only works for text areas with the id mytextarea
. I want it to work with all text areas with the class .tiny_mce
(as per my tinymce config which has mode : "specific_textareas", editor_selector : "tiny_mce"
).
I don't want to load tinymce on the host page, only when the lightbox is opened.
How can I remove the #mywebform
addition to the href, but still get it to load only the webform, and not the entire page at /mywebformurl?
Essentially, I'd like the ajax loaded content to be independent, and work as it does when I visit the mywebform url directly (making it's own js includes etc). I am considering an iFrame rather than ajax, but have always worked on the assumption that iframes should be avoided at all costs.