annotate media/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js @ 157:78b7e64665ed

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