annotate media/js/tiny_mce/plugins/fullscreen/fullscreen.htm @ 293:c92fb89dbc7d

Fixed a bug where if you tried to delete a topic the new last post might be in that topic, so a cascading delete would occur and the forum would get deleted.
author Brian Neal <bgneal@gmail.com>
date Wed, 29 Dec 2010 04:56:53 +0000
parents 149c3567fec1
children
rev   line source
bgneal@45 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
bgneal@45 2 <html xmlns="http://www.w3.org/1999/xhtml">
bgneal@45 3 <head>
bgneal@45 4 <title></title>
bgneal@45 5 <script type="text/javascript" src="../../tiny_mce.js"></script>
bgneal@45 6 <script type="text/javascript">
bgneal@45 7 function patchCallback(settings, key) {
bgneal@45 8 if (settings[key])
bgneal@45 9 settings[key] = "window.opener." + settings[key];
bgneal@45 10 }
bgneal@45 11
bgneal@45 12 var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
bgneal@45 13
bgneal@45 14 // Clone array
bgneal@45 15 for (var n in paSe)
bgneal@45 16 settings[n] = paSe[n];
bgneal@45 17
bgneal@45 18 // Override options for fullscreen
bgneal@45 19 for (var n in paSe.fullscreen_settings)
bgneal@45 20 settings[n] = paSe.fullscreen_settings[n];
bgneal@45 21
bgneal@45 22 // Patch callbacks, make them point to window.opener
bgneal@45 23 patchCallback(settings, 'urlconverter_callback');
bgneal@45 24 patchCallback(settings, 'insertlink_callback');
bgneal@45 25 patchCallback(settings, 'insertimage_callback');
bgneal@45 26 patchCallback(settings, 'setupcontent_callback');
bgneal@45 27 patchCallback(settings, 'save_callback');
bgneal@45 28 patchCallback(settings, 'onchange_callback');
bgneal@45 29 patchCallback(settings, 'init_instance_callback');
bgneal@45 30 patchCallback(settings, 'file_browser_callback');
bgneal@45 31 patchCallback(settings, 'cleanup_callback');
bgneal@45 32 patchCallback(settings, 'execcommand_callback');
bgneal@45 33 patchCallback(settings, 'oninit');
bgneal@45 34
bgneal@45 35 // Set options
bgneal@45 36 delete settings.id;
bgneal@45 37 settings['mode'] = 'exact';
bgneal@45 38 settings['elements'] = 'fullscreenarea';
bgneal@45 39 settings['add_unload_trigger'] = false;
bgneal@45 40 settings['ask'] = false;
bgneal@45 41 settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
bgneal@45 42 settings['fullscreen_is_enabled'] = true;
bgneal@45 43 settings['fullscreen_editor_id'] = oeID;
bgneal@45 44 settings['theme_advanced_resizing'] = false;
bgneal@45 45 settings['strict_loading_mode'] = true;
bgneal@45 46
bgneal@45 47 settings.save_onsavecallback = function() {
bgneal@45 48 window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
bgneal@45 49 window.opener.tinyMCE.get(oeID).execCommand('mceSave');
bgneal@45 50 window.close();
bgneal@45 51 };
bgneal@45 52
bgneal@45 53 function unloadHandler(e) {
bgneal@45 54 moveContent();
bgneal@45 55 }
bgneal@45 56
bgneal@45 57 function moveContent() {
bgneal@45 58 window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
bgneal@45 59 }
bgneal@45 60
bgneal@45 61 function closeFullscreen() {
bgneal@45 62 moveContent();
bgneal@45 63 window.close();
bgneal@45 64 }
bgneal@45 65
bgneal@45 66 function doParentSubmit() {
bgneal@45 67 moveContent();
bgneal@45 68
bgneal@45 69 if (window.opener.tinyMCE.selectedInstance.formElement.form)
bgneal@45 70 window.opener.tinyMCE.selectedInstance.formElement.form.submit();
bgneal@45 71
bgneal@45 72 window.close();
bgneal@45 73
bgneal@45 74 return false;
bgneal@45 75 }
bgneal@45 76
bgneal@45 77 function render() {
bgneal@45 78 var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
bgneal@45 79
bgneal@45 80 e.value = window.opener.tinyMCE.get(oeID).getContent();
bgneal@45 81
bgneal@45 82 vp = dom.getViewPort();
bgneal@45 83 settings.width = vp.w;
bgneal@45 84 settings.height = vp.h - 15;
bgneal@45 85
bgneal@45 86 tinymce.dom.Event.add(window, 'resize', function() {
bgneal@45 87 var vp = dom.getViewPort();
bgneal@45 88
bgneal@45 89 tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
bgneal@45 90 });
bgneal@45 91
bgneal@45 92 tinyMCE.init(settings);
bgneal@45 93 }
bgneal@45 94
bgneal@45 95 // Add onunload
bgneal@45 96 tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
bgneal@45 97 </script>
bgneal@45 98 </head>
bgneal@45 99 <body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
bgneal@45 100 <form onsubmit="doParentSubmit();">
bgneal@45 101 <textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
bgneal@45 102 </form>
bgneal@45 103
bgneal@45 104 <script type="text/javascript">
bgneal@45 105 render();
bgneal@45 106 </script>
bgneal@45 107
bgneal@45 108 </body>
bgneal@45 109 </html>