From f90e3dc4504ba5a940fb9f11218ca0415c98848e Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 5 Dec 2013 00:01:42 +0000 Subject: [PATCH] Widgets: on clicking Add, don't move the chooser out of the widget early as that makes is visible at the bottom of the screen. Remove the cloned copy of it instead. Part-props jeremyfelt, fixes #26417. git-svn-id: https://develop.svn.wordpress.org/trunk@26651 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/js/widgets.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/widgets.js b/src/wp-admin/js/widgets.js index f814714a6a..1fcf9301d7 100644 --- a/src/wp-admin/js/widgets.js +++ b/src/wp-admin/js/widgets.js @@ -407,14 +407,14 @@ wpWidgets = { sidebarId = chooser.find( '.widgets-chooser-selected' ).data('sidebarId'), sidebar = $( '#' + sidebarId ); - // Move the chooser out of the widget - $('#wpbody-content').append( chooser ); - widget = $('#available-widgets').find('.widget-in-question').clone(); widgetId = widget.attr('id'); add = widget.find( 'input.add_new' ).val(); n = widget.find( 'input.multi_number' ).val(); + // Remove the cloned chooser from the widget + widget.find('.widgets-chooser').remove(); + if ( 'multi' === add ) { widget.html( widget.html().replace( /<[^<>]+>/g, function(m) {