Skip to content

Commit

Permalink
Fix: Close plugin modal when plugin is updated (ClassicPress#1361)
Browse files Browse the repository at this point in the history
* Update updates.js to replace `window.tb_remove()` function

* Update plugins.php to remove call to thickbox

* Update plugin-install.php to remove call to thickbox

* Update script-loader.php to remove thickbox.js from media uploads
  • Loading branch information
KTS915 authored Mar 23, 2024
1 parent e8452cc commit 13b1c46
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/wp-admin/js/updates.js
Original file line number Diff line number Diff line change
Expand Up @@ -2824,9 +2824,9 @@

case 'install-plugin':
case 'update-plugin':
/* jscs:disable requireCamelCaseOrUpperCaseIdentifiers */
window.tb_remove();
/* jscs:enable */
document.querySelector( '.plugin-details-modal' ).close();
document.querySelector( 'iframe' ).remove();
document.getElementById( 'dialog-close-button' ).remove();

message.data = wp.updates._addCallbacks( message.data, message.action );

Expand Down
3 changes: 0 additions & 3 deletions src/wp-admin/plugin-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@
$parent_file = 'plugins.php';

wp_enqueue_script( 'plugin-install' );
if ( 'plugin-information' !== $tab ) {
add_thickbox();
}

$body_id = $tab;

Expand Down
1 change: 0 additions & 1 deletion src/wp-admin/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,6 @@
$wp_list_table->prepare_items();

wp_enqueue_script( 'plugin-install' );
add_thickbox();

add_screen_option( 'per_page', array( 'default' => 999 ) );

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,7 @@ function wp_default_scripts( $scripts ) {

$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 );

$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'shortcode' ), false, 1 );

$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array( 'jquery' ), '1.10.2', 1 );

Expand Down

0 comments on commit 13b1c46

Please sign in to comment.