includes/clientside/tinymce/plugins/emotions/editor_plugin_src.js
changeset 335 67bd3121a12e
parent 1 fe660c52c48f
child 395 fa4c5ecb7c9a
equal deleted inserted replaced
334:c72b545f1304 335:67bd3121a12e
     1 /**
     1 /**
     2  * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z spocke $
     2  * $Id: editor_plugin_src.js 408 2007-11-19 13:31:07Z spocke $
     3  *
     3  *
     4  * @author Moxiecode
     4  * @author Moxiecode
     5  * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
     5  * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
     6  */
     6  */
     7 
     7 
     8 /* Import plugin specific language pack */
     8 (function() {
     9 tinyMCE.importPluginLanguagePack('emotions');
     9 	tinymce.create('tinymce.plugins.EmotionsPlugin', {
       
    10 		init : function(ed, url) {
       
    11 			// Register commands
       
    12 			ed.addCommand('mceEmotion', function() {
       
    13 				ed.windowManager.open({
       
    14 					file : url + '/emotions.htm',
       
    15 					width : 250 + ed.getLang('emotions.delta_width', 0),
       
    16 					height : 160 + ed.getLang('emotions.delta_height', 0),
       
    17 					inline : 1
       
    18 				}, {
       
    19 					plugin_url : url
       
    20 				});
       
    21 			});
    10 
    22 
    11 // Plucin static class
    23 			// Register buttons
    12 var TinyMCE_EmotionsPlugin = {
    24 			ed.addButton('emotions', {title : 'emotions.emotions_desc', cmd : 'mceEmotion'});
    13 	getInfo : function() {
    25 		},
    14 		return {
       
    15 			longname : 'Emotions',
       
    16 			author : 'Moxiecode Systems AB',
       
    17 			authorurl : 'http://tinymce.moxiecode.com',
       
    18 			infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
       
    19 			version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion
       
    20 		};
       
    21 	},
       
    22 
    26 
    23 	/**
    27 		getInfo : function() {
    24 	 * Returns the HTML contents of the emotions control.
    28 			return {
    25 	 */
    29 				longname : 'Emotions',
    26 	getControlHTML : function(cn) {
    30 				author : 'Moxiecode Systems AB',
    27 		switch (cn) {
    31 				authorurl : 'http://tinymce.moxiecode.com',
    28 			case "emotions":
    32 				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/emotions',
    29 				return tinyMCE.getButtonHTML(cn, 'lang_emotions_desc', '{$pluginurl}/images/emotions.gif', 'mceEmotion');
    33 				version : tinymce.majorVersion + "." + tinymce.minorVersion
       
    34 			};
    30 		}
    35 		}
       
    36 	});
    31 
    37 
    32 		return "";
    38 	// Register plugin
    33 	},
    39 	tinymce.PluginManager.add('emotions', tinymce.plugins.EmotionsPlugin);
    34 
    40 })();
    35 	/**
       
    36 	 * Executes the mceEmotion command.
       
    37 	 */
       
    38 	execCommand : function(editor_id, element, command, user_interface, value) {
       
    39 		// Handle commands
       
    40 		switch (command) {
       
    41 			case "mceEmotion":
       
    42 				var template = new Array();
       
    43 
       
    44 				template['file'] = '../../plugins/emotions/emotions.htm'; // Relative to theme
       
    45 				template['width'] = 250;
       
    46 				template['height'] = 160;
       
    47 
       
    48 				// Language specific width and height addons
       
    49 				template['width'] += tinyMCE.getLang('lang_emotions_delta_width', 0);
       
    50 				template['height'] += tinyMCE.getLang('lang_emotions_delta_height', 0);
       
    51 
       
    52 				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
       
    53 
       
    54 				return true;
       
    55 		}
       
    56 
       
    57 		// Pass to next handler in chain
       
    58 		return false;
       
    59 	}
       
    60 };
       
    61 
       
    62 // Register plugin
       
    63 tinyMCE.addPlugin('emotions', TinyMCE_EmotionsPlugin);