comparison static/js/tiny_mce/plugins/fullscreen/fullscreen.htm @ 312:88b2b9cb8c1f

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