annotate static/js/tiny_mce/plugins/fullscreen/fullscreen.htm @ 1058:9bd0d1ad4ba9

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