A QCodo powered CMS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

111 lines
3.4 KiB

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <title></title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  6. <script type="text/javascript" src="../../tiny_mce.js"></script>
  7. <script type="text/javascript">
  8. function patchCallback(settings, key) {
  9. if (settings[key])
  10. settings[key] = "window.opener." + settings[key];
  11. }
  12. var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
  13. // Clone array
  14. for (var n in paSe)
  15. settings[n] = paSe[n];
  16. // Override options for fullscreen
  17. for (var n in paSe.fullscreen_settings)
  18. settings[n] = paSe.fullscreen_settings[n];
  19. // Patch callbacks, make them point to window.opener
  20. patchCallback(settings, 'urlconverter_callback');
  21. patchCallback(settings, 'insertlink_callback');
  22. patchCallback(settings, 'insertimage_callback');
  23. patchCallback(settings, 'setupcontent_callback');
  24. patchCallback(settings, 'save_callback');
  25. patchCallback(settings, 'onchange_callback');
  26. patchCallback(settings, 'init_instance_callback');
  27. patchCallback(settings, 'file_browser_callback');
  28. patchCallback(settings, 'cleanup_callback');
  29. patchCallback(settings, 'execcommand_callback');
  30. patchCallback(settings, 'oninit');
  31. // Set options
  32. delete settings.id;
  33. settings['mode'] = 'exact';
  34. settings['elements'] = 'fullscreenarea';
  35. settings['add_unload_trigger'] = false;
  36. settings['ask'] = false;
  37. settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
  38. settings['fullscreen_is_enabled'] = true;
  39. settings['fullscreen_editor_id'] = oeID;
  40. settings['theme_advanced_resizing'] = false;
  41. settings['strict_loading_mode'] = true;
  42. settings.save_onsavecallback = function() {
  43. window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
  44. window.opener.tinyMCE.get(oeID).execCommand('mceSave');
  45. window.close();
  46. };
  47. function unloadHandler(e) {
  48. moveContent();
  49. }
  50. function moveContent() {
  51. window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
  52. }
  53. function closeFullscreen() {
  54. moveContent();
  55. window.close();
  56. }
  57. function doParentSubmit() {
  58. moveContent();
  59. if (window.opener.tinyMCE.selectedInstance.formElement.form)
  60. window.opener.tinyMCE.selectedInstance.formElement.form.submit();
  61. window.close();
  62. return false;
  63. }
  64. function render() {
  65. var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
  66. e.value = window.opener.tinyMCE.get(oeID).getContent();
  67. vp = dom.getViewPort();
  68. settings.width = vp.w;
  69. settings.height = vp.h - 15;
  70. tinymce.dom.Event.add(window, 'resize', function() {
  71. var vp = dom.getViewPort();
  72. tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
  73. });
  74. tinyMCE.init(settings);
  75. }
  76. // Add onunload
  77. tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
  78. </script>
  79. <base target="_self" />
  80. </head>
  81. <body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
  82. <form onsubmit="doParentSubmit();">
  83. <textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
  84. </form>
  85. <script type="text/javascript">
  86. render();
  87. </script>
  88. </body>
  89. </html>