app/tiny_mce/plugins/style/editor_plugin_src.js
author Todd Larsen <tlarsen@google.com>
Tue, 16 Sep 2008 16:49:25 +0000
changeset 154 d2377425d3f2
parent 126 app/soc/content/js/tiny_mce/plugins/style/editor_plugin_src.js@6186c115a210
permissions -rwxr-xr-x
Move third-party TinyMCE out of soc/content/js and into the application image root, like other third-party code. Update the app.yaml.template to add /tiny_mce as a source of static content.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
126
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     1
/**
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     2
 * $Id: editor_plugin_src.js 787 2008-04-10 11:40:57Z spocke $
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     3
 *
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     4
 * @author Moxiecode
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     5
 * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved.
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     6
 */
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     7
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     8
(function() {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
     9
	tinymce.create('tinymce.plugins.StylePlugin', {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    10
		init : function(ed, url) {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    11
			// Register commands
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    12
			ed.addCommand('mceStyleProps', function() {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    13
				ed.windowManager.open({
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    14
					file : url + '/props.htm',
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    15
					width : 480 + parseInt(ed.getLang('style.delta_width', 0)),
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    16
					height : 320 + parseInt(ed.getLang('style.delta_height', 0)),
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    17
					inline : 1
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    18
				}, {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    19
					plugin_url : url,
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    20
					style_text : ed.selection.getNode().style.cssText
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    21
				});
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    22
			});
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    23
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    24
			ed.addCommand('mceSetElementStyle', function(ui, v) {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    25
				if (e = ed.selection.getNode()) {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    26
					ed.dom.setAttrib(e, 'style', v);
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    27
					ed.execCommand('mceRepaint');
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    28
				}
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    29
			});
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    30
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    31
			ed.onNodeChange.add(function(ed, cm, n) {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    32
				cm.setDisabled('styleprops', n.nodeName === 'BODY');
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    33
			});
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    34
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    35
			// Register buttons
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    36
			ed.addButton('styleprops', {title : 'style.desc', cmd : 'mceStyleProps'});
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    37
		},
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    38
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    39
		getInfo : function() {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    40
			return {
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    41
				longname : 'Style',
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    42
				author : 'Moxiecode Systems AB',
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    43
				authorurl : 'http://tinymce.moxiecode.com',
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    44
				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/style',
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    45
				version : tinymce.majorVersion + "." + tinymce.minorVersion
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    46
			};
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    47
		}
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    48
	});
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    49
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    50
	// Register plugin
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    51
	tinymce.PluginManager.add('style', tinymce.plugins.StylePlugin);
6186c115a210 Added TinyMCE to Melange in soc/content/js
Pawel Solyga <Pawel.Solyga@gmail.com>
parents:
diff changeset
    52
})();