PageRenderTime 74ms CodeModel.GetById 66ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

/static/scripts/tiny_mce/plugins/advlink/editor_plugin_src.js

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