diff --git a/src/wp-admin/css/wp-admin.css b/src/wp-admin/css/wp-admin.css index 79fa3f885e..73507b14b1 100644 --- a/src/wp-admin/css/wp-admin.css +++ b/src/wp-admin/css/wp-admin.css @@ -889,7 +889,7 @@ input[type="url"]:focus, input[type="checkbox"]:focus, input[type="radio"]:focus, select:focus, -#widgets-chooser ul, +.widgets-chooser ul, #widgets-left .widget-in-question .widget-top, #available-widgets .widget-top:hover, div#widgets-right .widget-top:hover { @@ -10392,22 +10392,22 @@ div#widgets-right .widgets-sortables { pointer-events: auto; } -#widgets-chooser ul.widgets-chooser-sidebars { +.widgets-chooser ul.widgets-chooser-sidebars { margin: 0; list-style-type: none; max-height: 300px; overflow: auto; } -#widgets-chooser { +.widgets-chooser { display: none; } -#widgets-chooser ul { +.widgets-chooser ul { border: 1px solid #ccc; } -#widgets-chooser li { +.widgets-chooser li { padding: 10px 15px 10px 35px; border-bottom: 1px solid #ccc; background: #fff; @@ -10418,12 +10418,12 @@ div#widgets-right .widgets-sortables { transition: background: 0.2s ease-in-out; } -#widgets-chooser li:hover, -#widgets-chooser li:focus { +.widgets-chooser li:hover, +.widgets-chooser li:focus { background: rgba(255,255,255,0.7); } -#widgets-chooser li:focus:before { +.widgets-chooser li:focus:before { content: '\f147'; display: block; -webkit-font-smoothing: antialiased; @@ -10434,17 +10434,17 @@ div#widgets-right .widgets-sortables { left: 5px; } -#widgets-chooser li:last-child { +.widgets-chooser li:last-child { border: none; } -#widgets-chooser li.widgets-chooser-selected { +.widgets-chooser li.widgets-chooser-selected { background: #2ea2cc; color: #fff; } -#widgets-chooser li.widgets-chooser-selected:before, -#widgets-chooser li.widgets-chooser-selected:focus:before { +.widgets-chooser li.widgets-chooser-selected:before, +.widgets-chooser li.widgets-chooser-selected:focus:before { content: '\f147'; display: block; -webkit-font-smoothing: antialiased; @@ -10455,12 +10455,12 @@ div#widgets-right .widgets-sortables { left: 5px; } -#widgets-chooser .widgets-chooser-actions { +.widgets-chooser .widgets-chooser-actions { padding: 10px 0 12px 0; text-align: center; } -#widgets-chooser button { +.widgets-chooser button { margin-right: 5px; } diff --git a/src/wp-admin/js/widgets.js b/src/wp-admin/js/widgets.js index b2384e0703..c07ff8f515 100644 --- a/src/wp-admin/js/widgets.js +++ b/src/wp-admin/js/widgets.js @@ -7,7 +7,7 @@ wpWidgets = { init : function() { var rem, the_id, self = this, - chooser = $('#widgets-chooser'), + chooser = $('.widgets-chooser'), selectSidebar = chooser.find('.widgets-chooser-sidebars'), sidebars = $('div.widgets-sortables'), isRTL = !! ( 'undefined' !== typeof isRtl && isRtl ); @@ -82,9 +82,19 @@ wpWidgets = { helper: 'clone', zIndex: 100, containment: 'document', - start: function(e,ui) { + start: function( event, ui ) { + var chooser = $(this).find('.widgets-chooser'); + ui.helper.find('div.widget-description').hide(); the_id = this.id; + + if ( chooser.length ) { + // Hide the chooser and move it out of the widget + $( '#wpbody-content' ).append( chooser.hide() ); + // Delete the cloned chooser from the drag helper + ui.helper.find('.widgets-chooser').remove(); + self.clearWidgetSelection(); + } }, stop: function() { if ( rem ) { @@ -103,7 +113,12 @@ wpWidgets = { distance: 2, containment: 'document', start: function(e,ui) { - ui.item.children('.widget-inside').hide(); + var inside = ui.item.children('.widget-inside'); + + if ( inside.css('display') === 'block' ) { + inside.hide(); + $(this).sortable('refreshPositions'); + } }, stop: function(e,ui) { if ( ui.item.hasClass('ui-draggable') && ui.item.data('draggable') ) { @@ -203,7 +218,7 @@ wpWidgets = { // Open the chooser self.clearWidgetSelection(); $( '#widgets-left' ).addClass( 'chooser' ); - widget.addClass( 'widget-in-question' ).draggable('disable'); + widget.addClass( 'widget-in-question' ); widget.find( '.widget-description' ).after( chooser ); chooser.slideDown( 300, function() { @@ -386,9 +401,8 @@ wpWidgets = { closeChooser: function() { var self = this; - $( '#widgets-chooser' ).slideUp( 200, function() { + $( '.widgets-chooser' ).slideUp( 200, function() { $( '#wpbody-content' ).append( this ); - $( '#widgets-left .widget-in-question' ).draggable('enable'); self.clearWidgetSelection(); }); }, diff --git a/src/wp-admin/widgets.php b/src/wp-admin/widgets.php index b7e7d488d3..e6c6de7c7e 100644 --- a/src/wp-admin/widgets.php +++ b/src/wp-admin/widgets.php @@ -428,7 +428,7 @@ foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) {
-
+