annotate WebContent/jscripts/tiny_mce/plugins/advlink/editor_plugin_src.js @ 5:0be9d53a6967

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