bgneal@45: /**
bgneal@45:  * $Id: editor_plugin_src.js 787 2008-04-10 11:40:57Z spocke $
bgneal@45:  *
bgneal@45:  * @author Moxiecode
bgneal@45:  * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
bgneal@45:  */
bgneal@45: 
bgneal@45: (function() {
bgneal@45: 	tinymce.create('tinymce.plugins.StylePlugin', {
bgneal@45: 		init : function(ed, url) {
bgneal@45: 			// Register commands
bgneal@45: 			ed.addCommand('mceStyleProps', function() {
bgneal@45: 				ed.windowManager.open({
bgneal@45: 					file : url + '/props.htm',
bgneal@45: 					width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
bgneal@45: 					height : 320 + parseInt(ed.getLang('style.delta_height', 0)),
bgneal@45: 					inline : 1
bgneal@45: 				}, {
bgneal@45: 					plugin_url : url,
bgneal@45: 					style_text : ed.selection.getNode().style.cssText
bgneal@45: 				});
bgneal@45: 			});
bgneal@45: 
bgneal@45: 			ed.addCommand('mceSetElementStyle', function(ui, v) {
bgneal@45: 				if (e = ed.selection.getNode()) {
bgneal@45: 					ed.dom.setAttrib(e, 'style', v);
bgneal@45: 					ed.execCommand('mceRepaint');
bgneal@45: 				}
bgneal@45: 			});
bgneal@45: 
bgneal@45: 			ed.onNodeChange.add(function(ed, cm, n) {
bgneal@45: 				cm.setDisabled('styleprops', n.nodeName === 'BODY');
bgneal@45: 			});
bgneal@45: 
bgneal@45: 			// Register buttons
bgneal@45: 			ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
bgneal@45: 		},
bgneal@45: 
bgneal@45: 		getInfo : function() {
bgneal@45: 			return {
bgneal@45: 				longname : 'Style',
bgneal@45: 				author : 'Moxiecode Systems AB',
bgneal@45: 				authorurl : 'http://tinymce.moxiecode.com',
bgneal@45: 				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
bgneal@45: 				version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@45: 			};
bgneal@45: 		}
bgneal@45: 	});
bgneal@45: 
bgneal@45: 	// Register plugin
bgneal@45: 	tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
bgneal@45: })();