annotate media/js/tiny_mce/plugins/fullscreen/editor_plugin_src.js @ 133:c515b7401078

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