mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-12 15:48:34 +02:00
fixes #26048. Built from https://develop.svn.wordpress.org/trunk@26214 git-svn-id: http://core.svn.wordpress.org/trunk@26122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
72 lines
1.6 KiB
JavaScript
72 lines
1.6 KiB
JavaScript
/* global tinymce */
|
|
(function() {
|
|
tinymce.create('tinymce.plugins.WPDialogs', {
|
|
init : function( ed ) {
|
|
tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', {
|
|
WPWindowManager : function(ed) {
|
|
this.parent(ed);
|
|
},
|
|
|
|
open : function(f, p) {
|
|
var t = this, element;
|
|
|
|
if ( ! f.wpDialog )
|
|
return this.parent( f, p );
|
|
else if ( ! f.id )
|
|
return;
|
|
|
|
element = jQuery('#' + f.id);
|
|
if ( ! element.length )
|
|
return;
|
|
|
|
t.features = f;
|
|
t.params = p;
|
|
t.onOpen.dispatch(t, f, p);
|
|
t.element = t.windows[ f.id ] = element;
|
|
|
|
// Store selection
|
|
t.bookmark = t.editor.selection.getBookmark(1);
|
|
|
|
// Create the dialog if necessary
|
|
if ( ! element.data('wpdialog') ) {
|
|
element.wpdialog({
|
|
title: f.title,
|
|
width: f.width,
|
|
height: f.height,
|
|
modal: true,
|
|
dialogClass: 'wp-dialog',
|
|
zIndex: 300000
|
|
});
|
|
}
|
|
|
|
element.wpdialog('open');
|
|
},
|
|
close : function() {
|
|
if ( ! this.features.wpDialog )
|
|
return this.parent.apply( this, arguments );
|
|
|
|
this.element.wpdialog('close');
|
|
}
|
|
});
|
|
|
|
// Replace window manager
|
|
ed.onBeforeRenderUI.add(function() {
|
|
ed.windowManager = new tinymce.WPWindowManager(ed);
|
|
});
|
|
},
|
|
|
|
getInfo : function() {
|
|
return {
|
|
longname : 'WPDialogs',
|
|
author : 'WordPress',
|
|
authorurl : 'http://wordpress.org',
|
|
infourl : 'http://wordpress.org',
|
|
version : '0.1'
|
|
};
|
|
}
|
|
});
|
|
|
|
// Register plugin
|
|
tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs);
|
|
})();
|