From 5706a463bdc393f54253c279c3c15bff39e9ef47 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Mon, 7 Apr 2014 21:34:18 +0000 Subject: [PATCH] TinyMCE: show an error in the console when a plugin attempts to use the 'wpdialogs' plugin but wpdialog.js is not enqueued, fixes #16284 git-svn-id: https://develop.svn.wordpress.org/trunk@28012 602fd350-edb4-49c9-b593-d223f7449a82 --- .../js/tinymce/plugins/wpdialogs/plugin.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js b/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js index 63a2d2109c..fef6aa079d 100644 --- a/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js +++ b/src/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js @@ -29,13 +29,22 @@ tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) { return; } + if ( typeof jQuery === 'undefined' || ! jQuery.wp || ! jQuery.wp.wpdialog ) { + // wpdialod.js is not loaded + if ( window.console && window.console.error ) { + window.console.error('wpdialog.js is not loaded. Please set it as dependency for your script when calling wp_enqueue_script().'); + } + + return; + } + wp.$element = $element = jQuery( '#' + args.id ); if ( ! $element.length ) { return; } - if ( window && window.console ) { + if ( window.console && window.console.log ) { window.console.log('tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML.'); }