Make WordPress Core

Ticket #30998: 30998.patch

File 30998.patch, 1.6 KB (added by tyxla, 11 years ago)

Cloning and removing the list group item as in jQuery UI 1.11.1

  • wp-includes/js/jquery/ui/draggable.js

     
    766766                });
    767767        },
    768768        drag: function( event, ui, draggable ) {
     769
     770                var that = this;
     771
    769772                $.each( draggable.sortables, function() {
    770773                        var innermostIntersecting = false,
    771774                                sortable = this;
     
    799802                                // so that the move-in stuff gets fired only once.
    800803                                if ( !sortable.isOver ) {
    801804                                        sortable.isOver = 1;
     805                                        //Now we fake the start of dragging for the sortable instance,
     806                                        //by cloning the list group item, appending it to the sortable and using it as draggable.currentItem
     807                                        //We can then fire the start event of the sortable with our passed browser event, and our own helper (so it doesn't create a new one)
     808                                        sortable.currentItem = $(that).clone().removeAttr("id").appendTo(sortable.element).data("ui-sortable-item", true);
    802809
    803                                         sortable.currentItem = ui.helper
    804                                                 .appendTo( sortable.element )
    805                                                 .data( "ui-sortable-item", true );
    806 
    807810                                        // Store helper option to later restore it
    808811                                        sortable.options._helper = sortable.options.helper;
    809812
     
    872875                                        sortable.options.revert = sortable.options._revert;
    873876                                        sortable.options.helper = sortable.options._helper;
    874877
     878                                        //Now we remove our currentItem, the list group clone again, and the placeholder, and animate the helper back to it's original size
     879                                        sortable.currentItem.remove();
    875880                                        if ( sortable.placeholder ) {
    876881                                                sortable.placeholder.remove();
    877882                                        }