annotate WebContent/jscripts/tiny_mce/plugins/xhtmlxtras/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.XHTMLXtrasPlugin', {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
13 init : function(ed, url) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
14 // Register commands
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
15 ed.addCommand('mceCite', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
16 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
17 file : url + '/cite.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
18 width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
19 height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
20 inline : 1
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
21 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
22 plugin_url : url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
23 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
24 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
25
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
26 ed.addCommand('mceAcronym', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
27 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
28 file : url + '/acronym.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
29 width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
30 height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
31 inline : 1
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
32 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
33 plugin_url : url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
34 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
35 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
36
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
37 ed.addCommand('mceAbbr', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
38 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
39 file : url + '/abbr.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
40 width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
41 height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
42 inline : 1
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
43 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
44 plugin_url : url
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 ed.addCommand('mceDel', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
49 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
50 file : url + '/del.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
51 width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
52 height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
53 inline : 1
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
54 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
55 plugin_url : url
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 ed.addCommand('mceIns', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
60 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
61 file : url + '/ins.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
62 width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
63 height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
64 inline : 1
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
65 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
66 plugin_url : url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
67 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
68 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
69
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
70 ed.addCommand('mceAttributes', function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
71 ed.windowManager.open({
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
72 file : url + '/attributes.htm',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
73 width : 380 + parseInt(ed.getLang('xhtmlxtras.attr_delta_width', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
74 height : 370 + parseInt(ed.getLang('xhtmlxtras.attr_delta_height', 0)),
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
75 inline : 1
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
76 }, {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
77 plugin_url : url
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
78 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
79 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
80
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
81 // Register buttons
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
82 ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
83 ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
84 ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
85 ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
86 ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
87 ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
88
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
89 ed.onNodeChange.add(function(ed, cm, n, co) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
90 n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
91
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
92 cm.setDisabled('cite', co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
93 cm.setDisabled('acronym', co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
94 cm.setDisabled('abbr', co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
95 cm.setDisabled('del', co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
96 cm.setDisabled('ins', co);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
97 cm.setDisabled('attribs', n && n.nodeName == 'BODY');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
98 cm.setActive('cite', 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
99 cm.setActive('acronym', 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
100 cm.setActive('abbr', 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
101 cm.setActive('del', 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
102 cm.setActive('ins', 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
103
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
104 // Activate all
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
105 if (n) {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
106 do {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
107 cm.setDisabled(n.nodeName.toLowerCase(), 0);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
108 cm.setActive(n.nodeName.toLowerCase(), 1);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
109 } while (n = n.parentNode);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
110 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
111 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
112
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
113 ed.onPreInit.add(function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
114 // Fixed IE issue where it can't handle these elements correctly
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
115 ed.dom.create('abbr');
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
116 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
117 },
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
118
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
119 getInfo : function() {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
120 return {
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
121 longname : 'XHTML Xtras Plugin',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
122 author : 'Moxiecode Systems AB',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
123 authorurl : 'http://tinymce.moxiecode.com',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
124 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
125 version : tinymce.majorVersion + "." + tinymce.minorVersion
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
126 };
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
127 }
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
128 });
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
129
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
130 // Register plugin
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
131 tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);
0be9d53a6967 editor for annotations
dwinter
parents:
diff changeset
132 })();