Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.templateEditor.js |
— | — | @@ -319,6 +319,7 @@ |
320 | 320 | $(this).text( mediaWiki.msg( $(this).attr( 'rel' ) ) ); |
321 | 321 | } ); |
322 | 322 | }, |
| 323 | + immediateCreate: true, |
323 | 324 | dialog: { |
324 | 325 | width: 600, |
325 | 326 | height: 400, |
Index: trunk/extensions/WikiEditor/modules/jquery.wikiEditor.dialogs.js |
— | — | @@ -42,7 +42,7 @@ |
43 | 43 | var mod = $.wikiEditor.modules.dialogs.modules[module]; |
44 | 44 | var $dialog = $( '#' + mod.id ); |
45 | 45 | if ( $dialog.length == 0 ) { |
46 | | - $.wikiEditor.modules.dialogs.fn.reallyCreate( context, mod ); |
| 46 | + $.wikiEditor.modules.dialogs.fn.reallyCreate( context, mod, module ); |
47 | 47 | $dialog = $( '#' + mod.id ); |
48 | 48 | } |
49 | 49 | |
— | — | @@ -72,7 +72,7 @@ |
73 | 73 | */ |
74 | 74 | create: function( context, config ) { |
75 | 75 | // Defer building of modules, but do check whether they need the iframe rightaway |
76 | | - for ( mod in config ) { |
| 76 | + for ( var mod in config ) { |
77 | 77 | var module = config[mod]; |
78 | 78 | // Only create the dialog if it's supported, isn't filtered and doesn't exist yet |
79 | 79 | var filtered = false; |
— | — | @@ -91,6 +91,10 @@ |
92 | 92 | context.fn.setupIframe(); |
93 | 93 | } |
94 | 94 | context.$textarea.trigger( 'wikiEditor-dialogs-setup-' + mod ); |
| 95 | + // If this dialog requires immediate creation, create it now |
| 96 | + if ( typeof module.immediateCreate !== 'undefined' && module.immediateCreate ) { |
| 97 | + $.wikiEditor.modules.dialogs.fn.reallyCreate( context, module, mod ); |
| 98 | + } |
95 | 99 | } |
96 | 100 | } |
97 | 101 | }, |
— | — | @@ -98,8 +102,9 @@ |
99 | 103 | * Build the actual dialog. This done on-demand rather than in create() |
100 | 104 | * @param {Object} context Context object of editor dialog belongs to |
101 | 105 | * @param {Object} module Dialog module object |
| 106 | + * @param {String} name Dialog name (key in $.wikiEditor.modules.dialogs.modules) |
102 | 107 | */ |
103 | | - reallyCreate: function( context, module ) { |
| 108 | + reallyCreate: function( context, module, name ) { |
104 | 109 | var configuration = module.dialog; |
105 | 110 | // Add some stuff to configuration |
106 | 111 | configuration.bgiframe = true; |
— | — | @@ -110,7 +115,7 @@ |
111 | 116 | // Stupid JS won't let us do stuff like |
112 | 117 | // foo = { mediaWiki.msg( 'bar' ): baz } |
113 | 118 | configuration.newButtons = {}; |
114 | | - for ( msg in configuration.buttons ) |
| 119 | + for ( var msg in configuration.buttons ) |
115 | 120 | configuration.newButtons[mediaWiki.msg( msg )] = configuration.buttons[msg]; |
116 | 121 | configuration.buttons = configuration.newButtons; |
117 | 122 | // Create the dialog <div> |
— | — | @@ -137,7 +142,7 @@ |
138 | 143 | } ); |
139 | 144 | |
140 | 145 | // Let the outside world know we set up this dialog |
141 | | - context.$textarea.trigger( 'wikiEditor-dialogs-loaded-' + mod ); |
| 146 | + context.$textarea.trigger( 'wikiEditor-dialogs-loaded-' + name ); |
142 | 147 | }, |
143 | 148 | /** |
144 | 149 | * Resize a dialog so its contents fit |