annotate media/js/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js @ 234:f53eb0aae7a9

Fix #89; avatar caching was broken.
author Brian Neal <bgneal@gmail.com>
date Sun, 01 Aug 2010 22:14:01 +0000
parents 149c3567fec1
children 6ed2932901fa
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 if (tinymce.isIE) {
bgneal@45 90 function fix(ed, o) {
bgneal@45 91 if (o.set) {
bgneal@45 92 o.content = o.content.replace(/<abbr([^>]+)>/gi, '<html:abbr $1>');
bgneal@45 93 o.content = o.content.replace(/<\/abbr>/gi, '</html:abbr>');
bgneal@45 94 }
bgneal@45 95 };
bgneal@45 96
bgneal@45 97 ed.onBeforeSetContent.add(fix);
bgneal@45 98 ed.onPostProcess.add(fix);
bgneal@45 99 }
bgneal@45 100
bgneal@45 101 ed.onNodeChange.add(function(ed, cm, n, co) {
bgneal@45 102 n = ed.dom.getParent(n, 'CITE,ACRONYM,ABBR,DEL,INS');
bgneal@45 103
bgneal@45 104 cm.setDisabled('cite', co);
bgneal@45 105 cm.setDisabled('acronym', co);
bgneal@45 106 cm.setDisabled('abbr', co);
bgneal@45 107 cm.setDisabled('del', co);
bgneal@45 108 cm.setDisabled('ins', co);
bgneal@45 109 cm.setDisabled('attribs', n && n.nodeName == 'BODY');
bgneal@45 110 cm.setActive('cite', 0);
bgneal@45 111 cm.setActive('acronym', 0);
bgneal@45 112 cm.setActive('abbr', 0);
bgneal@45 113 cm.setActive('del', 0);
bgneal@45 114 cm.setActive('ins', 0);
bgneal@45 115
bgneal@45 116 // Activate all
bgneal@45 117 if (n) {
bgneal@45 118 do {
bgneal@45 119 cm.setDisabled(n.nodeName.toLowerCase(), 0);
bgneal@45 120 cm.setActive(n.nodeName.toLowerCase(), 1);
bgneal@45 121 } while (n = n.parentNode);
bgneal@45 122 }
bgneal@45 123 });
bgneal@183 124
bgneal@183 125 ed.onPreInit.add(function() {
bgneal@183 126 // Fixed IE issue where it can't handle these elements correctly
bgneal@183 127 ed.dom.create('abbr');
bgneal@183 128 });
bgneal@45 129 },
bgneal@45 130
bgneal@45 131 getInfo : function() {
bgneal@45 132 return {
bgneal@45 133 longname : 'XHTML Xtras Plugin',
bgneal@45 134 author : 'Moxiecode Systems AB',
bgneal@45 135 authorurl : 'http://tinymce.moxiecode.com',
bgneal@45 136 infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/xhtmlxtras',
bgneal@45 137 version : tinymce.majorVersion + "." + tinymce.minorVersion
bgneal@45 138 };
bgneal@45 139 }
bgneal@45 140 });
bgneal@45 141
bgneal@45 142 // Register plugin
bgneal@45 143 tinymce.PluginManager.add('xhtmlxtras', tinymce.plugins.XHTMLXtrasPlugin);
bgneal@45 144 })();