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
This commit is contained in:
parent
b7999f453a
commit
3373b5ff0f
|
@ -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
|
||||
|
|
|
@ -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)})});
|
||||
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)})});
|
|
@ -57,7 +57,7 @@ tinymce.PluginManager.add( 'wpeditimage', function( editor ) {
|
|||
out = b.match( /<dd [^>]+>([\s\S]+?)<\/dd>/i );
|
||||
|
||||
if ( out && out[1] ) {
|
||||
return '<p>' + out[1] + '</p>'
|
||||
return '<p>' + out[1] + '</p>';
|
||||
}
|
||||
|
||||
return '';
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue