Ticket #19675: 19675.patch
| File 19675.patch, 1.8 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/js/widgets.js
170 170 171 171 wpWidgets.save( $widget, 0, 0, 1 ); 172 172 $widget.find('input.add_new').val(''); 173 $( document ).trigger( 'widget-added', [ wpWidgets._widgetModel( $widget ) ] ); 173 174 } 174 175 175 176 $sidebar = $widget.parent(); … … 374 375 } else { 375 376 $('.spinner').hide(); 376 377 if ( r && r.length > 2 ) { 377 $( 'div.widget-content', widget ).html( r);378 $( 'div.widget-content', widget ).html( r ); 378 379 wpWidgets.appendTitle( widget ); 380 $( document ).trigger( 'widget-updated', [ wpWidgets._widgetModel( widget ) ] ); 379 381 } 380 382 } 381 383 if ( order ) { … … 440 442 // No longer "new" widget 441 443 widget.find( 'input.add_new' ).val(''); 442 444 445 $( document ).trigger( 'widget-added', [ wpWidgets._widgetModel( widget ) ] ); 446 443 447 /* 444 448 * Check if any part of the sidebar is visible in the viewport. If it is, don't scroll. 445 449 * Otherwise, scroll up to so the sidebar is in view. … … 478 482 clearWidgetSelection: function() { 479 483 $( '#widgets-left' ).removeClass( 'chooser' ); 480 484 $( '.widget-in-question' ).removeClass( 'widget-in-question' ); 485 }, 486 487 _widgetModel: function( $widget ) { 488 return { 489 $el: $widget, 490 id: $widget.find( 'input[name="widget-id"]' ).val(), 491 idBase: $widget.find( 'input[name="id_base"]' ).val(), 492 sidebarId: $widget.closest( 'div.widgets-sortables' ).attr( 'id' ), 493 width: $widget.find( 'input[name="widget-width"]' ).val(), 494 height: $widget.find( 'input[name="widget-height"]' ).val(), 495 number: $widget.find( 'input[name="widget_number"]' ).val(), 496 multiNumber: $widget.find( 'input[name="multi_number"]' ).val() 497 }; 481 498 } 482 499 }; 483 500