Mercurial > public > sg101
comparison media/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js @ 45:a5b4c5ce0658
Breaking down and controlling all media files, including javascript libraries.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Fri, 19 Jun 2009 03:16:03 +0000 |
parents | |
children | 149c3567fec1 |
comparison
equal
deleted
inserted
replaced
44:08cd19c1ee50 | 45:a5b4c5ce0658 |
---|---|
1 /** | |
2 * $Id: editor_plugin_src.js 923 2008-09-09 16:45:29Z spocke $ | |
3 * | |
4 * @author Moxiecode | |
5 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. | |
6 */ | |
7 | |
8 (function() { | |
9 var DOM = tinymce.DOM; | |
10 | |
11 tinymce.create('tinymce.plugins.FullScreenPlugin', { | |
12 init : function(ed, url) { | |
13 var t = this, s = {}, vp; | |
14 | |
15 t.editor = ed; | |
16 | |
17 // Register commands | |
18 ed.addCommand('mceFullScreen', function() { | |
19 var win, de = DOM.doc.documentElement; | |
20 | |
21 if (ed.getParam('fullscreen_is_enabled')) { | |
22 if (ed.getParam('fullscreen_new_window')) | |
23 closeFullscreen(); // Call to close in new window | |
24 else { | |
25 DOM.win.setTimeout(function() { | |
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'}); | |
28 tinyMCE.remove(ed); | |
29 DOM.remove('mce_fullscreen_container'); | |
30 de.style.overflow = ed.getParam('fullscreen_html_overflow'); | |
31 DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow')); | |
32 DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly')); | |
33 tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings | |
34 }, 10); | |
35 } | |
36 | |
37 return; | |
38 } | |
39 | |
40 if (ed.getParam('fullscreen_new_window')) { | |
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); | |
42 try { | |
43 win.resizeTo(screen.availWidth, screen.availHeight); | |
44 } catch (e) { | |
45 // Ignore | |
46 } | |
47 } else { | |
48 tinyMCE.oldSettings = tinyMCE.settings; // Store old settings | |
49 s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto'; | |
50 s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1); | |
51 vp = DOM.getViewPort(); | |
52 s.fullscreen_scrollx = vp.x; | |
53 s.fullscreen_scrolly = vp.y; | |
54 | |
55 // Fixes an Opera bug where the scrollbars doesn't reappear | |
56 if (tinymce.isOpera && s.fullscreen_overflow == 'visible') | |
57 s.fullscreen_overflow = 'auto'; | |
58 | |
59 // Fixes an IE bug where horizontal scrollbars would appear | |
60 if (tinymce.isIE && s.fullscreen_overflow == 'scroll') | |
61 s.fullscreen_overflow = 'auto'; | |
62 | |
63 // Fixes an IE bug where the scrollbars doesn't reappear | |
64 if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll')) | |
65 s.fullscreen_html_overflow = 'auto'; | |
66 | |
67 if (s.fullscreen_overflow == '0px') | |
68 s.fullscreen_overflow = ''; | |
69 | |
70 DOM.setStyle(DOM.doc.body, 'overflow', 'hidden'); | |
71 de.style.overflow = 'hidden'; //Fix for IE6/7 | |
72 vp = DOM.getViewPort(); | |
73 DOM.win.scrollTo(0, 0); | |
74 | |
75 if (tinymce.isIE) | |
76 vp.h -= 1; | |
77 | |
78 n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:' + (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel) ? 'absolute' : 'fixed') + ';top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'}); | |
79 DOM.add(n, 'div', {id : 'mce_fullscreen'}); | |
80 | |
81 tinymce.each(ed.settings, function(v, n) { | |
82 s[n] = v; | |
83 }); | |
84 | |
85 s.id = 'mce_fullscreen'; | |
86 s.width = n.clientWidth; | |
87 s.height = n.clientHeight - 15; | |
88 s.fullscreen_is_enabled = true; | |
89 s.fullscreen_editor_id = ed.id; | |
90 s.theme_advanced_resizing = false; | |
91 s.save_onsavecallback = function() { | |
92 ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'}); | |
93 ed.execCommand('mceSave'); | |
94 }; | |
95 | |
96 tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) { | |
97 s[k] = v; | |
98 }); | |
99 | |
100 if (s.theme_advanced_toolbar_location === 'external') | |
101 s.theme_advanced_toolbar_location = 'top'; | |
102 | |
103 t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s); | |
104 t.fullscreenEditor.onInit.add(function() { | |
105 t.fullscreenEditor.setContent(ed.getContent()); | |
106 t.fullscreenEditor.focus(); | |
107 }); | |
108 | |
109 t.fullscreenEditor.render(); | |
110 tinyMCE.add(t.fullscreenEditor); | |
111 | |
112 t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container'); | |
113 t.fullscreenElement.update(); | |
114 //document.body.overflow = 'hidden'; | |
115 | |
116 t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() { | |
117 var vp = tinymce.DOM.getViewPort(); | |
118 | |
119 t.fullscreenEditor.theme.resizeTo(vp.w, vp.h); | |
120 }); | |
121 } | |
122 }); | |
123 | |
124 // Register buttons | |
125 ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'}); | |
126 | |
127 ed.onNodeChange.add(function(ed, cm) { | |
128 cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled')); | |
129 }); | |
130 }, | |
131 | |
132 getInfo : function() { | |
133 return { | |
134 longname : 'Fullscreen', | |
135 author : 'Moxiecode Systems AB', | |
136 authorurl : 'http://tinymce.moxiecode.com', | |
137 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen', | |
138 version : tinymce.majorVersion + "." + tinymce.minorVersion | |
139 }; | |
140 } | |
141 }); | |
142 | |
143 // Register plugin | |
144 tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin); | |
145 })(); |