14 |
14 |
15 t.editor = ed; |
15 t.editor = ed; |
16 |
16 |
17 // Register commands |
17 // Register commands |
18 ed.addCommand('mceFullScreen', function() { |
18 ed.addCommand('mceFullScreen', function() { |
19 var win, de = document.documentElement; |
19 var win, de = DOM.doc.documentElement; |
20 |
20 |
21 if (ed.getParam('fullscreen_is_enabled')) { |
21 if (ed.getParam('fullscreen_is_enabled')) { |
22 if (ed.getParam('fullscreen_new_window')) |
22 if (ed.getParam('fullscreen_new_window')) |
23 closeFullscreen(); // Call to close in new window |
23 closeFullscreen(); // Call to close in new window |
24 else { |
24 else { |
25 window.setTimeout(function() { |
25 DOM.win.setTimeout(function() { |
26 tinymce.dom.Event.remove(window, 'resize', t.resizeFunc); |
26 tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc); |
27 tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'}); |
27 tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'}); |
28 tinyMCE.remove(ed); |
28 tinyMCE.remove(ed); |
29 DOM.remove('mce_fullscreen_container'); |
29 DOM.remove('mce_fullscreen_container'); |
30 de.style.overflow = ed.getParam('fullscreen_html_overflow'); |
30 de.style.overflow = ed.getParam('fullscreen_html_overflow'); |
31 DOM.setStyle(document.body, 'overflow', ed.getParam('fullscreen_overflow')); |
31 DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow')); |
32 window.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly')); |
32 DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly')); |
|
33 tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings |
33 }, 10); |
34 }, 10); |
34 } |
35 } |
35 |
36 |
36 return; |
37 return; |
37 } |
38 } |
38 |
39 |
39 if (ed.getParam('fullscreen_new_window')) { |
40 if (ed.getParam('fullscreen_new_window')) { |
40 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); |
41 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); |
41 try { |
42 try { |
42 win.resizeTo(screen.availWidth, screen.availHeight); |
43 win.resizeTo(screen.availWidth, screen.availHeight); |
43 } catch (e) { |
44 } catch (e) { |
44 // Ignore |
45 // Ignore |
45 } |
46 } |
46 } else { |
47 } else { |
47 s.fullscreen_overflow = DOM.getStyle(document.body, 'overflow', 1) || 'auto'; |
48 tinyMCE.oldSettings = tinyMCE.settings; // Store old settings |
|
49 s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto'; |
48 s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1); |
50 s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1); |
49 vp = DOM.getViewPort(); |
51 vp = DOM.getViewPort(); |
50 s.fullscreen_scrollx = vp.x; |
52 s.fullscreen_scrollx = vp.x; |
51 s.fullscreen_scrolly = vp.y; |
53 s.fullscreen_scrolly = vp.y; |
52 |
54 |
59 s.fullscreen_overflow = 'auto'; |
61 s.fullscreen_overflow = 'auto'; |
60 |
62 |
61 if (s.fullscreen_overflow == '0px') |
63 if (s.fullscreen_overflow == '0px') |
62 s.fullscreen_overflow = ''; |
64 s.fullscreen_overflow = ''; |
63 |
65 |
64 DOM.setStyle(document.body, 'overflow', 'hidden'); |
66 DOM.setStyle(DOM.doc.body, 'overflow', 'hidden'); |
65 de.style.overflow = 'hidden'; //Fix for IE6/7 |
67 de.style.overflow = 'hidden'; //Fix for IE6/7 |
66 vp = DOM.getViewPort(); |
68 vp = DOM.getViewPort(); |
67 window.scrollTo(0, 0); |
69 DOM.win.scrollTo(0, 0); |
68 |
70 |
69 if (tinymce.isIE) |
71 if (tinymce.isIE) |
70 vp.h -= 1; |
72 vp.h -= 1; |
71 |
73 |
72 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;'}); |
74 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;'}); |
73 DOM.add(n, 'div', {id : 'mce_fullscreen'}); |
75 DOM.add(n, 'div', {id : 'mce_fullscreen'}); |
74 |
76 |
75 tinymce.each(ed.settings, function(v, n) { |
77 tinymce.each(ed.settings, function(v, n) { |
76 s[n] = v; |
78 s[n] = v; |
77 }); |
79 }); |
95 s.theme_advanced_toolbar_location = 'top'; |
97 s.theme_advanced_toolbar_location = 'top'; |
96 |
98 |
97 t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s); |
99 t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s); |
98 t.fullscreenEditor.onInit.add(function() { |
100 t.fullscreenEditor.onInit.add(function() { |
99 t.fullscreenEditor.setContent(ed.getContent()); |
101 t.fullscreenEditor.setContent(ed.getContent()); |
|
102 t.fullscreenEditor.focus(); |
100 }); |
103 }); |
101 |
104 |
102 t.fullscreenEditor.render(); |
105 t.fullscreenEditor.render(); |
103 tinyMCE.add(t.fullscreenEditor); |
106 tinyMCE.add(t.fullscreenEditor); |
104 |
107 |
105 t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container'); |
108 t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container'); |
106 t.fullscreenElement.update(); |
109 t.fullscreenElement.update(); |
107 //document.body.overflow = 'hidden'; |
110 //document.body.overflow = 'hidden'; |
108 |
111 |
109 t.resizeFunc = tinymce.dom.Event.add(window, 'resize', function() { |
112 t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() { |
110 var vp = tinymce.DOM.getViewPort(); |
113 var vp = tinymce.DOM.getViewPort(); |
111 |
114 |
112 t.fullscreenEditor.theme.resizeTo(vp.w, vp.h); |
115 t.fullscreenEditor.theme.resizeTo(vp.w, vp.h); |
113 }); |
116 }); |
114 } |
117 } |