Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / lib / editor / tinymce / jscripts / tiny_mce / plugins / fullscreen / fullscreen.htm
blob56b4bd51cf0806d0c78d871c4040c0b3d8c811b2
1 <html xmlns="http://www.w3.org/1999/xhtml">
2 <head>
3 <title>{$lang_fullscreen_title}</title>
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>
6 <script language="javascript" type="text/javascript">
7 function patchCallback(settings, key) {
8 if (settings[key])
9 settings[key] = "window.opener." + settings[key];
12 var settings = new Array();
14 // Clone array
15 for (var name in window.opener.tinyMCE.settings)
16 settings[name] = window.opener.tinyMCE.settings[name];
18 // Override options for fullscreen
19 for (var name in window.opener.tinyMCE.settings.fullscreen_settings)
20 settings[name] = window.opener.tinyMCE.settings.fullscreen_settings[name];
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');
35 // Set options
36 settings['mode'] = 'exact';
37 settings['elements'] = 'fullscreenarea';
38 settings['ask'] = false;
39 settings['setupcontent_callback'] = 'setupContent';
40 settings['fullscreen_is_enabled'] = true;
41 settings['fullscreen_editor_id'] = window.opener.tinyMCE.getWindowArg("editor_id");
42 settings['theme_advanced_resizing'] = false;
44 // Init
45 tinyMCE.init(settings);
46 tinyMCE.documentBasePath = window.opener.tinyMCE.documentBasePath;
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'));
52 // Setup title
53 var divElm = document.createElement("div");
54 divElm.innerHTML = tinyMCELang['lang_fullscreen_title'];
55 document.title = divElm.innerHTML;
57 // Get content
58 inst.execCommand('mceSetContent', false, content);
61 function unloadHandler(e) {
62 moveContent();
65 function moveContent() {
66 var doc = tinyMCE.isMSIE ? window.frames['mce_editor_0'].window.document : document.getElementById('mce_editor_0').contentDocument;
67 window.opener.tinyMCE.setInnerHTML(window.opener.tinyMCE.selectedInstance.getBody(), doc.body.innerHTML);
70 // Add onunload
71 tinyMCE.addEvent(window, "beforeunload", unloadHandler);
73 function doParentSubmit() {
74 moveContent();
76 if (window.opener.tinyMCE.selectedInstance.formElement.form)
77 window.opener.tinyMCE.selectedInstance.formElement.form.submit();
79 window.close();
81 return false;
83 </script>
84 <base target="_self" />
85 </head>
86 <body style="margin: 0; overflow: hidden; height: 100%" scrolling="no" scroll="no">
87 <form onsubmit="doParentSubmit();" style="height: 100%">
88 <textarea id="fullscreenarea" style="width: 100%; height: 100%"></textarea>
89 </form>
90 </body>
91 </html>