4 * Copyright 2009, Moxiecode Systems AB
5 * Released under LGPL License.
7 * License: http://tinymce.moxiecode.com/license
8 * Contributing: http://tinymce.moxiecode.com/contributing
12 tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', {
13 init : function(ed, url) {
15 ed.addCommand('mceCite', function() {
16 ed.windowManager.open({
17 file : url + '/cite.htm',
18 width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),
19 height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),
26 ed.addCommand('mceAcronym', function() {
27 ed.windowManager.open({
28 file : url + '/acronym.htm',
29 width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
30 height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_height', 0)),
37 ed.addCommand('mceAbbr', function() {
38 ed.windowManager.open({
39 file : url + '/abbr.htm',
40 width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
41 height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_height', 0)),
48 ed.addCommand('mceDel', function() {
49 ed.windowManager.open({
50 file : url + '/del.htm',
51 width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
52 height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_height', 0)),
59 ed.addCommand('mceIns', function() {
60 ed.windowManager.open({
61 file : url + '/ins.htm',
62 width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
63 height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_height', 0)),
70 ed.addCommand('mceAttributes', function() {
71 ed.windowManager.open({
72 file : url + '/attributes.htm',
73 width : 380 + parseInt(ed.getLang('xhtmlxtras.attr_delta_width', 0)),
74 height : 370 + parseInt(ed.getLang('xhtmlxtras.attr_delta_height', 0)),
82 ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});
83 ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});
84 ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});
85 ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});
86 ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});
87 ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});
89 ed.onNodeChange.add(function(ed, cm, n, co) {
90 n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');
92 cm.setDisabled('cite', co);
93 cm.setDisabled('acronym', co);
94 cm.setDisabled('abbr', co);
95 cm.setDisabled('del', co);
96 cm.setDisabled('ins', co);
97 cm.setDisabled('attribs', n && n.nodeName == 'BODY');
98 cm.setActive('cite', 0);
99 cm.setActive('acronym', 0);
100 cm.setActive('abbr', 0);
101 cm.setActive('del', 0);
102 cm.setActive('ins', 0);
107 cm.setDisabled(n.nodeName.toLowerCase(), 0);
108 cm.setActive(n.nodeName.toLowerCase(), 1);
109 } while (n = n.parentNode);
113 ed.onPreInit.add(function() {
114 // Fixed IE issue where it can't handle these elements correctly
115 ed.dom.create('abbr');
119 getInfo : function() {
121 longname : 'XHTML Xtras Plugin',
122 author : 'Moxiecode Systems AB',
123 authorurl : 'http://tinymce.moxiecode.com',
124 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
125 version : tinymce.majorVersion + "." + tinymce.minorVersion
131 tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);