PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
JavaScript | 61 lines | 39 code | 9 blank | 13 comment | 6 complexity | 4104cd66aea546becf5d8fca66cf7951 MD5 | raw file
 1/**
 2 * editor_plugin_src.js
 3 *
 4 * Copyright 2009, Moxiecode Systems AB
 5 * Released under LGPL License.
 6 *
 7 * License: http://tinymce.moxiecode.com/license
 8 * Contributing: http://tinymce.moxiecode.com/contributing
 9 */
10
11(function() {
12	tinymce.create('tinymce.plugins.AdvancedLinkPlugin', {
13		init : function(ed, url) {
14			this.editor = ed;
15
16			// Register commands
17			ed.addCommand('mceAdvLink', function() {
18				var se = ed.selection;
19
20				// No selection and not in link
21				if (se.isCollapsed() && !ed.dom.getParent(se.getNode(), 'A'))
22					return;
23
24				ed.windowManager.open({
25					file : url + '/link.htm',
26					width : 480 + parseInt(ed.getLang('advlink.delta_width', 0)),
27					height : 400 + parseInt(ed.getLang('advlink.delta_height', 0)),
28					inline : 1
29				}, {
30					plugin_url : url
31				});
32			});
33
34			// Register buttons
35			ed.addButton('link', {
36				title : 'advlink.link_desc',
37				cmd : 'mceAdvLink'
38			});
39
40			ed.addShortcut('ctrl+k', 'advlink.advlink_desc', 'mceAdvLink');
41
42			ed.onNodeChange.add(function(ed, cm, n, co) {
43				cm.setDisabled('link', co && n.nodeName != 'A');
44				cm.setActive('link', n.nodeName == 'A' && !n.name);
45			});
46		},
47
48		getInfo : function() {
49			return {
50				longname : 'Advanced link',
51				author : 'Moxiecode Systems AB',
52				authorurl : 'http://tinymce.moxiecode.com',
53				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/advlink',
54				version : tinymce.majorVersion + "." + tinymce.minorVersion
55			};
56		}
57	});
58
59	// Register plugin
60	tinymce.PluginManager.add('advlink', tinymce.plugins.AdvancedLinkPlugin);
61})();