annotate static/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js @ 624:5d79b09aa52b

Tweaked wording to the help text on the search page.
author Brian Neal <bgneal@gmail.com>
date Wed, 31 Oct 2012 20:23:12 -0500
parents 6c182ceb7147
children
rev   line source
bgneal@312 1 /**
bgneal@312 2 * editor_plugin_src.js
bgneal@312 3 *
bgneal@312 4 * Copyright 2009, Moxiecode Systems AB
bgneal@312 5 * Released under LGPL License.
bgneal@312 6 *
bgneal@312 7 * License: http://tinymce.moxiecode.com/license
bgneal@312 8 * Contributing: http://tinymce.moxiecode.com/contributing
bgneal@312 9 */
bgneal@312 10
bgneal@312 11 (function() {
bgneal@312 12 var DOM = tinymce.DOM;
bgneal@312 13
bgneal@312 14 tinymce.create('tinymce.plugins.FullScreenPlugin', {
bgneal@312 15 init : function(ed, url) {
bgneal@442 16 var t = this, s = {}, vp, posCss;
bgneal@312 17
bgneal@312 18 t.editor = ed;
bgneal@312 19
bgneal@312 20 // Register commands
bgneal@312 21 ed.addCommand('mceFullScreen', function() {
bgneal@312 22 var win, de = DOM.doc.documentElement;
bgneal@312 23
bgneal@312 24 if (ed.getParam('fullscreen_is_enabled')) {
bgneal@312 25 if (ed.getParam('fullscreen_new_window'))
bgneal@312 26 closeFullscreen(); // Call to close in new window
bgneal@312 27 else {
bgneal@312 28 DOM.win.setTimeout(function() {
bgneal@312 29 tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
bgneal@312 30 tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
bgneal@312 31 tinyMCE.remove(ed);
bgneal@312 32 DOM.remove('mce_fullscreen_container');
bgneal@312 33 de.style.overflow = ed.getParam('fullscreen_html_overflow');
bgneal@312 34 DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
bgneal@312 35 DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
bgneal@312 36 tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
bgneal@312 37 }, 10);
bgneal@312 38 }
bgneal@312 39
bgneal@312 40 return;
bgneal@312 41 }
bgneal@312 42
bgneal@312 43 if (ed.getParam('fullscreen_new_window')) {
bgneal@312 44 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);
bgneal@312 45 try {
bgneal@312 46 win.resizeTo(screen.availWidth, screen.availHeight);
bgneal@312 47 } catch (e) {
bgneal@312 48 // Ignore
bgneal@312 49 }
bgneal@312 50 } else {
bgneal@312 51 tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
bgneal@312 52 s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
bgneal@312 53 s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
bgneal@312 54 vp = DOM.getViewPort();
bgneal@312 55 s.fullscreen_scrollx = vp.x;
bgneal@312 56 s.fullscreen_scrolly = vp.y;
bgneal@312 57
bgneal@312 58 // Fixes an Opera bug where the scrollbars doesn't reappear
bgneal@312 59 if (tinymce.isOpera && s.fullscreen_overflow == 'visible')
bgneal@312 60 s.fullscreen_overflow = 'auto';
bgneal@312 61
bgneal@312 62 // Fixes an IE bug where horizontal scrollbars would appear
bgneal@312 63 if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
bgneal@312 64 s.fullscreen_overflow = 'auto';
bgneal@312 65
bgneal@312 66 // Fixes an IE bug where the scrollbars doesn't reappear
bgneal@312 67 if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))
bgneal@312 68 s.fullscreen_html_overflow = 'auto';
bgneal@312 69
bgneal@312 70 if (s.fullscreen_overflow == '0px')
bgneal@312 71 s.fullscreen_overflow = '';
bgneal@312 72
bgneal@312 73 DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
bgneal@312 74 de.style.overflow = 'hidden'; //Fix for IE6/7
bgneal@312 75 vp = DOM.getViewPort();
bgneal@312 76 DOM.win.scrollTo(0, 0);
bgneal@312 77
bgneal@312 78 if (tinymce.isIE)
bgneal@312 79 vp.h -= 1;
bgneal@312 80
bgneal@442 81 // Use fixed position if it exists
bgneal@442 82 if (tinymce.isIE6)
bgneal@442 83 posCss = 'absolute;top:' + vp.y;
bgneal@442 84 else
bgneal@442 85 posCss = 'fixed;top:0';
bgneal@442 86
bgneal@442 87 n = DOM.add(DOM.doc.body, 'div', {
bgneal@442 88 id : 'mce_fullscreen_container',
bgneal@442 89 style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
bgneal@312 90 DOM.add(n, 'div', {id : 'mce_fullscreen'});
bgneal@312 91
bgneal@312 92 tinymce.each(ed.settings, function(v, n) {
bgneal@312 93 s[n] = v;
bgneal@312 94 });
bgneal@312 95
bgneal@312 96 s.id = 'mce_fullscreen';
bgneal@312 97 s.width = n.clientWidth;
bgneal@312 98 s.height = n.clientHeight - 15;
bgneal@312 99 s.fullscreen_is_enabled = true;
bgneal@312 100 s.fullscreen_editor_id = ed.id;
bgneal@312 101 s.theme_advanced_resizing = false;
bgneal@312 102 s.save_onsavecallback = function() {
bgneal@312 103 ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'});
bgneal@312 104 ed.execCommand('mceSave');
bgneal@312 105 };
bgneal@312 106
bgneal@312 107 tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {
bgneal@312 108 s[k] = v;
bgneal@312 109 });
bgneal@312 110
bgneal@312 111 if (s.theme_advanced_toolbar_location === 'external')
bgneal@312 112 s.theme_advanced_toolbar_location = 'top';
bgneal@312 113
bgneal@312 114 t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
bgneal@312 115 t.fullscreenEditor.onInit.add(function() {
bgneal@312 116 t.fullscreenEditor.setContent(ed.getContent());
bgneal@312 117 t.fullscreenEditor.focus();
bgneal@312 118 });
bgneal@312 119
bgneal@312 120 t.fullscreenEditor.render();
bgneal@312 121
bgneal@312 122 t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');
bgneal@312 123 t.fullscreenElement.update();
bgneal@312 124 //document.body.overflow = 'hidden';
bgneal@312 125
bgneal@312 126 t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {
bgneal@312 127 var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;
bgneal@312 128
bgneal@312 129 // Get outer/inner size to get a delta size that can be used to calc the new iframe size
bgneal@312 130 outerSize = fed.dom.getSize(fed.getContainer().firstChild);
bgneal@312 131 innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]);
bgneal@312 132
bgneal@312 133 fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);
bgneal@312 134 });
bgneal@312 135 }
bgneal@312 136 });
bgneal@312 137
bgneal@312 138 // Register buttons
bgneal@312 139 ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});
bgneal@312 140
bgneal@312 141 ed.onNodeChange.add(function(ed, cm) {
bgneal@312 142 cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
bgneal@312 143 });
bgneal@312 144 },
bgneal@312 145
bgneal@312 146 getInfo : function() {
bgneal@312 147 return {
bgneal@312 148 longname : 'Fullscreen',
bgneal@312 149 author : 'Moxiecode Systems AB',
bgneal@312 150 authorurl : 'http://tinymce.moxiecode.com',
bgneal@312 151 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
bgneal@312 152 version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@312 153 };
bgneal@312 154 }
bgneal@312 155 });
bgneal@312 156
bgneal@312 157 // Register plugin
bgneal@312 158 tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
bgneal@312 159 })();