I'm trying to enable the WordPress content editor as a droppable using jQuery UI drag and drop. However, I can't get the drag to drop, or the drop event to fire.
Is there something I'm missing?
<ul id="keywords">
<li>drag one</li>
<li>drag two</li>
<li>drag three</li>
</ul>
jQuery("#keywords").find("li").each(function(){jQuery(this).draggable(
{
helper:'clone',
start: function(event, ui){
jQuery(this).fadeTo('fast', 0.5);},
stop: function(event, ui) {
jQuery(this).fadeTo(0, 1);
}
});
});
jQuery('#content').droppable(
{
drop: function(event, ui)
{
alert('dropped in content'); //DOES NOT FIRE!!!
jQuery(this).dropIt(ui.draggable.html());
}
});
if(typeof tinyMCE=='object')
{
alert('tinyMCE is active'); //DOES NOT FIRE!!!
jQuery('#editorcontainer').droppable(
{
drop: function(event, ui)
{
alert('dropped in tinyMCE editor'); //DOES NOT FIRE!!!
//Dynamically add content
tinyMCE.activeEditor.execCommand('mceInsertContent', false, 'New content.');
}
});
}
#content, that's hidden away in the background so to speak, TinyMCE creates a frame where content is managed, which is then later sent(or inserted) into the original textarea. @cheesypeanut has you covered. – t31os Aug 5 '11 at 0:19