comparison media/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js @ 45:a5b4c5ce0658

Breaking down and controlling all media files, including javascript libraries.
author Brian Neal <bgneal@gmail.com>
date Fri, 19 Jun 2009 03:16:03 +0000
parents
children 149c3567fec1
comparison
equal deleted inserted replaced
44:08cd19c1ee50 45:a5b4c5ce0658
1 /**
2 * $Id: editor_plugin_src.js 201 2007-02-12 15:56:56Z 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.XHTMLXtrasPlugin', {
10 init : function(ed, url) {
11 // Register commands
12 ed.addCommand('mceCite', function() {
13 ed.windowManager.open({
14 file : url + '/cite.htm',
15 width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),
16 height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),
17 inline : 1
18 }, {
19 plugin_url : url
20 });
21 });
22
23 ed.addCommand('mceAcronym', function() {
24 ed.windowManager.open({
25 file : url + '/acronym.htm',
26 width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
27 height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
28 inline : 1
29 }, {
30 plugin_url : url
31 });
32 });
33
34 ed.addCommand('mceAbbr', function() {
35 ed.windowManager.open({
36 file : url + '/abbr.htm',
37 width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
38 height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
39 inline : 1
40 }, {
41 plugin_url : url
42 });
43 });
44
45 ed.addCommand('mceDel', function() {
46 ed.windowManager.open({
47 file : url + '/del.htm',
48 width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
49 height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
50 inline : 1
51 }, {
52 plugin_url : url
53 });
54 });
55
56 ed.addCommand('mceIns', function() {
57 ed.windowManager.open({
58 file : url + '/ins.htm',
59 width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
60 height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
61 inline : 1
62 }, {
63 plugin_url : url
64 });
65 });
66
67 ed.addCommand('mceAttributes', function() {
68 ed.windowManager.open({
69 file : url + '/attributes.htm',
70 width : 380,
71 height : 370,
72 inline : 1
73 }, {
74 plugin_url : url
75 });
76 });
77
78 // Register buttons
79 ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});
80 ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});
81 ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});
82 ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});
83 ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});
84 ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});
85
86 if (tinymce.isIE) {
87 function fix(ed, o) {
88 if (o.set) {
89 o.content = o.content.replace(/<abbr([^>]+)>/gi, '<html:abbr $1>');
90 o.content = o.content.replace(/<\/abbr>/gi, '</html:abbr>');
91 }
92 };
93
94 ed.onBeforeSetContent.add(fix);
95 ed.onPostProcess.add(fix);
96 }
97
98 ed.onNodeChange.add(function(ed, cm, n, co) {
99 n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');
100
101 cm.setDisabled('cite', co);
102 cm.setDisabled('acronym', co);
103 cm.setDisabled('abbr', co);
104 cm.setDisabled('del', co);
105 cm.setDisabled('ins', co);
106 cm.setDisabled('attribs', n && n.nodeName == 'BODY');
107 cm.setActive('cite', 0);
108 cm.setActive('acronym', 0);
109 cm.setActive('abbr', 0);
110 cm.setActive('del', 0);
111 cm.setActive('ins', 0);
112
113 // Activate all
114 if (n) {
115 do {
116 cm.setDisabled(n.nodeName.toLowerCase(), 0);
117 cm.setActive(n.nodeName.toLowerCase(), 1);
118 } while (n = n.parentNode);
119 }
120 });
121 },
122
123 getInfo : function() {
124 return {
125 longname : 'XHTML Xtras Plugin',
126 author : 'Moxiecode Systems AB',
127 authorurl : 'http://tinymce.moxiecode.com',
128 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
129 version : tinymce.majorVersion + "." + tinymce.minorVersion
130 };
131 }
132 });
133
134 // Register plugin
135 tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);
136 })();