diff options
| author | hukl <contact@smyck.org> | 2009-02-17 21:54:39 +0100 |
|---|---|---|
| committer | hukl <contact@smyck.org> | 2009-02-17 21:54:39 +0100 |
| commit | f61b5b0597e0c25f084ee67d402f12a43a7a9947 (patch) | |
| tree | 3b4c3f9f38637f1a7ecf703ece4fd3bc4c6e2934 /public/javascripts/tiny_mce/plugins/compat2x | |
| parent | 3d3b786cc43266f6292f5edd25733dbb9bd6ed06 (diff) | |
added tinymce editor for body area of pages
Diffstat (limited to 'public/javascripts/tiny_mce/plugins/compat2x')
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/compat2x/editor_plugin.js | 1 | ||||
| -rwxr-xr-x | public/javascripts/tiny_mce/plugins/compat2x/editor_plugin_src.js | 616 |
2 files changed, 617 insertions, 0 deletions
diff --git a/public/javascripts/tiny_mce/plugins/compat2x/editor_plugin.js b/public/javascripts/tiny_mce/plugins/compat2x/editor_plugin.js new file mode 100755 index 0000000..02a1da8 --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/compat2x/editor_plugin.js | |||
| @@ -0,0 +1 @@ | |||
| (function(){var DOM=tinymce.DOM,Event=tinymce.dom.Event,each=tinymce.each,is=tinymce.is;tinymce.create('tinymce.plugins.Compat2x',{getInfo:function(){return{longname:'Compat2x',author:'Moxiecode Systems AB',authorurl:'http://tinymce.moxiecode.com',infourl:'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x',version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion};}});(function(){tinymce.extend(tinyMCE,{addToLang:function(p,l){each(l,function(v,k){tinyMCE.i18n[(tinyMCE.settings.language||'en')+'.'+(p?p+'_':'')+k]=v;});},getInstanceById:function(n){return this.get(n);}});})();(function(){var EditorManager=tinymce.EditorManager;tinyMCE.instances={};tinyMCE.plugins={};tinymce.PluginManager.onAdd.add(function(pm,n,p){tinyMCE.plugins[n]=p;});tinyMCE.majorVersion=tinymce.majorVersion;tinyMCE.minorVersion=tinymce.minorVersion;tinyMCE.releaseDate=tinymce.releaseDate;tinyMCE.baseURL=tinymce.baseURL;tinyMCE.isIE=tinyMCE.isMSIE=tinymce.isIE||tinymce.isOpera;tinyMCE.isMSIE5=tinymce.isIE;tinyMCE.isMSIE5_0=tinymce.isIE;tinyMCE.isMSIE7=tinymce.isIE;tinyMCE.isGecko=tinymce.isGecko;tinyMCE.isSafari=tinymce.isWebKit;tinyMCE.isOpera=tinymce.isOpera;tinyMCE.isMac=false;tinyMCE.isNS7=false;tinyMCE.isNS71=false;tinyMCE.compat=true;TinyMCE_Engine=tinyMCE;tinymce.extend(tinyMCE,{getParam:function(n,dv){return this.activeEditor.getParam(n,dv);},addEvent:function(e,na,f,sc){tinymce.dom.Event.add(e,na,f,sc||this);},getControlHTML:function(n){return EditorManager.activeEditor.controlManager.createControl(n);},loadCSS:function(u){tinymce.DOM.loadCSS(u);},importCSS:function(doc,u){if(doc==document)this.loadCSS(u);else new tinymce.dom.DOMUtils(doc).loadCSS(u);},log:function(){console.debug.apply(console,arguments);},getLang:function(n,dv){var v=EditorManager.activeEditor.getLang(n.replace(/^lang_/g,''),dv);if(/^[0-9\-.]+$/g.test(v))return parseInt(v);return v;},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.execCommand;},triggerNodeChange:function(){EditorManager.activeEditor.nodeChanged();},regexpReplace:function(in_str,reg_exp,replace_str,opts){var re;if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);},trim:function(s){return tinymce.trim(s);},xmlEncode:function(s){return tinymce.DOM.encode(s);},explode:function(s,d){var o=[];tinymce.each(s.split(d),function(v){if(v!='')o.push(v);});return o;},switchClass:function(id,cls){var b;if(/^mceButton/.test(cls)){b=EditorManager.activeEditor.controlManager.get(id);if(!b)return;switch(cls){case"mceButtonNormal":b.setDisabled(false);b.setActive(false);return;case"mceButtonDisabled":b.setDisabled(true);return;case"mceButtonSelected":b.setActive(true);b.setDisabled(false);return;}}},addCSSClass:function(e,n,b){return tinymce.DOM.addClass(e,n,b);},hasCSSClass:function(e,n){return tinymce.DOM.hasClass(e,n);},removeCSSClass:function(e,n){return tinymce.DOM.removeClass(e,n);},getCSSClasses:function(){var cl=EditorManager.activeEditor.dom.getClasses(),o=[];each(cl,function(c){o.push(c['class']);});return o;},setWindowArg:function(n,v){EditorManager.activeEditor.windowManager.params[n]=v;},getWindowArg:function(n,dv){var wm=EditorManager.activeEditor.windowManager,v;v=wm.getParam(n);if(v==='')return'';return v||wm.getFeature(n)||dv;},getParentNode:function(n,f){return this._getDOM().getParent(n,f);},selectElements:function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.split(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a;},getNodeTree:function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn);},na?na:[]);},getAttrib:function(e,n,dv){return this._getDOM().getAttrib(e,n,dv);},setAttrib:function(e,n,v){return this._getDOM().setAttrib(e,n,v);},getElementsByAttributeValue:function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=[];for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i];}return o;},selectNodes:function(n,f,a){var i;if(!a)a=[];if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a);}return a;},getContent:function(){return EditorManager.activeEditor.getContent();},getParentElement:function(n,na,f){if(na)na=new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$','g');return this._getDOM().getParent(n,function(n){return n.nodeType==1&&(!na||na.test(n.nodeName))&&(!f||f(n));},this.activeEditor.getBody());},importPluginLanguagePack:function(n){tinymce.PluginManager.requireLangPack(n);},getButtonHTML:function(cn,lang,img,c,u,v){var ed=EditorManager.activeEditor;img=img.replace(/\{\$pluginurl\}/g,tinyMCE.pluginURL);img=img.replace(/\{\$themeurl\}/g,tinyMCE.themeURL);lang=lang.replace(/^lang_/g,'');return ed.controlManager.createButton(cn,{title:lang,command:c,ui:u,value:v,scope:this,'class':'compat',image:img});},addSelectAccessibility:function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w;}return false;},accessibleEventHandler:function(e){var elm,win=this._win;e=tinymce.isIE?win.event:e;elm=tinymce.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null;}return true;}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null;}if(e.keyCode==13||e.keyCode==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false;}return true;},cancelEvent:function(e){return tinymce.dom.Event.cancel(e);},handleVisualAid:function(e){EditorManager.activeEditor.addVisual(e);},getAbsPosition:function(n,r){return tinymce.DOM.getPos(n,r);},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s;},getVisualAidClass:function(s){return s;},parseStyle:function(s){return this._getDOM().parseStyle(s);},serializeStyle:function(s){return this._getDOM().serializeStyle(s);},openWindow:function(tpl,args){var ed=EditorManager.activeEditor,o={},n;for(n in tpl)o[n]=tpl[n];tpl=o;args=args||{};tpl.url=new tinymce.util.URI(tinymce.ThemeManager.themeURLs[ed.settings.theme]).toAbsolute(tpl.file);tpl.inline=tpl.inline||args.inline;ed.windowManager.open(tpl,args);},closeWindow:function(win){EditorManager.activeEditor.windowManager.close(win);},getOuterHTML:function(e){return tinymce.DOM.getOuterHTML(e);},setOuterHTML:function(e,h,d){return tinymce.DOM.setOuterHTML(e,h,d);},hasPlugin:function(n){return tinymce.PluginManager.get(n)!=null;},_setEventsEnabled:function(){},addPlugin:function(pn,f){var t=this;function PluginWrapper(ed){tinyMCE.selectedInstance=ed;ed.onInit.add(function(){t.settings=ed.settings;t.settings['base_href']=tinyMCE.documentBasePath;tinyMCE.settings=t.settings;tinyMCE.documentBasePath=ed.documentBasePath;if(f.initInstance)f.initInstance(ed);ed.contentDocument=ed.getDoc();ed.contentWindow=ed.getWin();ed.undoRedo=ed.undoManager;ed.startContent=ed.getContent({format:'raw'});tinyMCE.instances[ed.id]=ed;tinyMCE.loadedFiles=[];});ed.onActivate.add(function(){tinyMCE.settings=ed.settings;tinyMCE.selectedInstance=ed;});if(f.handleNodeChange){ed.onNodeChange.add(function(ed,cm,n){f.handleNodeChange(ed.id,n,0,0,false,!ed.selection.isCollapsed());});}if(f.onChange){ed.onChange.add(function(ed,n){return f.onChange(ed);});}if(f.cleanup){ed.onGetContent.add(function(){});}this.getInfo=function(){return f.getInfo();};this.createControl=function(n){tinyMCE.pluginURL=tinymce.baseURL+'/plugins/'+pn;tinyMCE.themeURL=tinymce.baseURL+'/themes/'+tinyMCE.activeEditor.settings.theme;if(f.getControlHTML)return f.getControlHTML(n);return null;};this.execCommand=function(cmd,ui,val){if(f.execCommand)return f.execCommand(ed.id,ed.getBody(),cmd,ui,val);return false;};};tinymce.PluginManager.add(pn,PluginWrapper);},_getDOM:function(){return tinyMCE.activeEditor?tinyMCE.activeEditor.dom:tinymce.DOM;},convertRelativeToAbsoluteURL:function(b,u){return new tinymce.util.URI(b).toAbsolute(u);},convertAbsoluteURLToRelativeURL:function(b,u){return new tinymce.util.URI(b).toRelative(u);}});tinymce.extend(tinymce.Editor.prototype,{getFocusElement:function(){return this.selection.getNode();},getData:function(n){if(!this.data)this.data=[];if(!this.data[n])this.data[n]=[];return this.data[n];},hasPlugin:function(n){return this.plugins[n]!=null;},getContainerWin:function(){return window;},getHTML:function(raw){return this.getContent({format:raw?'raw':'html'});},setHTML:function(h){this.setContent(h);},getSel:function(){return this.selection.getSel();},getRng:function(){return this.selection.getRng();},isHidden:function(){var s;if(!tinymce.isGecko)return false;s=this.getSel();return(!s||!s.rangeCount||s.rangeCount==0);},translate:function(s){var c=this.settings.language,o;if(!s)return s;o=tinymce.EditorManager.i18n[c+'.'+s]||s.replace(/{\#([^}]+)\}/g,function(a,b){return tinymce.EditorManager.i18n[c+'.'+b]||'{#'+b+'}';});o=o.replace(/{\$lang_([^}]+)\}/g,function(a,b){return tinymce.EditorManager.i18n[c+'.'+b]||'{$lang_'+b+'}';});return o;},repaint:function(){this.execCommand('mceRepaint');}});tinymce.extend(tinymce.dom.Selection.prototype,{getSelectedText:function(){return this.getContent({format:'text'});},getSelectedHTML:function(){return this.getContent({format:'html'});},getFocusElement:function(){return this.getNode();},selectNode:function(node,collapse,select_text_node,to_start){var t=this;t.select(node,select_text_node||0);if(!is(collapse))collapse=true;if(collapse){if(!is(to_start))to_start=true;t.collapse(to_start);}}});}).call(this);tinymce.PluginManager.add('compat2x',tinymce.plugins.Compat2x);})(); \ No newline at end of file | |||
diff --git a/public/javascripts/tiny_mce/plugins/compat2x/editor_plugin_src.js b/public/javascripts/tiny_mce/plugins/compat2x/editor_plugin_src.js new file mode 100755 index 0000000..60d4f2d --- /dev/null +++ b/public/javascripts/tiny_mce/plugins/compat2x/editor_plugin_src.js | |||
| @@ -0,0 +1,616 @@ | |||
| 1 | /** | ||
| 2 | * $Id: editor_plugin_src.js 264 2007-04-26 20:53:09Z spocke $ | ||
| 3 | * | ||
| 4 | * @author Moxiecode | ||
| 5 | * @copyright Copyright © 2004-2008, Moxiecode Systems AB, All rights reserved. | ||
| 6 | */ | ||
| 7 | |||
| 8 | (function() { | ||
| 9 | var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is; | ||
| 10 | |||
| 11 | tinymce.create('tinymce.plugins.Compat2x', { | ||
| 12 | getInfo : function() { | ||
| 13 | return { | ||
| 14 | longname : 'Compat2x', | ||
| 15 | author : 'Moxiecode Systems AB', | ||
| 16 | authorurl : 'http://tinymce.moxiecode.com', | ||
| 17 | infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/compat2x', | ||
| 18 | version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion | ||
| 19 | }; | ||
| 20 | } | ||
| 21 | }); | ||
| 22 | |||
| 23 | (function() { | ||
| 24 | // Extend tinyMCE/EditorManager | ||
| 25 | tinymce.extend(tinyMCE, { | ||
| 26 | addToLang : function(p, l) { | ||
| 27 | each(l, function(v, k) { | ||
| 28 | tinyMCE.i18n[(tinyMCE.settings.language || 'en') + '.' + (p ? p + '_' : '') + k] = v; | ||
| 29 | }); | ||
| 30 | }, | ||
| 31 | |||
| 32 | getInstanceById : function(n) { | ||
| 33 | return this.get(n); | ||
| 34 | } | ||
| 35 | }); | ||
| 36 | })(); | ||
| 37 | |||
| 38 | (function() { | ||
| 39 | var EditorManager = tinymce.EditorManager; | ||
| 40 | |||
| 41 | tinyMCE.instances = {}; | ||
| 42 | tinyMCE.plugins = {}; | ||
| 43 | tinymce.PluginManager.onAdd.add(function(pm, n, p) { | ||
| 44 | tinyMCE.plugins[n] = p; | ||
| 45 | }); | ||
| 46 | |||
| 47 | tinyMCE.majorVersion = tinymce.majorVersion; | ||
| 48 | tinyMCE.minorVersion = tinymce.minorVersion; | ||
| 49 | tinyMCE.releaseDate = tinymce.releaseDate; | ||
| 50 | tinyMCE.baseURL = tinymce.baseURL; | ||
| 51 | tinyMCE.isIE = tinyMCE.isMSIE = tinymce.isIE || tinymce.isOpera; | ||
| 52 | tinyMCE.isMSIE5 = tinymce.isIE; | ||
| 53 | tinyMCE.isMSIE5_0 = tinymce.isIE; | ||
| 54 | tinyMCE.isMSIE7 = tinymce.isIE; | ||
| 55 | tinyMCE.isGecko = tinymce.isGecko; | ||
| 56 | tinyMCE.isSafari = tinymce.isWebKit; | ||
| 57 | tinyMCE.isOpera = tinymce.isOpera; | ||
| 58 | tinyMCE.isMac = false; | ||
| 59 | tinyMCE.isNS7 = false; | ||
| 60 | tinyMCE.isNS71 = false; | ||
| 61 | tinyMCE.compat = true; | ||
| 62 | |||
| 63 | // Extend tinyMCE class | ||
| 64 | TinyMCE_Engine = tinyMCE; | ||
| 65 | tinymce.extend(tinyMCE, { | ||
| 66 | getParam : function(n, dv) { | ||
| 67 | return this.activeEditor.getParam(n, dv); | ||
| 68 | }, | ||
| 69 | |||
| 70 | addEvent : function(e, na, f, sc) { | ||
| 71 | tinymce.dom.Event.add(e, na, f, sc || this); | ||
| 72 | }, | ||
| 73 | |||
| 74 | getControlHTML : function(n) { | ||
| 75 | return EditorManager.activeEditor.controlManager.createControl(n); | ||
| 76 | }, | ||
| 77 | |||
| 78 | loadCSS : function(u) { | ||
| 79 | tinymce.DOM.loadCSS(u); | ||
| 80 | }, | ||
| 81 | |||
| 82 | importCSS : function(doc, u) { | ||
| 83 | if (doc == document) | ||
| 84 | this.loadCSS(u); | ||
| 85 | else | ||
| 86 | new tinymce.dom.DOMUtils(doc).loadCSS(u); | ||
| 87 | }, | ||
| 88 | |||
| 89 | log : function() { | ||
| 90 | console.debug.apply(console, arguments); | ||
| 91 | }, | ||
| 92 | |||
| 93 | getLang : function(n, dv) { | ||
| 94 | var v = EditorManager.activeEditor.getLang(n.replace(/^lang_/g, ''), dv); | ||
| 95 | |||
| 96 | // Is number | ||
| 97 | if (/^[0-9\-.]+$/g.test(v)) | ||
| 98 | return parseInt(v); | ||
| 99 | |||
| 100 | return v; | ||
| 101 | }, | ||
| 102 | |||
| 103 | isInstance : function(o) { | ||
| 104 | return o != null && typeof(o) == "object" && o.execCommand; | ||
| 105 | }, | ||
| 106 | |||
| 107 | triggerNodeChange : function() { | ||
| 108 | EditorManager.activeEditor.nodeChanged(); | ||
| 109 | }, | ||
| 110 | |||
| 111 | regexpReplace : function(in_str, reg_exp, replace_str, opts) { | ||
| 112 | var re; | ||
| 113 | |||
| 114 | if (in_str == null) | ||
| 115 | return in_str; | ||
| 116 | |||
| 117 | if (typeof(opts) == "undefined") | ||
| 118 | opts = 'g'; | ||
| 119 | |||
| 120 | re = new RegExp(reg_exp, opts); | ||
| 121 | |||
| 122 | return in_str.replace(re, replace_str); | ||
| 123 | }, | ||
| 124 | |||
| 125 | trim : function(s) { | ||
| 126 | return tinymce.trim(s); | ||
| 127 | }, | ||
| 128 | |||
| 129 | xmlEncode : function(s) { | ||
| 130 | return tinymce.DOM.encode(s); | ||
| 131 | }, | ||
| 132 | |||
| 133 | explode : function(s, d) { | ||
| 134 | var o = []; | ||
| 135 | |||
| 136 | tinymce.each(s.split(d), function(v) { | ||
| 137 | if (v != '') | ||
| 138 | o.push(v); | ||
| 139 | }); | ||
| 140 | |||
| 141 | return o; | ||
| 142 | }, | ||
| 143 | |||
| 144 | switchClass : function(id, cls) { | ||
| 145 | var b; | ||
| 146 | |||
| 147 | if (/^mceButton/.test(cls)) { | ||
| 148 | b = EditorManager.activeEditor.controlManager.get(id); | ||
| 149 | |||
| 150 | if (!b) | ||
| 151 | return; | ||
| 152 | |||
| 153 | switch (cls) { | ||
| 154 | case "mceButtonNormal": | ||
| 155 | b.setDisabled(false); | ||
| 156 | b.setActive(false); | ||
| 157 | return; | ||
| 158 | |||
| 159 | case "mceButtonDisabled": | ||
| 160 | b.setDisabled(true); | ||
| 161 | return; | ||
| 162 | |||
| 163 | case "mceButtonSelected": | ||
| 164 | b.setActive(true); | ||
| 165 | b.setDisabled(false); | ||
| 166 | return; | ||
| 167 | } | ||
| 168 | } | ||
| 169 | }, | ||
| 170 | |||
| 171 | addCSSClass : function(e, n, b) { | ||
| 172 | return tinymce.DOM.addClass(e, n, b); | ||
| 173 | }, | ||
| 174 | |||
| 175 | hasCSSClass : function(e, n) { | ||
| 176 | return tinymce.DOM.hasClass(e, n); | ||
| 177 | }, | ||
| 178 | |||
| 179 | removeCSSClass : function(e, n) { | ||
| 180 | return tinymce.DOM.removeClass(e, n); | ||
| 181 | }, | ||
| 182 | |||
| 183 | getCSSClasses : function() { | ||
| 184 | var cl = EditorManager.activeEditor.dom.getClasses(), o = []; | ||
| 185 | |||
| 186 | each(cl, function(c) { | ||
| 187 | o.push(c['class']); | ||
| 188 | }); | ||
| 189 | |||
| 190 | return o; | ||
| 191 | }, | ||
| 192 | |||
| 193 | setWindowArg : function(n, v) { | ||
| 194 | EditorManager.activeEditor.windowManager.params[n] = v; | ||
| 195 | }, | ||
| 196 | |||
| 197 | getWindowArg : function(n, dv) { | ||
| 198 | var wm = EditorManager.activeEditor.windowManager, v; | ||
| 199 | |||
| 200 | v = wm.getParam(n); | ||
| 201 | if (v === '') | ||
| 202 | return ''; | ||
| 203 | |||
| 204 | return v || wm.getFeature(n) || dv; | ||
| 205 | }, | ||
| 206 | |||
| 207 | getParentNode : function(n, f) { | ||
| 208 | return this._getDOM().getParent(n, f); | ||
| 209 | }, | ||
| 210 | |||
| 211 | selectElements : function(n, na, f) { | ||
| 212 | var i, a = [], nl, x; | ||
| 213 | |||
| 214 | for (x=0, na = na.split(','); x<na.length; x++) | ||
| 215 | for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++) | ||
| 216 | (!f || f(nl[i])) && a.push(nl[i]); | ||
| 217 | |||
| 218 | return a; | ||
| 219 | }, | ||
| 220 | |||
| 221 | getNodeTree : function(n, na, t, nn) { | ||
| 222 | return this.selectNodes(n, function(n) { | ||
| 223 | return (!t || n.nodeType == t) && (!nn || n.nodeName == nn); | ||
| 224 | }, na ? na : []); | ||
| 225 | }, | ||
| 226 | |||
| 227 | getAttrib : function(e, n, dv) { | ||
| 228 | return this._getDOM().getAttrib(e, n, dv); | ||
| 229 | }, | ||
| 230 | |||
| 231 | setAttrib : function(e, n, v) { | ||
| 232 | return this._getDOM().setAttrib(e, n, v); | ||
| 233 | }, | ||
| 234 | |||
| 235 | getElementsByAttributeValue : function(n, e, a, v) { | ||
| 236 | var i, nl = n.getElementsByTagName(e), o = []; | ||
| 237 | |||
| 238 | for (i=0; i<nl.length; i++) { | ||
| 239 | if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1) | ||
| 240 | o[o.length] = nl[i]; | ||
| 241 | } | ||
| 242 | |||
| 243 | return o; | ||
| 244 | }, | ||
| 245 | |||
| 246 | selectNodes : function(n, f, a) { | ||
| 247 | var i; | ||
| 248 | |||
| 249 | if (!a) | ||
| 250 | a = []; | ||
| 251 | |||
| 252 | if (f(n)) | ||
| 253 | a[a.length] = n; | ||
| 254 | |||
| 255 | if (n.hasChildNodes()) { | ||
| 256 | for (i=0; i<n.childNodes.length; i++) | ||
| 257 | tinyMCE.selectNodes(n.childNodes[i], f, a); | ||
| 258 | } | ||
| 259 | |||
| 260 | return a; | ||
| 261 | }, | ||
| 262 | |||
| 263 | getContent : function() { | ||
| 264 | return EditorManager.activeEditor.getContent(); | ||
| 265 | }, | ||
| 266 | |||
| 267 | getParentElement : function(n, na, f) { | ||
| 268 | if (na) | ||
| 269 | na = new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$', 'g'); | ||
| 270 | |||
| 271 | return this._getDOM().getParent(n, function(n) { | ||
| 272 | return n.nodeType == 1 && (!na || na.test(n.nodeName)) && (!f || f(n)); | ||
| 273 | }, this.activeEditor.getBody()); | ||
| 274 | }, | ||
| 275 | |||
| 276 | importPluginLanguagePack : function(n) { | ||
| 277 | tinymce.PluginManager.requireLangPack(n); | ||
| 278 | }, | ||
| 279 | |||
| 280 | getButtonHTML : function(cn, lang, img, c, u, v) { | ||
| 281 | var ed = EditorManager.activeEditor; | ||
| 282 | |||
| 283 | img = img.replace(/\{\$pluginurl\}/g, tinyMCE.pluginURL); | ||
| 284 | img = img.replace(/\{\$themeurl\}/g, tinyMCE.themeURL); | ||
| 285 | lang = lang.replace(/^lang_/g, ''); | ||
| 286 | |||
| 287 | return ed.controlManager.createButton(cn, { | ||
| 288 | title : lang, | ||
| 289 | command : c, | ||
| 290 | ui : u, | ||
| 291 | value : v, | ||
| 292 | scope : this, | ||
| 293 | 'class' : 'compat', | ||
| 294 | image : img | ||
| 295 | }); | ||
| 296 | }, | ||
| 297 | |||
| 298 | addSelectAccessibility : function(e, s, w) { | ||
| 299 | // Add event handlers | ||
| 300 | if (!s._isAccessible) { | ||
| 301 | s.onkeydown = tinyMCE.accessibleEventHandler; | ||
| 302 | s.onblur = tinyMCE.accessibleEventHandler; | ||
| 303 | s._isAccessible = true; | ||
| 304 | s._win = w; | ||
| 305 | } | ||
| 306 | |||
| 307 | return false; | ||
| 308 | }, | ||
| 309 | |||
| 310 | accessibleEventHandler : function(e) { | ||
| 311 | var elm, win = this._win; | ||
| 312 | |||
| 313 | e = tinymce.isIE ? win.event : e; | ||
| 314 | elm = tinymce.isIE ? e.srcElement : e.target; | ||
| 315 | |||
| 316 | // Unpiggyback onchange on blur | ||
| 317 | if (e.type == "blur") { | ||
| 318 | if (elm.oldonchange) { | ||
| 319 | elm.onchange = elm.oldonchange; | ||
| 320 | elm.oldonchange = null; | ||
| 321 | } | ||
| 322 | |||
| 323 | return true; | ||
| 324 | } | ||
| 325 | |||
| 326 | // Piggyback onchange | ||
| 327 | if (elm.nodeName == "SELECT" && !elm.oldonchange) { | ||
| 328 | elm.oldonchange = elm.onchange; | ||
| 329 | elm.onchange = null; | ||
| 330 | } | ||
| 331 | |||
| 332 | // Execute onchange and remove piggyback | ||
| 333 | if (e.keyCode == 13 || e.keyCode == 32) { | ||
| 334 | elm.onchange = elm.oldonchange; | ||
| 335 | elm.onchange(); | ||
| 336 | elm.oldonchange = null; | ||
| 337 | |||
| 338 | tinyMCE.cancelEvent(e); | ||
| 339 | return false; | ||
| 340 | } | ||
| 341 | |||
| 342 | return true; | ||
| 343 | }, | ||
| 344 | |||
| 345 | cancelEvent : function(e) { | ||
| 346 | return tinymce.dom.Event.cancel(e); | ||
| 347 | }, | ||
| 348 | |||
| 349 | handleVisualAid : function(e) { | ||
| 350 | EditorManager.activeEditor.addVisual(e); | ||
| 351 | }, | ||
| 352 | |||
| 353 | getAbsPosition : function(n, r) { | ||
| 354 | return tinymce.DOM.getPos(n, r); | ||
| 355 | }, | ||
| 356 | |||
| 357 | cleanupEventStr : function(s) { | ||
| 358 | s = "" + s; | ||
| 359 | s = s.replace('function anonymous()\n{\n', ''); | ||
| 360 | s = s.replace('\n}', ''); | ||
| 361 | s = s.replace(/^return true;/gi, ''); // Remove event blocker | ||
| 362 | |||
| 363 | return s; | ||
| 364 | }, | ||
| 365 | |||
| 366 | getVisualAidClass : function(s) { | ||
| 367 | // TODO: Implement | ||
| 368 | return s; | ||
| 369 | }, | ||
| 370 | |||
| 371 | parseStyle : function(s) { | ||
| 372 | return this._getDOM().parseStyle(s); | ||
| 373 | }, | ||
| 374 | |||
| 375 | serializeStyle : function(s) { | ||
| 376 | return this._getDOM().serializeStyle(s); | ||
| 377 | }, | ||
| 378 | |||
| 379 | openWindow : function(tpl, args) { | ||
| 380 | var ed = EditorManager.activeEditor, o = {}, n; | ||
| 381 | |||
| 382 | // Convert name/value array to object | ||
| 383 | for (n in tpl) | ||
| 384 | o[n] = tpl[n]; | ||
| 385 | |||
| 386 | tpl = o; | ||
| 387 | |||
| 388 | args = args || {}; | ||
| 389 | tpl.url = new tinymce.util.URI(tinymce.ThemeManager.themeURLs[ed.settings.theme]).toAbsolute(tpl.file); | ||
| 390 | tpl.inline = tpl.inline || args.inline; | ||
| 391 | |||
| 392 | ed.windowManager.open(tpl, args); | ||
| 393 | }, | ||
| 394 | |||
| 395 | closeWindow : function(win) { | ||
| 396 | EditorManager.activeEditor.windowManager.close(win); | ||
| 397 | }, | ||
| 398 | |||
| 399 | getOuterHTML : function(e) { | ||
| 400 | return tinymce.DOM.getOuterHTML(e); | ||
| 401 | }, | ||
| 402 | |||
| 403 | setOuterHTML : function(e, h, d) { | ||
| 404 | return tinymce.DOM.setOuterHTML(e, h, d); | ||
| 405 | }, | ||
| 406 | |||
| 407 | hasPlugin : function(n) { | ||
| 408 | return tinymce.PluginManager.get(n) != null; | ||
| 409 | }, | ||
| 410 | |||
| 411 | _setEventsEnabled : function() { | ||
| 412 | // Ignore it!! | ||
| 413 | }, | ||
| 414 | |||
| 415 | addPlugin : function(pn, f) { | ||
| 416 | var t = this; | ||
| 417 | |||
| 418 | function PluginWrapper(ed) { | ||
| 419 | tinyMCE.selectedInstance = ed; | ||
| 420 | |||
| 421 | ed.onInit.add(function() { | ||
| 422 | t.settings = ed.settings; | ||
| 423 | t.settings['base_href'] = tinyMCE.documentBasePath; | ||
| 424 | tinyMCE.settings = t.settings; | ||
| 425 | tinyMCE.documentBasePath = ed.documentBasePath; | ||
| 426 | //ed.formElement = DOM.get(ed.id); | ||
| 427 | |||
| 428 | if (f.initInstance) | ||
| 429 | f.initInstance(ed); | ||
| 430 | |||
| 431 | ed.contentDocument = ed.getDoc(); | ||
| 432 | ed.contentWindow = ed.getWin(); | ||
| 433 | ed.undoRedo = ed.undoManager; | ||
| 434 | ed.startContent = ed.getContent({format : 'raw'}); | ||
| 435 | |||
| 436 | tinyMCE.instances[ed.id] = ed; | ||
| 437 | tinyMCE.loadedFiles = []; | ||
| 438 | }); | ||
| 439 | |||
| 440 | ed.onActivate.add(function() { | ||
| 441 | tinyMCE.settings = ed.settings; | ||
| 442 | tinyMCE.selectedInstance = ed; | ||
| 443 | }); | ||
| 444 | |||
| 445 | /* if (f.removeInstance) { | ||
| 446 | ed.onDestroy.add(function() { | ||
| 447 | return f.removeInstance(ed.id); | ||
| 448 | }); | ||
| 449 | }*/ | ||
| 450 | |||
| 451 | if (f.handleNodeChange) { | ||
| 452 | ed.onNodeChange.add(function(ed, cm, n) { | ||
| 453 | f.handleNodeChange(ed.id, n, 0, 0, false, !ed.selection.isCollapsed()); | ||
| 454 | }); | ||
| 455 | } | ||
| 456 | |||
| 457 | if (f.onChange) { | ||
| 458 | ed.onChange.add(function(ed, n) { | ||
| 459 | return f.onChange(ed); | ||
| 460 | }); | ||
| 461 | } | ||
| 462 | |||
| 463 | if (f.cleanup) { | ||
| 464 | ed.onGetContent.add(function() { | ||
| 465 | //f.cleanup(type, content, inst); | ||
| 466 | }); | ||
| 467 | } | ||
| 468 | |||
| 469 | this.getInfo = function() { | ||
| 470 | return f.getInfo(); | ||
| 471 | }; | ||
| 472 | |||
| 473 | this.createControl = function(n) { | ||
| 474 | tinyMCE.pluginURL = tinymce.baseURL + '/plugins/' + pn; | ||
| 475 | tinyMCE.themeURL = tinymce.baseURL + '/themes/' + tinyMCE.activeEditor.settings.theme; | ||
| 476 | |||
| 477 | if (f.getControlHTML) | ||
| 478 | return f.getControlHTML(n); | ||
| 479 | |||
| 480 | return null; | ||
| 481 | }; | ||
| 482 | |||
| 483 | this.execCommand = function(cmd, ui, val) { | ||
| 484 | if (f.execCommand) | ||
| 485 | return f.execCommand(ed.id, ed.getBody(), cmd, ui, val); | ||
| 486 | |||
| 487 | return false; | ||
| 488 | }; | ||
| 489 | }; | ||
| 490 | |||
| 491 | tinymce.PluginManager.add(pn, PluginWrapper); | ||
| 492 | }, | ||
| 493 | |||
| 494 | _getDOM : function() { | ||
| 495 | return tinyMCE.activeEditor ? tinyMCE.activeEditor.dom : tinymce.DOM; | ||
| 496 | }, | ||
| 497 | |||
| 498 | convertRelativeToAbsoluteURL : function(b, u) { | ||
| 499 | return new tinymce.util.URI(b).toAbsolute(u); | ||
| 500 | }, | ||
| 501 | |||
| 502 | convertAbsoluteURLToRelativeURL : function(b, u) { | ||
| 503 | return new tinymce.util.URI(b).toRelative(u); | ||
| 504 | } | ||
| 505 | }); | ||
| 506 | |||
| 507 | // Extend Editor class | ||
| 508 | tinymce.extend(tinymce.Editor.prototype, { | ||
| 509 | getFocusElement : function() { | ||
| 510 | return this.selection.getNode(); | ||
| 511 | }, | ||
| 512 | |||
| 513 | getData : function(n) { | ||
| 514 | if (!this.data) | ||
| 515 | this.data = []; | ||
| 516 | |||
| 517 | if (!this.data[n]) | ||
| 518 | this.data[n] = []; | ||
| 519 | |||
| 520 | return this.data[n]; | ||
| 521 | }, | ||
| 522 | |||
| 523 | hasPlugin : function(n) { | ||
| 524 | return this.plugins[n] != null; | ||
| 525 | }, | ||
| 526 | |||
| 527 | getContainerWin : function() { | ||
| 528 | return window; | ||
| 529 | }, | ||
| 530 | |||
| 531 | getHTML : function(raw) { | ||
| 532 | return this.getContent({ format : raw ? 'raw' : 'html'}); | ||
| 533 | }, | ||
| 534 | |||
| 535 | setHTML : function(h) { | ||
| 536 | this.setContent(h); | ||
| 537 | }, | ||
| 538 | |||
| 539 | getSel : function() { | ||
| 540 | return this.selection.getSel(); | ||
| 541 | }, | ||
| 542 | |||
| 543 | getRng : function() { | ||
| 544 | return this.selection.getRng(); | ||
| 545 | }, | ||
| 546 | |||
| 547 | isHidden : function() { | ||
| 548 | var s; | ||
| 549 | |||
| 550 | if (!tinymce.isGecko) | ||
| 551 | return false; | ||
| 552 | |||
| 553 | s = this.getSel(); | ||
| 554 | |||
| 555 | // Weird, wheres that cursor selection? | ||
| 556 | return (!s || !s.rangeCount || s.rangeCount == 0); | ||
| 557 | }, | ||
| 558 | |||
| 559 | translate : function(s) { | ||
| 560 | var c = this.settings.language, o; | ||
| 561 | |||
| 562 | if (!s) | ||
| 563 | return s; | ||
| 564 | |||
| 565 | o = tinymce.EditorManager.i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) { | ||
| 566 | return tinymce.EditorManager.i18n[c + '.' + b] || '{#' + b + '}'; | ||
| 567 | }); | ||
| 568 | |||
| 569 | o = o.replace(/{\$lang_([^}]+)\}/g, function(a, b) { | ||
| 570 | return tinymce.EditorManager.i18n[c + '.' + b] || '{$lang_' + b + '}'; | ||
| 571 | }); | ||
| 572 | |||
| 573 | return o; | ||
| 574 | }, | ||
| 575 | |||
| 576 | repaint : function() { | ||
| 577 | this.execCommand('mceRepaint'); | ||
| 578 | } | ||
| 579 | }); | ||
| 580 | |||
| 581 | // Extend selection | ||
| 582 | tinymce.extend(tinymce.dom.Selection.prototype, { | ||
| 583 | getSelectedText : function() { | ||
| 584 | return this.getContent({format : 'text'}); | ||
| 585 | }, | ||
| 586 | |||
| 587 | getSelectedHTML : function() { | ||
| 588 | return this.getContent({format : 'html'}); | ||
| 589 | }, | ||
| 590 | |||
| 591 | getFocusElement : function() { | ||
| 592 | return this.getNode(); | ||
| 593 | }, | ||
| 594 | |||
| 595 | selectNode : function(node, collapse, select_text_node, to_start) { | ||
| 596 | var t = this; | ||
| 597 | |||
| 598 | t.select(node, select_text_node || 0); | ||
| 599 | |||
| 600 | if (!is(collapse)) | ||
| 601 | collapse = true; | ||
| 602 | |||
| 603 | if (collapse) { | ||
| 604 | if (!is(to_start)) | ||
| 605 | to_start = true; | ||
| 606 | |||
| 607 | t.collapse(to_start); | ||
| 608 | } | ||
| 609 | } | ||
| 610 | }); | ||
| 611 | }).call(this); | ||
| 612 | |||
| 613 | // Register plugin | ||
| 614 | tinymce.PluginManager.add('compat2x', tinymce.plugins.Compat2x); | ||
| 615 | })(); | ||
| 616 | |||
