|
1 /** |
|
2 * $Id: editor_plugin_src.js 898 2008-07-12 15:01:39Z spocke $ |
|
3 * |
|
4 * @author Moxiecode |
|
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. |
|
6 */ |
|
7 |
|
8 (function() { |
|
9 var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is; |
|
10 |
|
11 tinymce.create('tinymce.plugins.InlinePopups', { |
|
12 init : function(ed, url) { |
|
13 // Replace window manager |
|
14 ed.onBeforeRenderUI.add(function() { |
|
15 ed.windowManager = new tinymce.InlineWindowManager(ed); |
|
16 DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css"); |
|
17 }); |
|
18 }, |
|
19 |
|
20 getInfo : function() { |
|
21 return { |
|
22 longname : 'InlinePopups', |
|
23 author : 'Moxiecode Systems AB', |
|
24 authorurl : 'http://tinymce.moxiecode.com', |
|
25 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups', |
|
26 version : tinymce.majorVersion + "." + tinymce.minorVersion |
|
27 }; |
|
28 } |
|
29 }); |
|
30 |
|
31 tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', { |
|
32 InlineWindowManager : function(ed) { |
|
33 var t = this; |
|
34 |
|
35 t.parent(ed); |
|
36 t.zIndex = 300000; |
|
37 t.count = 0; |
|
38 }, |
|
39 |
|
40 open : function(f, p) { |
|
41 var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u; |
|
42 |
|
43 f = f || {}; |
|
44 p = p || {}; |
|
45 |
|
46 // Run native windows |
|
47 if (!f.inline) |
|
48 return t.parent(f, p); |
|
49 |
|
50 // Only store selection if the type is a normal window |
|
51 if (!f.type) |
|
52 t.bookmark = ed.selection.getBookmark('simple'); |
|
53 |
|
54 id = DOM.uniqueId(); |
|
55 vp = DOM.getViewPort(); |
|
56 f.width = parseInt(f.width || 320); |
|
57 f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0); |
|
58 f.min_width = parseInt(f.min_width || 150); |
|
59 f.min_height = parseInt(f.min_height || 100); |
|
60 f.max_width = parseInt(f.max_width || 2000); |
|
61 f.max_height = parseInt(f.max_height || 2000); |
|
62 f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0))); |
|
63 f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0))); |
|
64 f.movable = f.resizable = true; |
|
65 p.mce_width = f.width; |
|
66 p.mce_height = f.height; |
|
67 p.mce_inline = true; |
|
68 p.mce_window_id = id; |
|
69 p.mce_auto_focus = f.auto_focus; |
|
70 |
|
71 // Transpose |
|
72 // po = DOM.getPos(ed.getContainer()); |
|
73 // f.left -= po.x; |
|
74 // f.top -= po.y; |
|
75 |
|
76 t.features = f; |
|
77 t.params = p; |
|
78 t.onOpen.dispatch(t, f, p); |
|
79 |
|
80 if (f.type) { |
|
81 opt += ' mceModal'; |
|
82 |
|
83 if (f.type) |
|
84 opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1); |
|
85 |
|
86 f.resizable = false; |
|
87 } |
|
88 |
|
89 if (f.statusbar) |
|
90 opt += ' mceStatusbar'; |
|
91 |
|
92 if (f.resizable) |
|
93 opt += ' mceResizable'; |
|
94 |
|
95 if (f.minimizable) |
|
96 opt += ' mceMinimizable'; |
|
97 |
|
98 if (f.maximizable) |
|
99 opt += ' mceMaximizable'; |
|
100 |
|
101 if (f.movable) |
|
102 opt += ' mceMovable'; |
|
103 |
|
104 // Create DOM objects |
|
105 t._addAll(DOM.doc.body, |
|
106 ['div', {id : id, 'class' : ed.settings.inlinepopups_skin || 'clearlooks2', style : 'width:100px;height:100px'}, |
|
107 ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt}, |
|
108 ['div', {id : id + '_top', 'class' : 'mceTop'}, |
|
109 ['div', {'class' : 'mceLeft'}], |
|
110 ['div', {'class' : 'mceCenter'}], |
|
111 ['div', {'class' : 'mceRight'}], |
|
112 ['span', {id : id + '_title'}, f.title || ''] |
|
113 ], |
|
114 |
|
115 ['div', {id : id + '_middle', 'class' : 'mceMiddle'}, |
|
116 ['div', {id : id + '_left', 'class' : 'mceLeft'}], |
|
117 ['span', {id : id + '_content'}], |
|
118 ['div', {id : id + '_right', 'class' : 'mceRight'}] |
|
119 ], |
|
120 |
|
121 ['div', {id : id + '_bottom', 'class' : 'mceBottom'}, |
|
122 ['div', {'class' : 'mceLeft'}], |
|
123 ['div', {'class' : 'mceCenter'}], |
|
124 ['div', {'class' : 'mceRight'}], |
|
125 ['span', {id : id + '_status'}, 'Content'] |
|
126 ], |
|
127 |
|
128 ['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}], |
|
129 ['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}], |
|
130 ['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}], |
|
131 ['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}], |
|
132 ['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}], |
|
133 ['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}], |
|
134 ['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}], |
|
135 ['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}], |
|
136 ['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}], |
|
137 ['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}], |
|
138 ['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}], |
|
139 ['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}], |
|
140 ['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}] |
|
141 ] |
|
142 ] |
|
143 ); |
|
144 |
|
145 DOM.setStyles(id, {top : -10000, left : -10000}); |
|
146 |
|
147 // Fix gecko rendering bug, where the editors iframe messed with window contents |
|
148 if (tinymce.isGecko) |
|
149 DOM.setStyle(id, 'overflow', 'auto'); |
|
150 |
|
151 // Measure borders |
|
152 if (!f.type) { |
|
153 dw += DOM.get(id + '_left').clientWidth; |
|
154 dw += DOM.get(id + '_right').clientWidth; |
|
155 dh += DOM.get(id + '_top').clientHeight; |
|
156 dh += DOM.get(id + '_bottom').clientHeight; |
|
157 } |
|
158 |
|
159 // Resize window |
|
160 DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh}); |
|
161 |
|
162 u = f.url || f.file; |
|
163 if (u) { |
|
164 if (tinymce.relaxedDomain) |
|
165 u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain; |
|
166 |
|
167 u = tinymce._addVer(u); |
|
168 } |
|
169 |
|
170 if (!f.type) { |
|
171 DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'}); |
|
172 DOM.setStyles(id + '_ifr', {width : f.width, height : f.height}); |
|
173 DOM.setAttrib(id + '_ifr', 'src', u); |
|
174 } else { |
|
175 DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok'); |
|
176 |
|
177 if (f.type == 'confirm') |
|
178 DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel'); |
|
179 |
|
180 DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'}); |
|
181 DOM.setHTML(id + '_content', f.content.replace('\n', '<br />')); |
|
182 } |
|
183 |
|
184 // Register events |
|
185 mdf = Event.add(id, 'mousedown', function(e) { |
|
186 var n = e.target, w, vp; |
|
187 |
|
188 w = t.windows[id]; |
|
189 t.focus(id); |
|
190 |
|
191 if (n.nodeName == 'A' || n.nodeName == 'a') { |
|
192 if (n.className == 'mceMax') { |
|
193 w.oldPos = w.element.getXY(); |
|
194 w.oldSize = w.element.getSize(); |
|
195 |
|
196 vp = DOM.getViewPort(); |
|
197 |
|
198 // Reduce viewport size to avoid scrollbars |
|
199 vp.w -= 2; |
|
200 vp.h -= 2; |
|
201 |
|
202 w.element.moveTo(vp.x, vp.y); |
|
203 w.element.resizeTo(vp.w, vp.h); |
|
204 DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight}); |
|
205 DOM.addClass(id + '_wrapper', 'mceMaximized'); |
|
206 } else if (n.className == 'mceMed') { |
|
207 // Reset to old size |
|
208 w.element.moveTo(w.oldPos.x, w.oldPos.y); |
|
209 w.element.resizeTo(w.oldSize.w, w.oldSize.h); |
|
210 w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight); |
|
211 |
|
212 DOM.removeClass(id + '_wrapper', 'mceMaximized'); |
|
213 } else if (n.className == 'mceMove') |
|
214 return t._startDrag(id, e, n.className); |
|
215 else if (DOM.hasClass(n, 'mceResize')) |
|
216 return t._startDrag(id, e, n.className.substring(13)); |
|
217 } |
|
218 }); |
|
219 |
|
220 clf = Event.add(id, 'click', function(e) { |
|
221 var n = e.target; |
|
222 |
|
223 t.focus(id); |
|
224 |
|
225 if (n.nodeName == 'A' || n.nodeName == 'a') { |
|
226 switch (n.className) { |
|
227 case 'mceClose': |
|
228 t.close(null, id); |
|
229 return Event.cancel(e); |
|
230 |
|
231 case 'mceButton mceOk': |
|
232 case 'mceButton mceCancel': |
|
233 f.button_func(n.className == 'mceButton mceOk'); |
|
234 return Event.cancel(e); |
|
235 } |
|
236 } |
|
237 }); |
|
238 |
|
239 // Add window |
|
240 t.windows = t.windows || {}; |
|
241 w = t.windows[id] = { |
|
242 id : id, |
|
243 mousedown_func : mdf, |
|
244 click_func : clf, |
|
245 element : new Element(id, {blocker : 1, container : ed.getContainer()}), |
|
246 iframeElement : new Element(id + '_ifr'), |
|
247 features : f, |
|
248 deltaWidth : dw, |
|
249 deltaHeight : dh |
|
250 }; |
|
251 |
|
252 w.iframeElement.on('focus', function() { |
|
253 t.focus(id); |
|
254 }); |
|
255 |
|
256 // Setup blocker |
|
257 if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') { |
|
258 DOM.add(DOM.doc.body, 'div', { |
|
259 id : 'mceModalBlocker', |
|
260 'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker', |
|
261 style : {left : vp.x, top : vp.y, zIndex : t.zIndex - 1} |
|
262 }); |
|
263 |
|
264 DOM.show('mceModalBlocker'); // Reduces flicker in IE |
|
265 } else |
|
266 DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1); |
|
267 |
|
268 if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel)) |
|
269 DOM.setStyles('mceModalBlocker', {position : 'absolute', width : vp.w - 2, height : vp.h - 2}); |
|
270 |
|
271 t.focus(id); |
|
272 t._fixIELayout(id, 1); |
|
273 |
|
274 // Focus ok button |
|
275 if (DOM.get(id + '_ok')) |
|
276 DOM.get(id + '_ok').focus(); |
|
277 |
|
278 t.count++; |
|
279 |
|
280 return w; |
|
281 }, |
|
282 |
|
283 focus : function(id) { |
|
284 var t = this, w = t.windows[id]; |
|
285 |
|
286 w.zIndex = this.zIndex++; |
|
287 w.element.setStyle('zIndex', w.zIndex); |
|
288 w.element.update(); |
|
289 |
|
290 id = id + '_wrapper'; |
|
291 DOM.removeClass(t.lastId, 'mceFocus'); |
|
292 DOM.addClass(id, 'mceFocus'); |
|
293 t.lastId = id; |
|
294 }, |
|
295 |
|
296 _addAll : function(te, ne) { |
|
297 var i, n, t = this, dom = tinymce.DOM; |
|
298 |
|
299 if (is(ne, 'string')) |
|
300 te.appendChild(dom.doc.createTextNode(ne)); |
|
301 else if (ne.length) { |
|
302 te = te.appendChild(dom.create(ne[0], ne[1])); |
|
303 |
|
304 for (i=2; i<ne.length; i++) |
|
305 t._addAll(te, ne[i]); |
|
306 } |
|
307 }, |
|
308 |
|
309 _startDrag : function(id, se, ac) { |
|
310 var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh; |
|
311 |
|
312 // Get positons and sizes |
|
313 // cp = DOM.getPos(t.editor.getContainer()); |
|
314 cp = {x : 0, y : 0}; |
|
315 vp = DOM.getViewPort(); |
|
316 |
|
317 // Reduce viewport size to avoid scrollbars while dragging |
|
318 vp.w -= 2; |
|
319 vp.h -= 2; |
|
320 |
|
321 sex = se.screenX; |
|
322 sey = se.screenY; |
|
323 dx = dy = dw = dh = 0; |
|
324 |
|
325 // Handle mouse up |
|
326 mu = Event.add(d, 'mouseup', function(e) { |
|
327 Event.remove(d, 'mouseup', mu); |
|
328 Event.remove(d, 'mousemove', mm); |
|
329 |
|
330 if (eb) |
|
331 eb.remove(); |
|
332 |
|
333 we.moveBy(dx, dy); |
|
334 we.resizeBy(dw, dh); |
|
335 sz = we.getSize(); |
|
336 DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight}); |
|
337 t._fixIELayout(id, 1); |
|
338 |
|
339 return Event.cancel(e); |
|
340 }); |
|
341 |
|
342 if (ac != 'Move') |
|
343 startMove(); |
|
344 |
|
345 function startMove() { |
|
346 if (eb) |
|
347 return; |
|
348 |
|
349 t._fixIELayout(id, 0); |
|
350 |
|
351 // Setup event blocker |
|
352 DOM.add(d.body, 'div', { |
|
353 id : 'mceEventBlocker', |
|
354 'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'), |
|
355 style : {left : vp.x, top : vp.y, zIndex : t.zIndex + 1} |
|
356 }); |
|
357 |
|
358 if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel)) |
|
359 DOM.setStyles('mceEventBlocker', {position : 'absolute', width : vp.w - 2, height : vp.h - 2}); |
|
360 |
|
361 eb = new Element('mceEventBlocker'); |
|
362 eb.update(); |
|
363 |
|
364 // Setup placeholder |
|
365 p = we.getXY(); |
|
366 sz = we.getSize(); |
|
367 sx = cp.x + p.x - vp.x; |
|
368 sy = cp.y + p.y - vp.y; |
|
369 DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}}); |
|
370 ph = new Element('mcePlaceHolder'); |
|
371 }; |
|
372 |
|
373 // Handle mouse move/drag |
|
374 mm = Event.add(d, 'mousemove', function(e) { |
|
375 var x, y, v; |
|
376 |
|
377 startMove(); |
|
378 |
|
379 x = e.screenX - sex; |
|
380 y = e.screenY - sey; |
|
381 |
|
382 switch (ac) { |
|
383 case 'ResizeW': |
|
384 dx = x; |
|
385 dw = 0 - x; |
|
386 break; |
|
387 |
|
388 case 'ResizeE': |
|
389 dw = x; |
|
390 break; |
|
391 |
|
392 case 'ResizeN': |
|
393 case 'ResizeNW': |
|
394 case 'ResizeNE': |
|
395 if (ac == "ResizeNW") { |
|
396 dx = x; |
|
397 dw = 0 - x; |
|
398 } else if (ac == "ResizeNE") |
|
399 dw = x; |
|
400 |
|
401 dy = y; |
|
402 dh = 0 - y; |
|
403 break; |
|
404 |
|
405 case 'ResizeS': |
|
406 case 'ResizeSW': |
|
407 case 'ResizeSE': |
|
408 if (ac == "ResizeSW") { |
|
409 dx = x; |
|
410 dw = 0 - x; |
|
411 } else if (ac == "ResizeSE") |
|
412 dw = x; |
|
413 |
|
414 dh = y; |
|
415 break; |
|
416 |
|
417 case 'mceMove': |
|
418 dx = x; |
|
419 dy = y; |
|
420 break; |
|
421 } |
|
422 |
|
423 // Boundary check |
|
424 if (dw < (v = w.features.min_width - sz.w)) { |
|
425 if (dx !== 0) |
|
426 dx += dw - v; |
|
427 |
|
428 dw = v; |
|
429 } |
|
430 |
|
431 if (dh < (v = w.features.min_height - sz.h)) { |
|
432 if (dy !== 0) |
|
433 dy += dh - v; |
|
434 |
|
435 dh = v; |
|
436 } |
|
437 |
|
438 dw = Math.min(dw, w.features.max_width - sz.w); |
|
439 dh = Math.min(dh, w.features.max_height - sz.h); |
|
440 dx = Math.max(dx, vp.x - (sx + vp.x)); |
|
441 dy = Math.max(dy, vp.y - (sy + vp.y)); |
|
442 dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x)); |
|
443 dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y)); |
|
444 |
|
445 // Move if needed |
|
446 if (dx + dy !== 0) { |
|
447 if (sx + dx < 0) |
|
448 dx = 0; |
|
449 |
|
450 if (sy + dy < 0) |
|
451 dy = 0; |
|
452 |
|
453 ph.moveTo(sx + dx, sy + dy); |
|
454 } |
|
455 |
|
456 // Resize if needed |
|
457 if (dw + dh !== 0) |
|
458 ph.resizeTo(sz.w + dw, sz.h + dh); |
|
459 |
|
460 return Event.cancel(e); |
|
461 }); |
|
462 |
|
463 return Event.cancel(se); |
|
464 }, |
|
465 |
|
466 resizeBy : function(dw, dh, id) { |
|
467 var w = this.windows[id]; |
|
468 |
|
469 if (w) { |
|
470 w.element.resizeBy(dw, dh); |
|
471 w.iframeElement.resizeBy(dw, dh); |
|
472 } |
|
473 }, |
|
474 |
|
475 close : function(win, id) { |
|
476 var t = this, w, d = DOM.doc, ix = 0, fw, id; |
|
477 |
|
478 id = t._findId(id || win); |
|
479 |
|
480 t.count--; |
|
481 |
|
482 if (t.count == 0) |
|
483 DOM.remove('mceModalBlocker'); |
|
484 |
|
485 // Probably not inline |
|
486 if (!id && win) { |
|
487 t.parent(win); |
|
488 return; |
|
489 } |
|
490 |
|
491 if (w = t.windows[id]) { |
|
492 t.onClose.dispatch(t); |
|
493 Event.remove(d, 'mousedown', w.mousedownFunc); |
|
494 Event.remove(d, 'click', w.clickFunc); |
|
495 Event.clear(id); |
|
496 Event.clear(id + '_ifr'); |
|
497 |
|
498 DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak |
|
499 w.element.remove(); |
|
500 delete t.windows[id]; |
|
501 |
|
502 // Find front most window and focus that |
|
503 each (t.windows, function(w) { |
|
504 if (w.zIndex > ix) { |
|
505 fw = w; |
|
506 ix = w.zIndex; |
|
507 } |
|
508 }); |
|
509 |
|
510 if (fw) |
|
511 t.focus(fw.id); |
|
512 } |
|
513 }, |
|
514 |
|
515 setTitle : function(w, ti) { |
|
516 var e; |
|
517 |
|
518 w = this._findId(w); |
|
519 |
|
520 if (e = DOM.get(w + '_title')) |
|
521 e.innerHTML = DOM.encode(ti); |
|
522 }, |
|
523 |
|
524 alert : function(txt, cb, s) { |
|
525 var t = this, w; |
|
526 |
|
527 w = t.open({ |
|
528 title : t, |
|
529 type : 'alert', |
|
530 button_func : function(s) { |
|
531 if (cb) |
|
532 cb.call(s || t, s); |
|
533 |
|
534 t.close(null, w.id); |
|
535 }, |
|
536 content : DOM.encode(t.editor.getLang(txt, txt)), |
|
537 inline : 1, |
|
538 width : 400, |
|
539 height : 130 |
|
540 }); |
|
541 }, |
|
542 |
|
543 confirm : function(txt, cb, s) { |
|
544 var t = this, w; |
|
545 |
|
546 w = t.open({ |
|
547 title : t, |
|
548 type : 'confirm', |
|
549 button_func : function(s) { |
|
550 if (cb) |
|
551 cb.call(s || t, s); |
|
552 |
|
553 t.close(null, w.id); |
|
554 }, |
|
555 content : DOM.encode(t.editor.getLang(txt, txt)), |
|
556 inline : 1, |
|
557 width : 400, |
|
558 height : 130 |
|
559 }); |
|
560 }, |
|
561 |
|
562 // Internal functions |
|
563 |
|
564 _findId : function(w) { |
|
565 var t = this; |
|
566 |
|
567 if (typeof(w) == 'string') |
|
568 return w; |
|
569 |
|
570 each(t.windows, function(wo) { |
|
571 var ifr = DOM.get(wo.id + '_ifr'); |
|
572 |
|
573 if (ifr && w == ifr.contentWindow) { |
|
574 w = wo.id; |
|
575 return false; |
|
576 } |
|
577 }); |
|
578 |
|
579 return w; |
|
580 }, |
|
581 |
|
582 _fixIELayout : function(id, s) { |
|
583 var w, img; |
|
584 |
|
585 if (!tinymce.isIE6) |
|
586 return; |
|
587 |
|
588 // Fixes the bug where hover flickers and does odd things in IE6 |
|
589 each(['n','s','w','e','nw','ne','sw','se'], function(v) { |
|
590 var e = DOM.get(id + '_resize_' + v); |
|
591 |
|
592 DOM.setStyles(e, { |
|
593 width : s ? e.clientWidth : '', |
|
594 height : s ? e.clientHeight : '', |
|
595 cursor : DOM.getStyle(e, 'cursor', 1) |
|
596 }); |
|
597 |
|
598 DOM.setStyle(id + "_bottom", 'bottom', '-1px'); |
|
599 |
|
600 e = 0; |
|
601 }); |
|
602 |
|
603 // Fixes graphics glitch |
|
604 if (w = this.windows[id]) { |
|
605 // Fixes rendering bug after resize |
|
606 w.element.hide(); |
|
607 w.element.show(); |
|
608 |
|
609 // Forced a repaint of the window |
|
610 //DOM.get(id).style.filter = ''; |
|
611 |
|
612 // IE has a bug where images used in CSS won't get loaded |
|
613 // sometimes when the cache in the browser is disabled |
|
614 // This fix tries to solve it by loading the images using the image object |
|
615 each(DOM.select('div,a', id), function(e, i) { |
|
616 if (e.currentStyle.backgroundImage != 'none') { |
|
617 img = new Image(); |
|
618 img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1'); |
|
619 } |
|
620 }); |
|
621 |
|
622 DOM.get(id).style.filter = ''; |
|
623 } |
|
624 } |
|
625 }); |
|
626 |
|
627 // Register plugin |
|
628 tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups); |
|
629 })(); |
|
630 |