editor_plugin_src.js 19 KB

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