includes/clientside/tinymce/plugins/fullscreen/fullscreen.htm
changeset 335 67bd3121a12e
parent 1 fe660c52c48f
child 395 fa4c5ecb7c9a
--- a/includes/clientside/tinymce/plugins/fullscreen/fullscreen.htm	Wed Dec 26 00:37:26 2007 -0500
+++ b/includes/clientside/tinymce/plugins/fullscreen/fullscreen.htm	Thu Dec 27 22:09:33 2007 -0500
@@ -2,22 +2,22 @@
 <head>
 	<title>{$lang_fullscreen_title}</title>
 	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-	<script language="javascript" type="text/javascript" src="../../tiny_mce.js"></script>
-	<script language="javascript" type="text/javascript">
+	<script type="text/javascript" src="../../tiny_mce.js"></script>
+	<script type="text/javascript">
 		function patchCallback(settings, key) {
 			if (settings[key])
 				settings[key] = "window.opener." + settings[key];
 		}
 
-		var settings = new Array();
+		var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings;
 
 		// Clone array
-		for (var name in window.opener.tinyMCE.settings)
-			settings[name] = window.opener.tinyMCE.settings[name];
+		for (var n in paSe)
+			settings[n] = paSe[n];
 
 		// Override options for fullscreen
-		for (var name in window.opener.tinyMCE.settings.fullscreen_settings)
-			settings[name] = window.opener.tinyMCE.settings.fullscreen_settings[name];
+		for (var n in paSe.fullscreen_settings)
+			settings[n] = paSe.fullscreen_settings[n];
 
 		// Patch callbacks, make them point to window.opener
 		patchCallback(settings, 'urlconverter_callback');
@@ -33,42 +33,31 @@
 		patchCallback(settings, 'oninit');
 
 		// Set options
+		delete settings.id;
 		settings['mode'] = 'exact';
 		settings['elements'] = 'fullscreenarea';
+		settings['add_unload_trigger'] = false;
 		settings['ask'] = false;
-		settings['setupcontent_callback'] = 'setupContent';
+		settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
 		settings['fullscreen_is_enabled'] = true;
-		settings['fullscreen_editor_id'] = window.opener.tinyMCE.getWindowArg("editor_id");
+		settings['fullscreen_editor_id'] = window.opener.tinyMCE.activeEditor.id;
 		settings['theme_advanced_resizing'] = false;
 
-		// Init
-		tinyMCE.init(settings);
-		tinyMCE.documentBasePath = window.opener.tinyMCE.documentBasePath;
-
-		function setupContent(editor_id, body, doc) {
-			var inst = tinyMCE.getInstanceById(editor_id);
-			var content = window.opener.tinyMCE.getContent(tinyMCE.getParam('fullscreen_editor_id'));
-
-			// Setup title
-			var divElm = document.createElement("div");
-			divElm.innerHTML = tinyMCELang['lang_fullscreen_title'];
-			document.title = divElm.innerHTML;
-
-			// Get content
-			inst.execCommand('mceSetContent', false, content);
-		}
-
 		function unloadHandler(e) {
 			moveContent();
 		}
 
 		function moveContent() {
-			var doc = tinyMCE.isMSIE ? window.frames['mce_editor_0'].window.document : document.getElementById('mce_editor_0').contentDocument;
-			window.opener.tinyMCE.setInnerHTML(window.opener.tinyMCE.selectedInstance.getBody(), doc.body.innerHTML);
+			window.opener.tinyMCE.activeEditor.setContent(tinyMCE.activeEditor.getContent({format : 'raw'}));
+		}
+
+		function closeFullscreen() {
+			moveContent();
+			window.close();
 		}
 
 		// Add onunload
-		tinyMCE.addEvent(window, "beforeunload", unloadHandler);
+		tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
 
 		function doParentSubmit() {
 			moveContent();
@@ -80,12 +69,20 @@
 
 			return false;
 		}
+
+		function init() {
+			var e = document.getElementById('fullscreenarea');
+			e.value = window.opener.tinyMCE.activeEditor.getContent({format : 'raw'});
+			settings['width'] = e.clientWidth;
+			settings['height'] = e.clientHeight;
+			tinyMCE.init(settings);
+		}
 	</script>
 	<base target="_self" />
 </head>
-<body style="margin: 0; overflow: hidden; height: 100%" scrolling="no" scroll="no">
+<body onload="init();" style="margin:0; overflow:hidden; height:100%;" scrolling="no" scroll="no">
 <form onsubmit="doParentSubmit();" style="height: 100%">
-<textarea id="fullscreenarea" style="width: 100%; height: 100%"></textarea>
+<textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
 </form>
 </body>
 </html>