Plugin Editor: Disable the documentation look up button when no function is selected.

Props xkon.
Fixes #41143.


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


git-svn-id: http://core.svn.wordpress.org/trunk@44448 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-01-16 06:01:50 +00:00
parent 32ace06a39
commit 63cbfcbded
5 changed files with 15 additions and 4 deletions

View File

@ -53,6 +53,8 @@ wp.themePluginEditor = (function( $ ) {
component.textarea = component.form.find( '#newcontent' );
component.textarea.on( 'change', component.onChange );
component.warning = $( '.file-editor-warning' );
component.docsLookUpButton = component.form.find( '#docs-lookup' );
component.docsLookUpList = component.form.find( '#docs-list' );
if ( component.warning.length > 0 ) {
component.showWarning();
@ -77,6 +79,15 @@ wp.themePluginEditor = (function( $ ) {
}
return undefined;
} );
component.docsLookUpList.on( 'change', function() {
var option = $( this ).val();
if ( '' === option ) {
component.docsLookUpButton.prop( 'disabled', true );
} else {
component.docsLookUpButton.prop( 'disabled', false );
}
} );
};
/**

File diff suppressed because one or more lines are too long

View File

@ -265,7 +265,7 @@ foreach ( $plugins as $plugin_key => $a_plugin ) {
<input type="hidden" name="plugin" value="<?php echo esc_attr( $plugin ); ?>" />
</div>
<?php if ( ! empty( $docs_select ) ) : ?>
<div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e( 'Documentation:' ); ?></label> <?php echo $docs_select; ?> <input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" /></div>
<div id="documentation" class="hide-if-no-js"><label for="docs-list"><?php _e( 'Documentation:' ); ?></label> <?php echo $docs_select; ?> <input disabled id="docs-lookup" type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" /></div>
<?php endif; ?>
<?php if ( is_writeable( $real_file ) ) : ?>
<div class="editor-notices">

View File

@ -285,7 +285,7 @@ else :
<div id="documentation" class="hide-if-no-js">
<label for="docs-list"><?php _e( 'Documentation:' ); ?></label>
<?php echo $docs_select; ?>
<input type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" />
<input disabled id="docs-lookup" type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" />
</div>
<?php endif; ?>

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.1-beta1-44616';
$wp_version = '5.1-beta1-44617';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.