PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/BlogEngine/BlogEngine.NET/editors/tiny_mce_3_4_3_1/plugins/insertcode/editor_plugin_src.js

#
JavaScript | 51 lines | 39 code | 8 blank | 4 comment | 1 complexity | 6b758cd879b654657e565f21bf79933a MD5 | raw file
 1
 2(function() {
 3	// Load plugin specific language pack
 4	tinymce.PluginManager.requireLangPack('insertcode');
 5
 6	tinymce.create('tinymce.plugins.InsertCode', {
 7
 8		init : function(ed, url) {
 9			ed.addCommand('mceInsertCode', function() {
10				ed.windowManager.open({
11					file : url + '/dialog.htm?v=2',
12					width : 480 + parseInt(ed.getLang('insertcode.delta_width', 0)),
13					height : 320 + parseInt(ed.getLang('insertcode.delta_height', 0)),
14					inline : 1
15				}, {
16					plugin_url : url, // Plugin absolute URL
17					some_custom_arg : 'custom arg' // Custom argument
18				});
19			});
20
21			// Register example button
22			ed.addButton('insertcode', {
23			    title: 'Insert Code',
24				cmd : 'mceInsertCode',
25				image : url + '/img/code2.gif'
26			});
27
28			// Add a node change handler, selects the button in the UI when a image is selected
29			ed.onNodeChange.add(function(ed, cm, n) {
30			    cm.setActive('insertcode', n.nodeName == 'IMG');
31			});
32		},
33
34		createControl : function(n, cm) {
35			return null;
36		},
37
38		getInfo : function() {
39			return {
40				longname : 'Insert Code plugin',
41				author : 'Rtur.net',
42				authorurl : 'http://rtur.net',
43				infourl: 'http://rtur.net/blog/post/2009/11/26/Building-custom-plugin-for-TinyMCE.aspx',
44				version : "1.0"
45			};
46		}
47	});
48
49	// Register plugin
50	tinymce.PluginManager.add('insertcode', tinymce.plugins.InsertCode);
51})();