Make WordPress Core

Ticket #41894: 41894.patch

File 41894.patch, 1.1 KB (added by hazimayesh, 8 years ago)

This is a patch to fix the problem when you delete widgets. it won't prompt alert

  • widgets.js

     
    283283                                wpWidgets.hoveredSidebar = null;
    284284
    285285                                if ( $widget.hasClass('deleting') ) {
     286                                       
    286287                                        wpWidgets.save( $widget, 1, 0, 1 ); // delete widget
     288                                       
    287289                                        $widget.remove();
    288290                                        return;
    289291                                }
     
    372374                        },
    373375                        drop: function(e,ui) {
    374376                                ui.draggable.addClass('deleting');
     377                               
    375378                                $('#removing-widget').hide().children('span').empty();
    376379                        },
    377380                        over: function(e,ui) {
     
    516519                                if ( animate ) {
    517520                                        order = 0;
    518521                                        widget.slideUp('fast', function(){
     522                                               
    519523                                                $(this).remove();
     524                                                $(this).removeClass('widget-dirty')
    520525                                                wpWidgets.saveOrder();
     526                                                delete self.dirtyWidgets[ id ]
    521527                                        });
    522528                                } else {
    523529                                        widget.remove();
     530                                        widget.removeClass( 'widget-dirty' );
    524531
     532                                        // Clear the dirty flag from the widget.
     533                                        delete self.dirtyWidgets[ id ];
     534
    525535                                        if ( sidebarId === 'wp_inactive_widgets' ) {
    526536                                                $( '#inactive-widgets-control-remove' ).prop( 'disabled' , ! $( '#wp_inactive_widgets .widget' ).length );
    527537                                        }