includes/clientside/tinymce/plugins/fullscreen/fullscreen.htm
changeset 1 fe660c52c48f
child 335 67bd3121a12e
equal deleted inserted replaced
0:902822492a68 1:fe660c52c48f
       
     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];
       
    10 		}
       
    11 
       
    12 		var settings = new Array();
       
    13 
       
    14 		// Clone array
       
    15 		for (var name in window.opener.tinyMCE.settings)
       
    16 			settings[name] = window.opener.tinyMCE.settings[name];
       
    17 
       
    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];
       
    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 		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;
       
    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 
       
    61 		function unloadHandler(e) {
       
    62 			moveContent();
       
    63 		}
       
    64 
       
    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);
       
    68 		}
       
    69 
       
    70 		// Add onunload
       
    71 		tinyMCE.addEvent(window, "beforeunload", unloadHandler);
       
    72 
       
    73 		function doParentSubmit() {
       
    74 			moveContent();
       
    75 
       
    76 			if (window.opener.tinyMCE.selectedInstance.formElement.form)
       
    77 				window.opener.tinyMCE.selectedInstance.formElement.form.submit();
       
    78 
       
    79 			window.close();
       
    80 
       
    81 			return false;
       
    82 		}
       
    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>