includes/clientside/tinymce/plugins/fullscreen/editor_plugin_src.js
changeset 543 dffcbfbc4e59
parent 476 f26a69c40431
child 778 57ce13805b6f
--- a/includes/clientside/tinymce/plugins/fullscreen/editor_plugin_src.js	Mon May 05 20:06:37 2008 -0400
+++ b/includes/clientside/tinymce/plugins/fullscreen/editor_plugin_src.js	Mon May 05 20:08:44 2008 -0400
@@ -1,5 +1,5 @@
 /**
- * $Id: editor_plugin_src.js 636 2008-02-25 13:38:28Z spocke $
+ * $Id: editor_plugin_src.js 766 2008-04-03 20:37:06Z spocke $
  *
  * @author Moxiecode
  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
@@ -16,20 +16,21 @@
 
 			// Register commands
 			ed.addCommand('mceFullScreen', function() {
-				var win, de = document.documentElement;
+				var win, de = DOM.doc.documentElement;
 
 				if (ed.getParam('fullscreen_is_enabled')) {
 					if (ed.getParam('fullscreen_new_window'))
 						closeFullscreen(); // Call to close in new window
 					else {
-						window.setTimeout(function() {
-							tinymce.dom.Event.remove(window, 'resize', t.resizeFunc);
+						DOM.win.setTimeout(function() {
+							tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
 							tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
 							tinyMCE.remove(ed);
 							DOM.remove('mce_fullscreen_container');
 							de.style.overflow = ed.getParam('fullscreen_html_overflow');
-							DOM.setStyle(document.body, 'overflow', ed.getParam('fullscreen_overflow'));
-							window.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
+							DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
+							DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
+							tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
 						}, 10);
 					}
 
@@ -37,14 +38,15 @@
 				}
 
 				if (ed.getParam('fullscreen_new_window')) {
-					win = window.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
+					win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
 					try {
 						win.resizeTo(screen.availWidth, screen.availHeight);
 					} catch (e) {
 						// Ignore
 					}
 				} else {
-					s.fullscreen_overflow = DOM.getStyle(document.body, 'overflow', 1) || 'auto';
+					tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
+					s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
 					s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
 					vp = DOM.getViewPort();
 					s.fullscreen_scrollx = vp.x;
@@ -61,15 +63,15 @@
 					if (s.fullscreen_overflow == '0px')
 						s.fullscreen_overflow = '';
 
-					DOM.setStyle(document.body, 'overflow', 'hidden');
+					DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
 					de.style.overflow = 'hidden'; //Fix for IE6/7
 					vp = DOM.getViewPort();
-					window.scrollTo(0, 0);
+					DOM.win.scrollTo(0, 0);
 
 					if (tinymce.isIE)
 						vp.h -= 1;
 
-					n = DOM.add(document.body, 'div', {id : 'mce_fullscreen_container', style : 'position:absolute;top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:150;'});
+					n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:absolute;top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
 					DOM.add(n, 'div', {id : 'mce_fullscreen'});
 
 					tinymce.each(ed.settings, function(v, n) {
@@ -97,6 +99,7 @@
 					t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
 					t.fullscreenEditor.onInit.add(function() {
 						t.fullscreenEditor.setContent(ed.getContent());
+						t.fullscreenEditor.focus();
 					});
 
 					t.fullscreenEditor.render();
@@ -106,7 +109,7 @@
 					t.fullscreenElement.update();
 					//document.body.overflow = 'hidden';
 
-					t.resizeFunc = tinymce.dom.Event.add(window, 'resize', function() {
+					t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {
 						var vp = tinymce.DOM.getViewPort();
 
 						t.fullscreenEditor.theme.resizeTo(vp.w, vp.h);