]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-includes/js/tinymce/plugins/wpdialogs/editor_plugin_src.js
WordPress 3.8.2-scripts
[autoinstalls/wordpress.git] / wp-includes / js / tinymce / plugins / wpdialogs / editor_plugin_src.js
1 /* global tinymce */
2 (function() {
3         tinymce.create('tinymce.plugins.WPDialogs', {
4                 init : function( ed ) {
5                         tinymce.create('tinymce.WPWindowManager:tinymce.InlineWindowManager', {
6                                 WPWindowManager : function(ed) {
7                                         this.parent(ed);
8                                 },
9
10                                 open : function(f, p) {
11                                         var t = this, element;
12
13                                         if ( ! f.wpDialog )
14                                                 return this.parent( f, p );
15                                         else if ( ! f.id )
16                                                 return;
17
18                                         element = jQuery('#' + f.id);
19                                         if ( ! element.length )
20                                                 return;
21
22                                         t.features = f;
23                                         t.params = p;
24                                         t.onOpen.dispatch(t, f, p);
25                                         t.element = t.windows[ f.id ] = element;
26
27                                         // Store selection
28                                         t.bookmark = t.editor.selection.getBookmark(1);
29
30                                         // Create the dialog if necessary
31                                         if ( ! element.data('wpdialog') ) {
32                                                 element.wpdialog({
33                                                         title: f.title,
34                                                         width: f.width,
35                                                         height: f.height,
36                                                         modal: true,
37                                                         dialogClass: 'wp-dialog',
38                                                         zIndex: 300000
39                                                 });
40                                         }
41
42                                         element.wpdialog('open');
43                                 },
44                                 close : function() {
45                                         if ( ! this.features.wpDialog )
46                                                 return this.parent.apply( this, arguments );
47
48                                         this.element.wpdialog('close');
49                                 }
50                         });
51
52                         // Replace window manager
53                         ed.onBeforeRenderUI.add(function() {
54                                 ed.windowManager = new tinymce.WPWindowManager(ed);
55                         });
56                 },
57
58                 getInfo : function() {
59                         return {
60                                 longname : 'WPDialogs',
61                                 author : 'WordPress',
62                                 authorurl : 'http://wordpress.org',
63                                 infourl : 'http://wordpress.org',
64                                 version : '0.1'
65                         };
66                 }
67         });
68
69         // Register plugin
70         tinymce.PluginManager.add('wpdialogs', tinymce.plugins.WPDialogs);
71 })();