99 |
99 |
100 if (u && this.editor.settings.language) { |
100 if (u && this.editor.settings.language) { |
101 u += '/langs/' + this.editor.settings.language + '_dlg.js'; |
101 u += '/langs/' + this.editor.settings.language + '_dlg.js'; |
102 |
102 |
103 if (!tinymce.ScriptLoader.isDone(u)) { |
103 if (!tinymce.ScriptLoader.isDone(u)) { |
104 document.write('<script type="text/javascript" src="' + u + '"></script>'); |
104 document.write('<script type="text/javascript" src="' + tinymce._addVer(u) + '"></script>'); |
105 tinymce.ScriptLoader.markDone(u); |
105 tinymce.ScriptLoader.markDone(u); |
106 } |
106 } |
107 } |
107 } |
108 }, |
108 }, |
109 |
109 |
130 close : function() { |
130 close : function() { |
131 var t = this; |
131 var t = this; |
132 |
132 |
133 // To avoid domain relaxing issue in Opera |
133 // To avoid domain relaxing issue in Opera |
134 function close() { |
134 function close() { |
135 t.editor.windowManager.close(window, t.id); |
135 t.editor.windowManager.close(window); |
136 tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup |
136 tinymce = tinyMCE = t.editor = t.params = t.dom = t.dom.doc = null; // Cleanup |
137 }; |
137 }; |
138 |
138 |
139 if (tinymce.isOpera) |
139 if (tinymce.isOpera) |
140 t.getWin().setTimeout(close, 0); |
140 t.getWin().setTimeout(close, 0); |
167 |
167 |
168 // Replace a=x with a="x" in IE |
168 // Replace a=x with a="x" in IE |
169 if (tinymce.isIE) |
169 if (tinymce.isIE) |
170 h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') |
170 h = h.replace(/ (value|title|alt)=([^"][^\s>]+)/gi, ' $1="$2"') |
171 |
171 |
|
172 document.dir = t.editor.getParam('directionality',''); |
172 document.body.innerHTML = t.editor.translate(h); |
173 document.body.innerHTML = t.editor.translate(h); |
173 document.title = ti = t.editor.translate(ti); |
174 document.title = ti = t.editor.translate(ti); |
174 document.body.style.display = ''; |
175 document.body.style.display = ''; |
175 |
176 |
176 // Restore selection in IE when focus is placed on a non textarea or input element of the type text |
177 // Restore selection in IE when focus is placed on a non textarea or input element of the type text |
177 if (tinymce.isIE) |
178 if (tinymce.isIE) |
178 document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection); |
179 document.attachEvent('onmouseup', tinyMCEPopup._restoreSelection); |
179 |
180 |
180 t.restoreSelection(); |
181 t.restoreSelection(); |
181 |
|
182 // Call onInit |
|
183 tinymce.each(t.listeners, function(o) { |
|
184 o.func.call(o.scope, t.editor); |
|
185 }); |
|
186 |
|
187 t.resizeToInnerSize(); |
182 t.resizeToInnerSize(); |
188 |
183 |
189 if (t.isWindow) |
184 // Set inline title |
|
185 if (!t.isWindow) |
|
186 t.editor.windowManager.setTitle(window, ti); |
|
187 else |
190 window.focus(); |
188 window.focus(); |
191 else |
|
192 t.editor.windowManager.setTitle(ti, t.id); |
|
193 |
189 |
194 if (!tinymce.isIE && !t.isWindow) { |
190 if (!tinymce.isIE && !t.isWindow) { |
195 tinymce.dom.Event._add(document, 'focus', function() { |
191 tinymce.dom.Event._add(document, 'focus', function() { |
196 t.editor.windowManager.focus(t.id) |
192 t.editor.windowManager.focus(t.id) |
197 }); |
193 }); |
200 // Patch for accessibility |
196 // Patch for accessibility |
201 tinymce.each(t.dom.select('select'), function(e) { |
197 tinymce.each(t.dom.select('select'), function(e) { |
202 e.onkeydown = tinyMCEPopup._accessHandler; |
198 e.onkeydown = tinyMCEPopup._accessHandler; |
203 }); |
199 }); |
204 |
200 |
|
201 // Call onInit |
|
202 // Init must be called before focus so the selection won't get lost by the focus call |
|
203 tinymce.each(t.listeners, function(o) { |
|
204 o.func.call(o.scope, t.editor); |
|
205 }); |
|
206 |
205 // Move focus to window |
207 // Move focus to window |
206 window.focus(); |
208 if (t.getWindowArg('mce_auto_focus', true)) { |
|
209 window.focus(); |
|
210 |
|
211 // Focus element with mceFocus class |
|
212 tinymce.each(document.forms, function(f) { |
|
213 tinymce.each(f.elements, function(e) { |
|
214 if (t.dom.hasClass(e, 'mceFocus') && !e.disabled) { |
|
215 e.focus(); |
|
216 return false; // Break loop |
|
217 } |
|
218 }); |
|
219 }); |
|
220 } |
|
221 |
|
222 document.onkeyup = tinyMCEPopup._closeWinKeyHandler; |
207 }, |
223 }, |
208 |
224 |
209 _accessHandler : function(e) { |
225 _accessHandler : function(e) { |
210 var e = e || window.event; |
226 e = e || window.event; |
211 |
227 |
212 if (e.keyCode == 13 || e.keyCode == 32) { |
228 if (e.keyCode == 13 || e.keyCode == 32) { |
213 e = e.target || e.srcElement; |
229 e = e.target || e.srcElement; |
214 |
230 |
215 if (e.onchange) |
231 if (e.onchange) |
216 e.onchange(); |
232 e.onchange(); |
217 |
233 |
218 return tinymce.dom.Event.cancel(e); |
234 return tinymce.dom.Event.cancel(e); |
219 } |
235 } |
|
236 }, |
|
237 |
|
238 _closeWinKeyHandler : function(e) { |
|
239 e = e || window.event; |
|
240 |
|
241 if (e.keyCode == 27) |
|
242 tinyMCEPopup.close(); |
220 }, |
243 }, |
221 |
244 |
222 _wait : function() { |
245 _wait : function() { |
223 var t = this, ti; |
246 var t = this, ti; |
224 |
247 |