File: editor_plugin_src.js

package info (click to toggle)
tinymce 2.0.8-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 3,780 kB
  • ctags: 1,075
  • sloc: makefile: 63; sh: 49
file content (56 lines) | stat: -rwxr-xr-x 1,763 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**
 * $Id: editor_plugin_src.js 126 2006-10-22 16:19:55Z spocke $
 *
 * @author Moxiecode
 * @copyright Copyright  2004-2006, Moxiecode Systems AB, All rights reserved.
 */

var TinyMCE_ZoomPlugin = {
	getInfo : function() {
		return {
			longname : 'Zoom',
			author : 'Moxiecode Systems AB',
			authorurl : 'http://tinymce.moxiecode.com',
			infourl : 'http://tinymce.moxiecode.com/tinymce/docs/plugin_zoom.html',
			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
		};
	},

	/**
	 * Returns the HTML contents of the zoom control.
	 */
	getControlHTML : function(control_name) {
		if (!tinyMCE.isMSIE || tinyMCE.isMSIE5_0 || tinyMCE.isOpera)
			return "";

		switch (control_name) {
			case "zoom":
				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">' + 
						'<option value="100%">+ 100%</option>' + 
						'<option value="150%">+ 150%</option>' + 
						'<option value="200%">+ 200%</option>' + 
						'<option value="250%">+ 250%</option>' + 
						'</select>';
		}

		return "";
	},

	/**
	 * Executes the mceZoom command.
	 */
	execCommand : function(editor_id, element, command, user_interface, value) {
		// Handle commands
		switch (command) {
			case "mceZoom":
				tinyMCE.getInstanceById(editor_id).contentDocument.body.style.zoom = value;
				tinyMCE.getInstanceById(editor_id).contentDocument.body.style.mozZoom = value;
				return true;
		}

		// Pass to next handler in chain
		return false;
	}
};

tinyMCE.addPlugin("zoom", TinyMCE_ZoomPlugin);