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.');
}
});
}
In the above example the following line:
should be:
That should enable the list items to be dragged and dropped.
To allow the items to be dropped on the TinyMCE textarea the following code works.
Try to declare on TinyMCE body’s tag like this, it works for me
On tiny_mce_src.js
On editor’s page:
It’s seems using jquery with TinyMCE doesn’t work …