includes/clientside/tinymce/plugins/zoom/editor_plugin_src.js
changeset 1 fe660c52c48f
equal deleted inserted replaced
0:902822492a68 1:fe660c52c48f
       
     1 /**
       
     2  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
       
     3  *
       
     4  * @author Moxiecode
       
     5  * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
       
     6  */
       
     7 
       
     8 var TinyMCE_ZoomPlugin = {
       
     9 	getInfo : function() {
       
    10 		return {
       
    11 			longname : 'Zoom',
       
    12 			author : 'Moxiecode Systems AB',
       
    13 			authorurl : 'http://tinymce.moxiecode.com',
       
    14 			infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/zoom',
       
    15 			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
       
    16 		};
       
    17 	},
       
    18 
       
    19 	/**
       
    20 	 * Returns the HTML contents of the zoom control.
       
    21 	 */
       
    22 	getControlHTML : function(control_name) {
       
    23 		if (!tinyMCE.isMSIE || tinyMCE.isMSIE5_0 || tinyMCE.isOpera)
       
    24 			return "";
       
    25 
       
    26 		switch (control_name) {
       
    27 			case "zoom":
       
    28 				return '<select id="{$editor_id}_zoomSelect" name="{$editor_id}_zoomSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceZoom\',false,this.options[this.selectedIndex].value);" class="mceSelectList">' + 
       
    29 						'<option value="100%">+ 100%</option>' + 
       
    30 						'<option value="150%">+ 150%</option>' + 
       
    31 						'<option value="200%">+ 200%</option>' + 
       
    32 						'<option value="250%">+ 250%</option>' + 
       
    33 						'</select>';
       
    34 		}
       
    35 
       
    36 		return "";
       
    37 	},
       
    38 
       
    39 	/**
       
    40 	 * Executes the mceZoom command.
       
    41 	 */
       
    42 	execCommand : function(editor_id, element, command, user_interface, value) {
       
    43 		// Handle commands
       
    44 		switch (command) {
       
    45 			case "mceZoom":
       
    46 				tinyMCE.getInstanceById(editor_id).contentDocument.body.style.zoom = value;
       
    47 				tinyMCE.getInstanceById(editor_id).contentDocument.body.style.mozZoom = value;
       
    48 				return true;
       
    49 		}
       
    50 
       
    51 		// Pass to next handler in chain
       
    52 		return false;
       
    53 	}
       
    54 };
       
    55 
       
    56 tinyMCE.addPlugin("zoom", TinyMCE_ZoomPlugin);