From 267c79a5182b3eebdb319874bb5e3ae168a9a6ac Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Wed, 16 Jan 2019 06:00:23 +0000 Subject: [PATCH] Plugin Editor: Disable the documentation look up button when no function is selected. Props xkon. Fixes #41143. git-svn-id: https://develop.svn.wordpress.org/trunk@44617 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/wp/theme-plugin-editor.js | 11 +++++++++++ src/wp-admin/plugin-editor.php | 2 +- src/wp-admin/theme-editor.php | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/js/_enqueues/wp/theme-plugin-editor.js b/src/js/_enqueues/wp/theme-plugin-editor.js index 78a824f12e..6127b2cf7a 100644 --- a/src/js/_enqueues/wp/theme-plugin-editor.js +++ b/src/js/_enqueues/wp/theme-plugin-editor.js @@ -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 ); + } + } ); }; /** diff --git a/src/wp-admin/plugin-editor.php b/src/wp-admin/plugin-editor.php index 7b374bc038..6d93ea8ad1 100644 --- a/src/wp-admin/plugin-editor.php +++ b/src/wp-admin/plugin-editor.php @@ -265,7 +265,7 @@ foreach ( $plugins as $plugin_key => $a_plugin ) { -
+
diff --git a/src/wp-admin/theme-editor.php b/src/wp-admin/theme-editor.php index aaa5feb9e3..8135ddb90a 100644 --- a/src/wp-admin/theme-editor.php +++ b/src/wp-admin/theme-editor.php @@ -285,7 +285,7 @@ else :
- +