annotate media/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js @ 247:6ed2932901fa

Update tinymce to 3.3.9
author Brian Neal <bgneal@gmail.com>
date Sat, 18 Sep 2010 19:54:11 +0000
parents 149c3567fec1
children
rev   line source
bgneal@45 1 /**
bgneal@183 2 * editor_plugin_src.js
bgneal@45 3 *
bgneal@183 4 * Copyright 2009, Moxiecode Systems AB
bgneal@183 5 * Released under LGPL License.
bgneal@183 6 *
bgneal@183 7 * License: http://tinymce.moxiecode.com/license
bgneal@183 8 * Contributing: http://tinymce.moxiecode.com/contributing
bgneal@45 9 */
bgneal@45 10
bgneal@45 11 (function() {
bgneal@45 12 tinymce.create('tinymce.plugins.XHTMLXtrasPlugin', {
bgneal@45 13 init : function(ed, url) {
bgneal@45 14 // Register commands
bgneal@45 15 ed.addCommand('mceCite', function() {
bgneal@45 16 ed.windowManager.open({
bgneal@45 17 file : url + '/cite.htm',
bgneal@45 18 width : 350 + parseInt(ed.getLang('xhtmlxtras.cite_delta_width', 0)),
bgneal@45 19 height : 250 + parseInt(ed.getLang('xhtmlxtras.cite_delta_height', 0)),
bgneal@45 20 inline : 1
bgneal@45 21 }, {
bgneal@45 22 plugin_url : url
bgneal@45 23 });
bgneal@45 24 });
bgneal@45 25
bgneal@45 26 ed.addCommand('mceAcronym', function() {
bgneal@45 27 ed.windowManager.open({
bgneal@45 28 file : url + '/acronym.htm',
bgneal@45 29 width : 350 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
bgneal@45 30 height : 250 + parseInt(ed.getLang('xhtmlxtras.acronym_delta_width', 0)),
bgneal@45 31 inline : 1
bgneal@45 32 }, {
bgneal@45 33 plugin_url : url
bgneal@45 34 });
bgneal@45 35 });
bgneal@45 36
bgneal@45 37 ed.addCommand('mceAbbr', function() {
bgneal@45 38 ed.windowManager.open({
bgneal@45 39 file : url + '/abbr.htm',
bgneal@45 40 width : 350 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
bgneal@45 41 height : 250 + parseInt(ed.getLang('xhtmlxtras.abbr_delta_width', 0)),
bgneal@45 42 inline : 1
bgneal@45 43 }, {
bgneal@45 44 plugin_url : url
bgneal@45 45 });
bgneal@45 46 });
bgneal@45 47
bgneal@45 48 ed.addCommand('mceDel', function() {
bgneal@45 49 ed.windowManager.open({
bgneal@45 50 file : url + '/del.htm',
bgneal@45 51 width : 340 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
bgneal@45 52 height : 310 + parseInt(ed.getLang('xhtmlxtras.del_delta_width', 0)),
bgneal@45 53 inline : 1
bgneal@45 54 }, {
bgneal@45 55 plugin_url : url
bgneal@45 56 });
bgneal@45 57 });
bgneal@45 58
bgneal@45 59 ed.addCommand('mceIns', function() {
bgneal@45 60 ed.windowManager.open({
bgneal@45 61 file : url + '/ins.htm',
bgneal@45 62 width : 340 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
bgneal@45 63 height : 310 + parseInt(ed.getLang('xhtmlxtras.ins_delta_width', 0)),
bgneal@45 64 inline : 1
bgneal@45 65 }, {
bgneal@45 66 plugin_url : url
bgneal@45 67 });
bgneal@45 68 });
bgneal@45 69
bgneal@45 70 ed.addCommand('mceAttributes', function() {
bgneal@45 71 ed.windowManager.open({
bgneal@45 72 file : url + '/attributes.htm',
bgneal@45 73 width : 380,
bgneal@45 74 height : 370,
bgneal@45 75 inline : 1
bgneal@45 76 }, {
bgneal@45 77 plugin_url : url
bgneal@45 78 });
bgneal@45 79 });
bgneal@45 80
bgneal@45 81 // Register buttons
bgneal@45 82 ed.addButton('cite', {title : 'xhtmlxtras.cite_desc', cmd : 'mceCite'});
bgneal@45 83 ed.addButton('acronym', {title : 'xhtmlxtras.acronym_desc', cmd : 'mceAcronym'});
bgneal@45 84 ed.addButton('abbr', {title : 'xhtmlxtras.abbr_desc', cmd : 'mceAbbr'});
bgneal@45 85 ed.addButton('del', {title : 'xhtmlxtras.del_desc', cmd : 'mceDel'});
bgneal@45 86 ed.addButton('ins', {title : 'xhtmlxtras.ins_desc', cmd : 'mceIns'});
bgneal@45 87 ed.addButton('attribs', {title : 'xhtmlxtras.attribs_desc', cmd : 'mceAttributes'});
bgneal@45 88
bgneal@45 89 ed.onNodeChange.add(function(ed, cm, n, co) {
bgneal@45 90 n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');
bgneal@45 91
bgneal@45 92 cm.setDisabled('cite', co);
bgneal@45 93 cm.setDisabled('acronym', co);
bgneal@45 94 cm.setDisabled('abbr', co);
bgneal@45 95 cm.setDisabled('del', co);
bgneal@45 96 cm.setDisabled('ins', co);
bgneal@45 97 cm.setDisabled('attribs', n && n.nodeName == 'BODY');
bgneal@45 98 cm.setActive('cite', 0);
bgneal@45 99 cm.setActive('acronym', 0);
bgneal@45 100 cm.setActive('abbr', 0);
bgneal@45 101 cm.setActive('del', 0);
bgneal@45 102 cm.setActive('ins', 0);
bgneal@45 103
bgneal@45 104 // Activate all
bgneal@45 105 if (n) {
bgneal@45 106 do {
bgneal@45 107 cm.setDisabled(n.nodeName.toLowerCase(), 0);
bgneal@45 108 cm.setActive(n.nodeName.toLowerCase(), 1);
bgneal@45 109 } while (n = n.parentNode);
bgneal@45 110 }
bgneal@45 111 });
bgneal@183 112
bgneal@183 113 ed.onPreInit.add(function() {
bgneal@183 114 // Fixed IE issue where it can't handle these elements correctly
bgneal@183 115 ed.dom.create('abbr');
bgneal@183 116 });
bgneal@45 117 },
bgneal@45 118
bgneal@45 119 getInfo : function() {
bgneal@45 120 return {
bgneal@45 121 longname : 'XHTML Xtras Plugin',
bgneal@45 122 author : 'Moxiecode Systems AB',
bgneal@45 123 authorurl : 'http://tinymce.moxiecode.com',
bgneal@45 124 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
bgneal@45 125 version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@45 126 };
bgneal@45 127 }
bgneal@45 128 });
bgneal@45 129
bgneal@45 130 // Register plugin
bgneal@45 131 tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);
bgneal@45 132 })();