Subversion Repositories Sites.tela-botanica.org

Rev

Rev 609 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
420 florian 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
/* Import plugin specific language pack */
9
tinyMCE.importPluginLanguagePack('style');
10
 
11
var TinyMCE_StylePlugin = {
12
	getInfo : function() {
13
		return {
14
			longname : 'Style',
15
			author : 'Moxiecode Systems AB',
16
			authorurl : 'http://tinymce.moxiecode.com',
17
			infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
18
			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
19
		};
20
	},
21
 
22
	getControlHTML : function(cn) {
23
		switch (cn) {
24
			case "styleprops":
25
				return tinyMCE.getButtonHTML(cn, 'lang_style_styleinfo_desc', '{$pluginurl}/images/styleprops.gif', 'mceStyleProps', true);
26
		}
27
 
28
		return "";
29
	},
30
 
31
	execCommand : function(editor_id, element, command, user_interface, value) {
32
		var e, inst;
33
 
34
		// Handle commands
35
		switch (command) {
36
			case "mceStyleProps":
37
				TinyMCE_StylePlugin._styleProps();
38
				return true;
39
 
40
			case "mceSetElementStyle":
41
				inst = tinyMCE.getInstanceById(editor_id);
42
				e = inst.selection.getFocusElement();
43
 
44
				if (e) {
45
					e.style.cssText = value;
46
					inst.repaint();
47
				}
48
 
49
				return true;
50
		}
51
 
52
		// Pass to next handler in chain
53
		return false;
54
	},
55
 
56
	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection) {
57
		if (node.nodeName == 'BODY')
58
			tinyMCE.switchClass(editor_id + '_styleprops', 'mceButtonDisabled');
59
		else
60
			tinyMCE.switchClass(editor_id + '_styleprops', 'mceButtonNormal');
61
	},
62
 
63
	// Private plugin specific methods
64
 
65
	_styleProps : function() {
66
		var e = tinyMCE.selectedInstance.selection.getFocusElement();
67
 
68
		if (!e || e.nodeName == 'BODY')
69
			return;
70
 
71
		tinyMCE.openWindow({
72
			file : '../../plugins/style/props.htm',
73
			width : 480 + tinyMCE.getLang('lang_style_props_delta_width', 0),
74
			height : 320 + tinyMCE.getLang('lang_style_props_delta_height', 0)
75
		}, {
76
			editor_id : tinyMCE.selectedInstance.editorId,
77
			inline : "yes",
78
			style_text : e.style.cssText
79
		});
80
	}
81
};
82
 
83
tinyMCE.addPlugin("style", TinyMCE_StylePlugin);