Subversion-Projekte lars-tiefland.content-management

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 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
})();