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