TinyMCE: show an error in the console when a plugin attempts to use the 'wpdialogs' plugin but wpdialog.js is not enqueued, fixes #16284
Built from https://develop.svn.wordpress.org/trunk@28012 git-svn-id: http://core.svn.wordpress.org/trunk@27842 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
320b3751a3
commit
df7b16dda1
|
@ -29,13 +29,22 @@ tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) {
|
||||||
return;
|
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 );
|
wp.$element = $element = jQuery( '#' + args.id );
|
||||||
|
|
||||||
if ( ! $element.length ) {
|
if ( ! $element.length ) {
|
||||||
return;
|
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.');
|
window.console.log('tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
tinymce.WPWindowManager=tinymce.InlineWindowManager=function(a){return this.wp?this:(this.wp={},this.parent=a.windowManager,this.editor=a,tinymce.extend(this,this.parent),this.open=function(b,c){var d,e=this,f=this.wp;return b.wpDialog?void(b.id&&(f.$element=d=jQuery("#"+b.id),d.length&&(window&&window.console&&window.console.log("tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML."),f.features=b,f.params=c,a.nodeChanged(),d.data("wpdialog")||d.wpdialog({title:b.title,width:b.width,height:b.height,modal:!0,dialogClass:"wp-dialog",zIndex:3e5}),d.wpdialog("open"),d.on("wpdialogclose",function(){e.wp.$element&&(e.wp={})})))):this.parent.open.apply(this,arguments)},void(this.close=function(){return this.wp.features&&this.wp.features.wpDialog?void this.wp.$element.wpdialog("close"):this.parent.close.apply(this,arguments)}))},tinymce.PluginManager.add("wpdialogs",function(a){a.on("init",function(){a.windowManager=new tinymce.WPWindowManager(a)})});
|
tinymce.WPWindowManager=tinymce.InlineWindowManager=function(a){return this.wp?this:(this.wp={},this.parent=a.windowManager,this.editor=a,tinymce.extend(this,this.parent),this.open=function(b,c){var d,e=this,f=this.wp;if(!b.wpDialog)return this.parent.open.apply(this,arguments);if(b.id){if("undefined"==typeof jQuery||!jQuery.wp||!jQuery.wp.wpdialog)return void(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()."));f.$element=d=jQuery("#"+b.id),d.length&&(window.console&&window.console.log&&window.console.log("tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML."),f.features=b,f.params=c,a.nodeChanged(),d.data("wpdialog")||d.wpdialog({title:b.title,width:b.width,height:b.height,modal:!0,dialogClass:"wp-dialog",zIndex:3e5}),d.wpdialog("open"),d.on("wpdialogclose",function(){e.wp.$element&&(e.wp={})}))}},void(this.close=function(){return this.wp.features&&this.wp.features.wpDialog?void this.wp.$element.wpdialog("close"):this.parent.close.apply(this,arguments)}))},tinymce.PluginManager.add("wpdialogs",function(a){a.on("init",function(){a.windowManager=new tinymce.WPWindowManager(a)})});
|
Binary file not shown.
Loading…
Reference in New Issue