annotate static/js/tinymce/jscripts/tiny_mce/plugins/fullscreen/fullscreen.htm @ 168:8a93b1f838f9

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