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.

Built from https://develop.svn.wordpress.org/trunk@26651


git-svn-id: http://core.svn.wordpress.org/trunk@26541 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Ozz 2013-12-05 00:02:11 +00:00
parent e59ee5e974
commit b0a9fb217a
2 changed files with 4 additions and 4 deletions

View File

@ -407,14 +407,14 @@ wpWidgets = {
sidebarId = chooser.find( '.widgets-chooser-selected' ).data('sidebarId'), sidebarId = chooser.find( '.widgets-chooser-selected' ).data('sidebarId'),
sidebar = $( '#' + sidebarId ); sidebar = $( '#' + sidebarId );
// Move the chooser out of the widget
$('#wpbody-content').append( chooser );
widget = $('#available-widgets').find('.widget-in-question').clone(); widget = $('#available-widgets').find('.widget-in-question').clone();
widgetId = widget.attr('id'); widgetId = widget.attr('id');
add = widget.find( 'input.add_new' ).val(); add = widget.find( 'input.add_new' ).val();
n = widget.find( 'input.multi_number' ).val(); n = widget.find( 'input.multi_number' ).val();
// Remove the cloned chooser from the widget
widget.find('.widgets-chooser').remove();
if ( 'multi' === add ) { if ( 'multi' === add ) {
widget.html( widget.html(
widget.html().replace( /<[^<>]+>/g, function(m) { widget.html().replace( /<[^<>]+>/g, function(m) {

File diff suppressed because one or more lines are too long