1 <html xmlns="http://www.w3.org/1999/xhtml"> |
1 <html xmlns="http://www.w3.org/1999/xhtml"> |
2 <head> |
2 <head> |
3 <title>{$lang_fullscreen_title}</title> |
3 <title>{$lang_fullscreen_title}</title> |
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> |
5 <script language="javascript" type="text/javascript" src="../../tiny_mce.js"></script> |
5 <script type="text/javascript" src="../../tiny_mce.js"></script> |
6 <script language="javascript" type="text/javascript"> |
6 <script type="text/javascript"> |
7 function patchCallback(settings, key) { |
7 function patchCallback(settings, key) { |
8 if (settings[key]) |
8 if (settings[key]) |
9 settings[key] = "window.opener." + settings[key]; |
9 settings[key] = "window.opener." + settings[key]; |
10 } |
10 } |
11 |
11 |
12 var settings = new Array(); |
12 var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings; |
13 |
13 |
14 // Clone array |
14 // Clone array |
15 for (var name in window.opener.tinyMCE.settings) |
15 for (var n in paSe) |
16 settings[name] = window.opener.tinyMCE.settings[name]; |
16 settings[n] = paSe[n]; |
17 |
17 |
18 // Override options for fullscreen |
18 // Override options for fullscreen |
19 for (var name in window.opener.tinyMCE.settings.fullscreen_settings) |
19 for (var n in paSe.fullscreen_settings) |
20 settings[name] = window.opener.tinyMCE.settings.fullscreen_settings[name]; |
20 settings[n] = paSe.fullscreen_settings[n]; |
21 |
21 |
22 // Patch callbacks, make them point to window.opener |
22 // Patch callbacks, make them point to window.opener |
23 patchCallback(settings, 'urlconverter_callback'); |
23 patchCallback(settings, 'urlconverter_callback'); |
24 patchCallback(settings, 'insertlink_callback'); |
24 patchCallback(settings, 'insertlink_callback'); |
25 patchCallback(settings, 'insertimage_callback'); |
25 patchCallback(settings, 'insertimage_callback'); |
31 patchCallback(settings, 'cleanup_callback'); |
31 patchCallback(settings, 'cleanup_callback'); |
32 patchCallback(settings, 'execcommand_callback'); |
32 patchCallback(settings, 'execcommand_callback'); |
33 patchCallback(settings, 'oninit'); |
33 patchCallback(settings, 'oninit'); |
34 |
34 |
35 // Set options |
35 // Set options |
|
36 delete settings.id; |
36 settings['mode'] = 'exact'; |
37 settings['mode'] = 'exact'; |
37 settings['elements'] = 'fullscreenarea'; |
38 settings['elements'] = 'fullscreenarea'; |
|
39 settings['add_unload_trigger'] = false; |
38 settings['ask'] = false; |
40 settings['ask'] = false; |
39 settings['setupcontent_callback'] = 'setupContent'; |
41 settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI(); |
40 settings['fullscreen_is_enabled'] = true; |
42 settings['fullscreen_is_enabled'] = true; |
41 settings['fullscreen_editor_id'] = window.opener.tinyMCE.getWindowArg("editor_id"); |
43 settings['fullscreen_editor_id'] = window.opener.tinyMCE.activeEditor.id; |
42 settings['theme_advanced_resizing'] = false; |
44 settings['theme_advanced_resizing'] = false; |
43 |
|
44 // Init |
|
45 tinyMCE.init(settings); |
|
46 tinyMCE.documentBasePath = window.opener.tinyMCE.documentBasePath; |
|
47 |
|
48 function setupContent(editor_id, body, doc) { |
|
49 var inst = tinyMCE.getInstanceById(editor_id); |
|
50 var content = window.opener.tinyMCE.getContent(tinyMCE.getParam('fullscreen_editor_id')); |
|
51 |
|
52 // Setup title |
|
53 var divElm = document.createElement("div"); |
|
54 divElm.innerHTML = tinyMCELang['lang_fullscreen_title']; |
|
55 document.title = divElm.innerHTML; |
|
56 |
|
57 // Get content |
|
58 inst.execCommand('mceSetContent', false, content); |
|
59 } |
|
60 |
45 |
61 function unloadHandler(e) { |
46 function unloadHandler(e) { |
62 moveContent(); |
47 moveContent(); |
63 } |
48 } |
64 |
49 |
65 function moveContent() { |
50 function moveContent() { |
66 var doc = tinyMCE.isMSIE ? window.frames['mce_editor_0'].window.document : document.getElementById('mce_editor_0').contentDocument; |
51 window.opener.tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent({format : 'raw'})); |
67 window.opener.tinyMCE.setInnerHTML(window.opener.tinyMCE.selectedInstance.getBody(), doc.body.innerHTML); |
52 } |
|
53 |
|
54 function closeFullscreen() { |
|
55 moveContent(); |
|
56 window.close(); |
68 } |
57 } |
69 |
58 |
70 // Add onunload |
59 // Add onunload |
71 tinyMCE.addEvent(window, "beforeunload", unloadHandler); |
60 tinymce.dom.Event.add(window, "beforeunload", unloadHandler); |
72 |
61 |
73 function doParentSubmit() { |
62 function doParentSubmit() { |
74 moveContent(); |
63 moveContent(); |
75 |
64 |
76 if (window.opener.tinyMCE.selectedInstance.formElement.form) |
65 if (window.opener.tinyMCE.selectedInstance.formElement.form) |
78 |
67 |
79 window.close(); |
68 window.close(); |
80 |
69 |
81 return false; |
70 return false; |
82 } |
71 } |
|
72 |
|
73 function init() { |
|
74 var e = document.getElementById('fullscreenarea'); |
|
75 e.value = window.opener.tinyMCE.activeEditor.getContent({format : 'raw'}); |
|
76 settings['width'] = e.clientWidth; |
|
77 settings['height'] = e.clientHeight; |
|
78 tinyMCE.init(settings); |
|
79 } |
83 </script> |
80 </script> |
84 <base target="_self" /> |
81 <base target="_self" /> |
85 </head> |
82 </head> |
86 <body style="margin: 0; overflow: hidden; height: 100%" scrolling="no" scroll="no"> |
83 <body onload="init();" style="margin:0; overflow:hidden; height:100%;" scrolling="no" scroll="no"> |
87 <form onsubmit="doParentSubmit();" style="height: 100%"> |
84 <form onsubmit="doParentSubmit();" style="height: 100%"> |
88 <textarea id="fullscreenarea" style="width: 100%; height: 100%"></textarea> |
85 <textarea id="fullscreenarea" style="width:100%; height:100%"></textarea> |
89 </form> |
86 </form> |
90 </body> |
87 </body> |
91 </html> |
88 </html> |