From 3373b5ff0f2f69e3e3d8f00ec70f1f0f2e8482fb Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Sat, 4 Jan 2014 01:28:13 +0000 Subject: [PATCH] TinyMCE: 'wpdialogs' plugin, don't add the (external) UI dialogs element to the internal windows array, fix .close(). See #24067. Built from https://develop.svn.wordpress.org/trunk@26900 git-svn-id: http://core.svn.wordpress.org/trunk@26783 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../js/tinymce/plugins/wpdialogs/plugin.js | 31 +++++++++--------- .../tinymce/plugins/wpdialogs/plugin.min.js | 2 +- .../js/tinymce/plugins/wpeditimage/plugin.js | 2 +- wp-includes/js/tinymce/wp-tinymce.js.gz | Bin 118686 -> 118683 bytes 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js b/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js index 7e18713c23..63a2d2109c 100644 --- a/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js +++ b/wp-includes/js/tinymce/plugins/wpdialogs/plugin.js @@ -8,22 +8,28 @@ * For examples see the default plugins: https://github.com/tinymce/tinymce/tree/master/js/tinymce/plugins */ tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) { + if ( this.wp ) { + return this; + } + this.wp = {}; this.parent = editor.windowManager; this.editor = editor; tinymce.extend( this, this.parent ); this.open = function( args, params ) { - var self = this, $element; + var $element, + self = this, + wp = this.wp; if ( ! args.wpDialog ) { - return this.parent.open( args, params ); + return this.parent.open.apply( this, arguments ); } else if ( ! args.id ) { return; } - self.element = $element = jQuery( '#' + args.id ); + wp.$element = $element = jQuery( '#' + args.id ); if ( ! $element.length ) { return; @@ -33,9 +39,8 @@ tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) { window.console.log('tinymce.WPWindowManager is deprecated. Use the default editor.windowManager to open dialogs with inline HTML.'); } - self.features = args; - self.params = params; - self.windows.push( $element ); + wp.features = args; + wp.params = params; // Store selection. Takes a snapshot in the FocusManager of the selection before focus is moved to the dialog. editor.nodeChanged(); @@ -55,24 +60,20 @@ tinymce.WPWindowManager = tinymce.InlineWindowManager = function( editor ) { $element.wpdialog('open'); $element.on( 'wpdialogclose', function() { - var i = self.windows.length; - - while ( i-- && i > -1 ) { - if ( self.windows[i] === self.element ) { - self.windows.splice( i, 1 ); - } + if ( self.wp.$element ) { + self.wp = {}; } }); }; this.close = function() { - if ( ! this.features.wpDialog ) { + if ( ! this.wp.features || ! this.wp.features.wpDialog ) { return this.parent.close.apply( this, arguments ); } - this.element.wpdialog('close'); + this.wp.$element.wpdialog('close'); }; -} +}; tinymce.PluginManager.add( 'wpdialogs', function( editor ) { // Replace window manager diff --git a/wp-includes/js/tinymce/plugins/wpdialogs/plugin.min.js b/wp-includes/js/tinymce/plugins/wpdialogs/plugin.min.js index cc6592ef0f..98eb0df9e0 100644 --- a/wp-includes/js/tinymce/plugins/wpdialogs/plugin.min.js +++ b/wp-includes/js/tinymce/plugins/wpdialogs/plugin.min.js @@ -1 +1 @@ -tinymce.WPWindowManager=tinymce.InlineWindowManager=function(a){this.parent=a.windowManager,this.editor=a,tinymce.extend(this,this.parent),this.open=function(b,c){var d,e=this;return b.wpDialog?(b.id&&(e.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."),e.features=b,e.params=c,e.windows.push(d),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(){for(var a=e.windows.length;a--&&a>-1;)e.windows[a]===e.element&&e.windows.splice(a,1)}))),void 0):this.parent.open(b,c)},this.close=function(){return this.features.wpDialog?(this.element.wpdialog("close"),void 0):this.parent.close.apply(this,arguments)}},tinymce.PluginManager.add("wpdialogs",function(a){a.on("init",function(){a.windowManager=new tinymce.WPWindowManager(a)})}); \ No newline at end of file +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?(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={})}))),void 0):this.parent.open.apply(this,arguments)},this.close=function(){return this.wp.features&&this.wp.features.wpDialog?(this.wp.$element.wpdialog("close"),void 0):this.parent.close.apply(this,arguments)},void 0)},tinymce.PluginManager.add("wpdialogs",function(a){a.on("init",function(){a.windowManager=new tinymce.WPWindowManager(a)})}); \ No newline at end of file diff --git a/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js b/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js index b3eae05d48..577a5cec90 100644 --- a/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js +++ b/wp-includes/js/tinymce/plugins/wpeditimage/plugin.js @@ -57,7 +57,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) { out = b.match( /
]+>([\s\S]+?)<\/dd>/i ); if ( out && out[1] ) { - return '

' + out[1] + '

' + return '

' + out[1] + '

'; } return ''; diff --git a/wp-includes/js/tinymce/wp-tinymce.js.gz b/wp-includes/js/tinymce/wp-tinymce.js.gz index 535501311a5feb1c9bf29290771fb131f39e03ec..b83345dcb0322aa727cd4e497283838df230e806 100644 GIT binary patch delta 3697 zcmV-%4vz7jp9h(#C)MXR)!p>=3?w`N#R;7tV`AFlcHwW+iVvJCl$CDU0#3n3UPbVITnc!sMZwEK*^Tk^TV63_z3?}}T~7#Vm6$<1 zJglZz>qfuQEwef%eW-67zu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