{$lang_insert_link_target}:
- {$lang_insert_link_target_same}
+ {$lang_insert_link_target_same}
{$lang_insert_link_target_blank}
-
+
+ {$lang_theme_code_title}
+
+
-
-
+
+
+ {$lang_theme_code_title}
+
+
+
+
+
+
+
+
+
diff --git a/wp-includes/js/tinymce/tiny_mce.js b/wp-includes/js/tinymce/tiny_mce.js
index 144856db5c..301e129721 100644
--- a/wp-includes/js/tinymce/tiny_mce.js
+++ b/wp-includes/js/tinymce/tiny_mce.js
@@ -1,12 +1,11 @@
/**
- * $RCSfile: tiny_mce.js,v $
- * $Revision: 1.256 $
- * $Date: 2005/06/23 12:04:39 $
+ * $RCSfile: tiny_mce_src.js,v $
+ * $Revision: 1.233 $
+ * $Date: 2005/08/26 15:20:32 $
*
* @author Moxiecode
* @copyright Copyright 2004, Moxiecode Systems AB, All rights reserved.
*/
- function TinyMCE(){this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.dialogCounter=0;this.idCounter=0;};TinyMCE.prototype.defParam=function(key,def_val){this.settings[key]=tinyMCE.getParam(key,def_val);};TinyMCE.prototype.init=function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i ');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,css_file){if(tinyMCE.isMSIE)var styleSheet=doc.createStyleSheet(css_file);else{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head"))headArr[0].appendChild(elm);}};TinyMCE.prototype.confirmAdd=function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm']))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');};TinyMCE.prototype.updateContent=function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(doc,this.settings,doc.body,inst.visualAid);}}};TinyMCE.prototype.addMCEControl=function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCEControl(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst.onAdd(replace_element,form_element_name,target_document);};TinyMCE.prototype.triggerSave=function(skip_cleanup,skip_callback){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(inst.getDoc(),inst.getBody().innerHTML);var htm=skip_cleanup?inst.getBody().innerHTML:tinyMCE._cleanupHTML(inst.getDoc(),this.settings,inst.getBody(),this.visualAid,true);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html")htm=tinyMCE.convertStringToXML(htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(inst.formTargetElementId,htm,inst.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"(","(","gi");htm=tinyMCE.regexpReplace(htm,")",")","gi");htm=tinyMCE.regexpReplace(htm,";",";","gi");htm=tinyMCE.regexpReplace(htm,""",""","gi");htm=tinyMCE.regexpReplace(htm,"^","^","gi");if(inst.formElement)inst.formElement.value=htm;}};TinyMCE.prototype._convertOnClick=function(node){if(tinyMCE.isMSIE5)return;var elms=node.getElementsByTagName("a");for(var i=0;i ","gi");content=tinyMCE.regexpReplace(content,"\r"," ","gi");content=tinyMCE.regexpReplace(content,"\n"," ","gi");}content=tinyMCE._customCleanup("insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(document.frames["'+editor_id+'"].document, "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])document.frames[editor_id].document.styleSheets[0].addRule("p","margin: 0px;");var body=document.frames[editor_id].document.body;tinyMCE.addEvent(body,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"beforecut",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"paste",TinyMCE.prototype.eventPatch);body.editorId=editor_id;}if(!tinyMCE.isMSIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings['force_p_newlines'])content=content.replace(new RegExp('<>','g'),"");if(tinyMCE.settings['cleanup_on_startup'])inst.getBody().innerHTML=tinyMCE._cleanupHTML(doc,this.settings,contentElement);else{content=tinyMCE.regexpReplace(content,"","","gi");content=tinyMCE.regexpReplace(content,"","","gi");inst.getBody().innerHTML=content;}inst.convertAllRelativeURLs();}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');}else tinyMCE._setHTML(inst.getDoc(),content);}tinyMCE._convertOnClick(inst.getBody());var parentElm=document.getElementById(inst.editorId+'_parent');if(parentElm.lastChild.nodeName.toLowerCase()=="input")inst.formElement=parentElm.lastChild;else inst.formElement=parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual']);tinyMCE.executeCallback('setupcontent_callback','_setupContent',0,editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)TinyMCE.prototype.addEventHandlers(editor_id);inst.startContent=inst.getBody().innerHTML;tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);tinyMCE._customCleanup("insert_to_editor_dom",inst.contentWindow.document.body);};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE.prototype.removeTinyMCEFormElements=function(form_obj){for(var i=0;i ");rng.collapse(false);rng.select();tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual']);if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86)tinyMCE.selectedInstance.fixBrokenURLs();if(tinyMCE.isMSIE&&tinyMCE.settings['custom_undo_redo']){var keys=new Array(13,45,36,35,33,34,37,38,39,40);var posKey=false;for(var i=0;i18&&e.keyCode!=255)){tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");tinyMCE.selectedInstance.typing=true;tinyMCE.triggerNodeChange(false);}if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);var keys=new Array(8,46);for(var i=0;i0){for(var i=0;i"+this.convertStringToXML(String.fromCharCode(160))+""+elementName+">";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+""+elementName+">";if(node.hasChildNodes()){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="";else output+="<"+elementName+elementAttribs+">";for(var i=0;i
";else output+=""+elementName+">";}else{if(openTag)output+="<"+elementName+elementAttribs+">"+elementName+">";else{output+="<"+elementName+elementAttribs+" />";}}return output;case 3:if(node.parentNode.nodeName.toLowerCase()=="script")return node.nodeValue;return this.convertStringToXML(node.nodeValue);case 8:return "";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i127)output+=''+chr+";";else output+=String.fromCharCode(chr);continue;}if(tinyMCE.settings['entity_encoding']=="raw"){output+=String.fromCharCode(chr);continue;}if(typeof(tinyMCE.cleanup_entities["c"+chr])!='undefined'&&tinyMCE.cleanup_entities["c"+chr]!='')output+='&'+tinyMCE.cleanup_entities["c"+chr]+';';else output+=''+String.fromCharCode(chr);}return output;};TinyMCE.prototype._getCleanupElementName=function(chunk){var pos;if(chunk.charAt(0)=='+')chunk=chunk.substring(1);if((pos=chunk.indexOf('/'))!=-1)chunk=chunk.substring(0,pos);if((pos=chunk.indexOf('['))!=-1)chunk=chunk.substring(0,pos);return chunk;};TinyMCE.prototype._initCleanup=function(){var validElements=tinyMCE.settings["valid_elements"];validElements=validElements.split(',');var extendedValidElements=tinyMCE.settings["extended_valid_elements"];extendedValidElements=extendedValidElements.split(',');for(var i=0;i[ \n\r]* [ \n\r]*',' ','gi');element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'','','gi');}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])alert("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,'
',' ');html=tinyMCE.regexpReplace(html,'
',' ');if(!tinyMCE.isMSIE)html=html.replace(new RegExp(' ','g'),"");if(tinyMCE.settings['apply_source_formatting']){html=html.replace(new RegExp('<(p|div)([^>]*)>','g'),"\n<$1$2>\n");html=html.replace(new RegExp('<\/(p|div)([^>]*)>','g'),"\n$1$2>\n");html=html.replace(new RegExp(' ','g')," \n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp('
','g');html=html.replace(re," ");}if(tinyMCE.settings['force_p_newlines']){var re=new RegExp('<>','g');html=html.replace(re,"");}if(tinyMCE.settings['remove_linebreaks'])html=html.replace(new RegExp('\r|\n','g'),' ');html=tinyMCE._customCleanup(on_save?"get_from_editor":"insert_to_editor",html);var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","").toLowerCase();if(chk==" "||chk==" "||chk=="
"||chk=="
"||chk=="
")html="";if(tinyMCE.settings["preformatted"])return ""+html+" ";return html;};TinyMCE.prototype.setAttrib=function(element,name,value,no_fix_value){if(!no_fix_value&&value!=null){var re=new RegExp('[^0-9%]','g');value=value.replace(re,'');}if(value!=null&&value!="")element.setAttribute(name,value);else element.removeAttribute(name);if(value!=null&&value!="")element.setAttribute(name,value);else element.removeAttribute(name);};TinyMCE.prototype.insertLink=function(href,target,title,onclick,style_class){this.execCommand("mceAddUndoLevel");if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(this.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}href=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");tinyMCE.setAttrib(linkElement,'href',href);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'mce_onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(linkElement,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,''+this.selectedInstance.getSelectedHTML()+' ');}else this.selectedInstance.contentDocument.execCommand("createlink",false,"#mce_temp_url#");tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");var elementArray=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");for(var i=0;i ';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,' ');else this.selectedInstance.contentDocument.execCommand("insertimage",false,"#mce_temp_url#");tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src","#mce_temp_url#");}}if(this.imgElement){var needsRepaint=false;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=this.imgElement.getAttribute("width")||height!=this.imgElement.getAttribute("height")||align!=this.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(this.imgElement,'src',src);tinyMCE.setAttrib(this.imgElement,'mce_real_src',src);tinyMCE.setAttrib(this.imgElement,'alt',alt);tinyMCE.setAttrib(this.imgElement,'title',title);tinyMCE.setAttrib(this.imgElement,'align',align);tinyMCE.setAttrib(this.imgElement,'border',border,true);tinyMCE.setAttrib(this.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(this.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(this.imgElement,'width',width,true);tinyMCE.setAttrib(this.imgElement,'height',height,true);tinyMCE.setAttrib(this.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(this.imgElement,'onmouseout',onmouseout);if(width&&width!="")this.imgElement.style.pixelWidth=width;if(height&&height!="")this.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}};TinyMCE.prototype.getElementByAttributeValue=function(node,element_name,attrib,value){var elements=this.getElementsByAttributeValue(node,element_name,attrib,value);if(elements.length==0)return null;return elements[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,element_name,attrib,value){var elements=new Array();if(node&&node.nodeName.toLowerCase()==element_name){if(node.getAttribute(attrib)&&node.getAttribute(attrib).indexOf(value)!=-1)elements[elements.length]=node;}if(node.hasChildNodes){for(var x=0,n=node.childNodes.length;x=strTok2.length){for(var i=0;i=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return url_to_relative;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outputString+="../";for(var i=breakPoint-1;i=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";if(baseURL['protocol'])start+=baseURL['protocol']+"://";if(baseURL['host'])start+=baseURL['host'];if(baseURL['port'])start+=":"+baseURL['port'];if(relURL['query'])end+="?"+relURL['query'];if(relURL['anchor'])end+="#"+relURL['anchor'];if(relative_url.charAt(relative_url.length-1)=="/")end+="/";return start+absPath+end;};TinyMCE.prototype.getParam=function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoIndex;undoLevels=inst.undoLevels.length;}tinyMCE.executeCallback('handleNodeChangeCallback','_handleNodeChange',0,editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection);}}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();};TinyMCE.prototype._customCleanup=function(type,content){var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content);");var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i ';div.innerHTML=html;document.body.appendChild(div);tinyMCE._currentDialog=id;}}}};TinyMCE.prototype.closeDialog=function(){if(tinyMCE.settings["dialog_type"]=="div"){var div=document.getElementById(tinyMCE._currentDialog);if(div)div.parentNode.removeChild(div);}else window.close();};TinyMCE.prototype.getVisualAidClass=function(class_name,state){var aidClass=tinyMCE.settings['visual_table_class'];if(typeof(state)=="undefined")state=tinyMCE.settings['visual'];var classNames=new Array();var ar=class_name.split(' ');for(var i=0;i0)className+=" ";className+=classNames[i];}return className;};TinyMCE.prototype.handleVisualAid=function(element,deep,state){if(!element)return;var tableElement=null;switch(element.nodeName.toLowerCase()){case "table":var oldW=element.style.width;var oldH=element.style.height;element.className=tinyMCE.getVisualAidClass(element.className,state&&element.getAttribute("border")==0);element.style.width=oldW;element.style.height=oldH;for(var y=0;y ','g');html_content=html_content.replace(re," ");}try{doc.body.innerHTML=html_content;}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<\/o:p>"," ");html=tinyMCE.regexpReplace(html," <\/o:p>","");html=tinyMCE.regexpReplace(html,"","");html=tinyMCE.regexpReplace(html,"<\/p>","");html=tinyMCE.regexpReplace(html,"
<\/p>\r\n
<\/p>","");html=tinyMCE.regexpReplace(html,"
<\/p>"," ");html=tinyMCE.regexpReplace(html,"
\s*(
\s*)?","
");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?","
");}doc.body.innerHTML=html;}};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str)return "";if((pos=str.indexOf('this.src='))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf('\''));return src;}return "";};TinyMCE.prototype._getElementById=function(element_id){var elm=document.getElementById(element_id);if(!elm){for(var j=0;j0){var csses=null;eval("try {var csses = tinyMCE.isMSIE ? doc.styleSheets(0).rules : doc.styleSheets[0].cssRules;} catch(e) {}");if(!csses)return new Array();for(var i=0;i0)tinyMCE.cssClasses=output;return output;};TinyMCE.prototype.regexpReplace=function(in_str,reg_exp,replace_str,opts){if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace('function anonymous()\n{\n','');str=str.replace('\n}','');return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var parentNode=node;while(parentNode){pos.absLeft+=parentNode.offsetLeft;pos.absTop+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}return pos;};TinyMCE.prototype.openFileBrowser=function(field_name,url,type,win){var cb=tinyMCE.getParam("file_browser_callback");this.setWindowArg("window",win);if(eval('typeof('+cb+')')=="undefined")alert("Callback function: "+cb+" could not be found.");else eval(cb+"(field_name, url, type, win);");};TinyMCE.prototype.getControlHTML=function(control_name){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_getControlHTML";if(eval("typeof("+templateFunction+")")!='undefined'){var html=eval(templateFunction+"('"+control_name+"');");if(html!="")return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+themePlugins[i]);}}return eval('TinyMCE_'+tinyMCE.settings['theme']+"_getControlHTML"+"('"+control_name+"');");};TinyMCE.prototype._themeExecCommand=function(editor_id,element,command,user_interface,value){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined'){if(eval(templateFunction+"(editor_id, element, command, user_interface, value);"))return true;}}templateFunction='TinyMCE_'+tinyMCE.settings['theme']+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined')return eval(templateFunction+"(editor_id, element, command, user_interface, value);");return false;};TinyMCE.prototype._getThemeFunction=function(suffix,skip_plugins){if(skip_plugins)return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+suffix;if(eval("typeof("+templateFunction+")")!='undefined')return templateFunction;}return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;};TinyMCE.prototype.isFunc=function(func_name){if(func_name==null||func_name=="")return false;return eval("typeof("+func_name+")")!="undefined";};TinyMCE.prototype.exec=function(func_name,args){var str=func_name+'(';for(var i=3;i1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;var scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;var height=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(node.absTop>scrollY&&node.absTop<(scrollY-25+height)))this.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE)return this.getDoc().selection;var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var newSel=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=='<'){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}newSel.focusNode=sel.baseNode;newSel.focusOffset=sel.baseOffset;newSel.anchorNode=sel.extentNode;newSel.anchorOffset=sel.extentOffset;newSel.getRangeAt=getRangeAt;newSel.text=""+sel;newSel.realSelection=sel;newSel.toString=function(){return this.text;};return newSel;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE)return sel.createRange();if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i "+blockName+"><"+blockName+"> "+blockName+">";paraAfter=body.childNodes[1];}this.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){var nodes=contents.firstChild.childNodes;for(var i=0;i0)rng.pasteHTML(''+rng.htmlText+"
");tinyMCE.triggerNodeChange();return;}}}switch(command){case "mceStoreSelection":this.selectionBookmark=this.getBookmark();break;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);break;case "InsertUnorderedList":case "InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"> <"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,""+this.getSelectedHTML()+" ");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case "FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)this.execCommand("mceRemoveNode",false,elm);}else this.getDoc().execCommand("FormatBlock",false,value);tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){value.outerHTML=value.innerHTML;}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML));}tinyMCE.triggerNodeChange();break;case "mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue;}if(i==value){this.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;case "HiliteColor":if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,false);this.getDoc().execCommand('hilitecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}else this.getDoc().execCommand('BackColor',false,value);break;case "Cut":case "Copy":case "Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.getLang('lang_clipboard_msg')))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return;}else tinyMCE.triggerNodeChange();break;case "mceSetContent":if(!value)value="";value=tinyMCE._customCleanup("insert_to_editor",value);tinyMCE._setHTML(doc,value);doc.body.innerHTML=tinyMCE._cleanupHTML(doc,tinyMCE.settings,doc.body);tinyMCE.handleVisualAid(doc.body,true,this.visualAid);return true;case "mceLink":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_real_href');if(mceRealHref!="")href=mceRealHref;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings['insertlink_callback']){var returnVal=eval(this.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])tinyMCE.insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,'mce_real_src');if(mceRealSrc!="")src=mceRealSrc;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");if(onmouseover!="")onmouseover=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, img, true);");if(onmouseout!="")onmouseout=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, img, true);");action="update";}if(this.settings['insertimage_callback']){var returnVal=eval(this.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])tinyMCE.insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action});break;case "mceCleanupWord":if(tinyMCE.isMSIE){var html=this.getBody().createTextRange().htmlText;if(html.indexOf('="mso')!=-1){tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);html=tinyMCE._cleanupHTML(this.contentDocument,this.settings,this.getBody(),this.visualAid);}this.getBody().innerHTML=html;}break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);this.getBody().innerHTML=tinyMCE._cleanupHTML(this.contentDocument,this.settings,this.getBody(),this.visualAid);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid);this.repaint();tinyMCE.triggerNodeChange();break;case "mceAnchor":if(!user_interface){var aElm=tinyMCE.getParentElement(this.getFocusElement(),"a","name");if(aElm){if(value==null||value==""){if(tinyMCE.isMSIE){aElm.outerHTML=aElm.innerHTML;}else{var rng=aElm.ownerDocument.createRange();rng.setStartBefore(aElm);rng.setEndAfter(aElm);rng.deleteContents();rng.insertNode(rng.createContextualFragment(aElm.innerHTML));}}else aElm.setAttribute('name',value);}else{this.getDoc().execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value);}tinyMCE.triggerNodeChange();break;case "mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange();}}break;case "mceSetCSSClass":var selectedText=false;if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=(rng.text&&rng.text.length>0);}else selectedText=(this.getSel().toString().length>0);if(tinyMCE.selectedNode)tinyMCE.selectedElement=tinyMCE.selectedNode;if(selectedText&&!tinyMCE.selectedNode){this.getDoc().execCommand("RemoveFormat",false,null);if(value==null)return this.execCommand("RemoveFormat",false,null);this.getDoc().execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;xcustomUndoLevels){for(var i=0;i0){this.undoIndex--;this.getBody().innerHTML=this.undoLevels[this.undoIndex];}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "Redo":if(tinyMCE.settings['custom_undo_redo']){if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;this.getBody().innerHTML=this.undoLevels[this.undoIndex];}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid);tinyMCE.triggerNodeChange();break;case "removeformat":var text=this.getSelectedText();if(tinyMCE.isMSIE){try{win.focus();var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);rng.pasteHTML(rng.text);}catch(e){}}else this.getDoc().execCommand(command,user_interface,value);if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();}};TinyMCEControl.prototype.queryCommandValue=function(command){return this.getDoc().queryCommandValue(command);};TinyMCEControl.prototype.queryCommandState=function(command){return this.getDoc().queryCommandState(command);};TinyMCEControl.prototype.onAdd=function(replace_element,form_element_name,target_document){var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}var templateFunction=tinyMCE._getThemeFunction('_getInsertLinkTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertLinkTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getInsertImageTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertImageTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getEditorTemplate');if(eval("typeof("+templateFunction+")")=='undefined'){alert("Error: Could not find the template function: "+templateFunction);return false;}var editorTemplate=eval(templateFunction+'(this.settings, this.editorId);');var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html=''+editorTemplate['html'];var templateFunction=tinyMCE._getThemeFunction('_handleNodeChange',true);if(eval("typeof("+templateFunction+")")!='undefined')this.settings['handleNodeChangeCallback']=templateFunction;html=tinyMCE.replaceVar(html,"editor_id",this.editorId);html=tinyMCE.replaceVar(html,"default_document",tinyMCE.baseURL+"/blank.htm");this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName.toLowerCase()=="textarea")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=replace_element.cloneNode(true);if(tinyMCE.settings['debug'])html+=' ';else html+=' ';html+=' ';if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.replaceChild(fragment,replace_element);}else replace_element.outerHTML=html;}else{html+='';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.insertBefore(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span")tElm=tinyMCE._createIFrame(tElm);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html=""+''+''+''+' '+'blank_page '+' '+''+''+''+'';try{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();var rng=doc.selection.createRange();if(rng.collapse)rng.collapse(true);var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var elm=(sel&&sel.anchorNode)?sel.anchorNode:null;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img")elm=tinyMCE.selectedElement;}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array();function debug(){var msg="";var elm=document.getElementById("tinymce_debug");if(!elm){var debugDiv=document.createElement("div");debugDiv.setAttribute("className","debugger");debugDiv.className="debugger";debugDiv.innerHTML='\
+ function TinyMCE(){this.majorVersion="2";this.minorVersion="0RC2";this.releaseDate="2005-09-12";this.instances=new Array();this.stickyClassesLookup=new Array();this.windowArgs=new Array();this.loadedFiles=new Array();this.configs=new Array();this.currentConfig=0;this.eventHandlers=new Array();this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(navigator.userAgent.indexOf('MSIE 5.0')!=-1);this.isGecko=navigator.userAgent.indexOf('Gecko')!=-1;this.isSafari=navigator.userAgent.indexOf('Safari')!=-1;this.isMac=navigator.userAgent.indexOf('Mac')!=-1;this.dialogCounter=0;this.idCounter=0;};TinyMCE.prototype.defParam=function(key,def_val){this.settings[key]=tinyMCE.getParam(key,def_val);};TinyMCE.prototype.init=function(settings){var theme;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){var elements=document.getElementsByTagName('script');for(var i=0;i');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.loadCSS=function(url){for(var i=0;i ');this.loadedFiles[this.loadedFiles.length]=url;};TinyMCE.prototype.importCSS=function(doc,css_file){if(css_file=='')return;if(tinyMCE.isMSIE)var styleSheet=doc.createStyleSheet(css_file);else{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head"))headArr[0].appendChild(elm);}};TinyMCE.prototype.confirmAdd=function(e,settings){var elm=tinyMCE.isMSIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang['lang_edit_confirm']))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true');};TinyMCE.prototype.updateContent=function(form_element_name){var formElement=document.getElementById(form_element_name);for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();if(inst.formElement==formElement){var doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isMSIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid);}}};TinyMCE.prototype.addMCEControl=function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCEControl(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst.onAdd(replace_element,form_element_name,target_document);};TinyMCE.prototype.triggerSave=function(skip_cleanup,skip_callback){for(var n in tinyMCE.instances){var inst=tinyMCE.instances[n];inst.switchSettings();tinyMCE.settings['preformatted']=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(inst.getDoc(),inst.getBody().innerHTML);if(inst.settings['cleanup']==false){tinyMCE.handleVisualAid(inst.getBody(),true,false,inst);tinyMCE._setEventsEnabled(inst.getBody(),false);}tinyMCE._customCleanup(inst,"submit_content_dom",inst.contentWindow.document.body);var htm=skip_cleanup?inst.getBody().innerHTML:tinyMCE._cleanupHTML(inst,inst.getDoc(),this.settings,inst.getBody(),this.visualAid,true);htm=tinyMCE._customCleanup(inst,"submit_content",htm);if(tinyMCE.settings["encoding"]=="xml"||tinyMCE.settings["encoding"]=="html")htm=tinyMCE.convertStringToXML(htm);if(!skip_callback&&tinyMCE.settings['save_callback']!="")var content=eval(tinyMCE.settings['save_callback']+"(inst.formTargetElementId,htm,inst.getBody());");if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"(","(","gi");htm=tinyMCE.regexpReplace(htm,")",")","gi");htm=tinyMCE.regexpReplace(htm,";",";","gi");htm=tinyMCE.regexpReplace(htm,""",""","gi");htm=tinyMCE.regexpReplace(htm,"^","^","gi");if(inst.formElement)inst.formElement.value=htm;}};TinyMCE.prototype._setEventsEnabled=function(node,state){var events=new Array('onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');var elms=node.getElementsByTagName("a");for(var i=0;i ","gi");content=tinyMCE.regexpReplace(content,"\r"," ","gi");content=tinyMCE.regexpReplace(content,"\n"," ","gi");}content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isMSIE){window.setInterval('try{tinyMCE.getCSSClasses(document.frames["'+editor_id+'"].document, "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings["force_br_newlines"])document.frames[editor_id].document.styleSheets[0].addRule("p","margin: 0px;");var body=document.frames[editor_id].document.body;tinyMCE.addEvent(body,"beforepaste",TinyMCE.prototype.eventPatch);tinyMCE.addEvent(body,"beforecut",TinyMCE.prototype.eventPatch);body.editorId=editor_id;}if(!tinyMCE.isMSIE){var contentElement=inst.getDoc().createElement("body");var doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings['force_p_newlines'])content=content.replace(new RegExp('<>','g'),"");if(tinyMCE.settings['cleanup_on_startup'])inst.getBody().innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement);else{content=tinyMCE.regexpReplace(content,"","","gi");content=tinyMCE.regexpReplace(content,"","","gi");content=tinyMCE.regexpReplace(content," "," ","gi");inst.getBody().innerHTML=content;}inst.convertAllRelativeURLs();}else{if(tinyMCE.settings['cleanup_on_startup']){tinyMCE._setHTML(inst.getDoc(),content);eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');}else tinyMCE._setHTML(inst.getDoc(),content);}var parentElm=document.getElementById(inst.editorId+'_parent');if(parentElm.lastChild.nodeName.toLowerCase()=="input")inst.formElement=parentElm.lastChild;else inst.formElement=parentElm.nextSibling;tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings['visual'],inst);tinyMCE.executeCallback('setupcontent_callback','_setupContent',0,editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isMSIE)TinyMCE.prototype.addEventHandlers(editor_id);if(tinyMCE.isMSIE)tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE.prototype.eventPatch);tinyMCE.selectedInstance=inst;tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE.triggerNodeChange(false,true);tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),true);inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoLevels[inst.undoLevels.length]=inst.startContent;};TinyMCE.prototype.cancelEvent=function(e){if(tinyMCE.isMSIE){e.returnValue=false;e.cancelBubble=true;}else e.preventDefault();};TinyMCE.prototype.removeTinyMCEFormElements=function(form_obj){for(var i=0;i ");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false;}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false);}return false;break;case "keyup":case "keydown":if(e.target.editorId)tinyMCE.selectedInstance=tinyMCE.instances[e.target.editorId];else return;if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();var inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings['force_p_newlines']&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(tinyMCE.selectedInstance._handleBackSpace(e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false;}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;var elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings['visual'],tinyMCE.selectedInstance);if(tinyMCE.isGecko&&tinyMCE.settings['document_base_url']!=""+document.location.href&&e.type=="keyup"&&e.ctrlKey&&e.keyCode==86)tinyMCE.selectedInstance.fixBrokenURLs();if(tinyMCE.isMSIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isMSIE&&e.type=="keyup"&&e.keyCode==13){var elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML=" ";else elm.innerHTML=" ";}}}var keys=tinyMCE.posKeyCodes;var posKey=false;for(var i=0;i0)return;if(val.indexOf('%')==-1)val+='px';break;case "vspace":case "hspace":elm.style.marginTop=val+"px";elm.style.marginBottom=val+"px";elm.removeAttribute(attrib);return;case "align":if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE)elm.style.styleFloat=val;else elm.style.cssFloat=val;}else elm.style.textAlign=val;elm.removeAttribute(attrib);return;}if(val!=''){eval('elm.style.'+style+' = val;');elm.removeAttribute(attrib);}}}else{if(style=='')return;var val=eval('elm.style.'+style)==''?tinyMCE.getAttrib(elm,attrib):eval('elm.style.'+style);val=val==null?'':''+val;switch(attrib){case "background":if(val.indexOf('url')==-1&&val!='')val="url('"+val+"');";if(val!=''){elm.style.backgroundImage=val;elm.removeAttribute(attrib);}return;case "border":case "width":case "height":val=val.replace('px','');break;case "align":if(tinyMCE.getAttrib(elm,'align')==''){if(elm.nodeName=="IMG"){if(tinyMCE.isMSIE&&elm.style.styleFloat!=''){val=elm.style.styleFloat;style='styleFloat';}else if(tinyMCE.isGecko&&elm.style.cssFloat!=''){val=elm.style.cssFloat;style='cssFloat';}}}break;}if(val!=''){elm.removeAttribute(attrib);elm.setAttribute(attrib,val);eval('elm.style.'+style+' = "";');}}};TinyMCE.prototype._cleanupAttribute=function(valid_attributes,element_name,attribute_node,element_node){var attribName=attribute_node.nodeName.toLowerCase();var attribValue=attribute_node.nodeValue;var attribMustBeValue=null;var verified=false;if(attribName.indexOf('moz_')!=-1)return null;if(!tinyMCE.isMSIE&&(attribName=="mce_real_href"||attribName=="mce_real_src")){if(!tinyMCE.cleanup_on_save){var attrib=new Object();attrib.name=attribName;attrib.value=attribValue;return attrib;}else return null;}if(attribName=="mce_onclick")verified=true;if(tinyMCE.cleanup_verify_html&&!verified){for(var i=1;i';}if(tinyMCE.cleanup_inline_styles){var re=new RegExp("^(TABLE|TD|TR|IMG|HR)$");if(re.test(node.nodeName)){tinyMCE._moveStyle(node,'width','width');tinyMCE._moveStyle(node,'height','height');tinyMCE._moveStyle(node,'borderWidth','border');tinyMCE._moveStyle(node,'','vspace');tinyMCE._moveStyle(node,'','hspace');tinyMCE._moveStyle(node,'textAlign','align');tinyMCE._moveStyle(node,'backgroundColor','bgColor');tinyMCE._moveStyle(node,'borderColor','borderColor');tinyMCE._moveStyle(node,'backgroundImage','background');if(tinyMCE.isMSIE5)node.outerHTML=node.outerHTML;}else if(tinyMCE.isBlockElement(node))tinyMCE._moveStyle(node,'textAlign','align');if(node.nodeName=="FONT")tinyMCE._moveStyle(node,'color','color');}if(elementValidAttribs){for(var a=1;a0){for(var i=0;i"+this.convertStringToXML(String.fromCharCode(160))+""+elementName+">";if(tinyMCE.isMSIE&&elementName=="script")return "<"+elementName+elementAttribs+">"+node.text+""+elementName+">";if(node.hasChildNodes()){if(elementName=="p"&&tinyMCE.cleanup_force_br_newlines)output+="";else output+="<"+elementName+elementAttribs+">";for(var i=0;i
";else output+=""+elementName+">";}else{if(!nonEmptyTag){if(openTag)output+="<"+elementName+elementAttribs+">"+elementName+">";else output+="<"+elementName+elementAttribs+" />";}}return output;case 3:if(node.parentNode.nodeName.toLowerCase()=="script")return node.nodeValue;return this.convertStringToXML(node.nodeValue);case 8:return "";default:return "[UNKNOWN NODETYPE "+node.nodeType+"]";}};TinyMCE.prototype.convertStringToXML=function(html_data){var output="";for(var i=0;i127)output+=''+chr+";";else output+=String.fromCharCode(chr);continue;}if(tinyMCE.settings['entity_encoding']=="raw"){output+=String.fromCharCode(chr);continue;}if(typeof(tinyMCE.cleanup_entities["c"+chr])!='undefined'&&tinyMCE.cleanup_entities["c"+chr]!='')output+='&'+tinyMCE.cleanup_entities["c"+chr]+';';else output+=''+String.fromCharCode(chr);}return output;};TinyMCE.prototype._getCleanupElementName=function(chunk){var pos;if(chunk.charAt(0)=='+')chunk=chunk.substring(1);if(chunk.charAt(0)=='-')chunk=chunk.substring(1);if((pos=chunk.indexOf('/'))!=-1)chunk=chunk.substring(0,pos);if((pos=chunk.indexOf('['))!=-1)chunk=chunk.substring(0,pos);return chunk;};TinyMCE.prototype._initCleanup=function(){var validElements=tinyMCE.settings["valid_elements"];validElements=validElements.split(',');var extendedValidElements=tinyMCE.settings["extended_valid_elements"];extendedValidElements=extendedValidElements.split(',');for(var i=0;i[ \n\r]*[ \n\r]*',' ','gi');element.innerHTML=tinyMCE.regexpReplace(element.innerHTML,'','','gi');}var html=this.cleanupNode(element);if(tinyMCE.settings['debug'])tinyMCE.debug("Cleanup process executed in: "+(new Date().getTime()-startTime)+" ms.");html=tinyMCE.regexpReplace(html,'
',' ');html=tinyMCE.regexpReplace(html,'
',' ');html=tinyMCE.regexpReplace(html,'\\s* \\s* ',' ');html=html.replace(new RegExp('(.*?) ','gi'),'$1');if(!tinyMCE.isMSIE)html=html.replace(new RegExp(' ','g'),"");if(tinyMCE.settings['apply_source_formatting']){html=html.replace(new RegExp('<(p|div)([^>]*)>','g'),"\n<$1$2>\n");html=html.replace(new RegExp('<\/(p|div)([^>]*)>','g'),"\n$1$2>\n");html=html.replace(new RegExp(' ','g')," \n");}if(tinyMCE.settings['force_br_newlines']){var re=new RegExp('
','g');html=html.replace(re," ");}if(tinyMCE.settings['force_p_newlines']){var re=new RegExp('<>','g');html=html.replace(re,"");}if(tinyMCE.settings['remove_linebreaks'])html=html.replace(new RegExp('\r|\n','g'),' ');html=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",html);var chk=tinyMCE.regexpReplace(html,"[ \t\r\n]","").toLowerCase();if(chk==" "||chk==" "||chk=="
"||chk=="
"||chk=="
")html="";if(tinyMCE.settings["preformatted"])return ""+html+" ";return html;};TinyMCE.prototype.insertLink=function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(this.selectedInstance&&this.selectedElement&&this.selectedElement.nodeName.toLowerCase()=="img"){var doc=this.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(this.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true;}href=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");tinyMCE.setAttrib(linkElement,'href',href);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',title);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(this.selectedElement.cloneNode(true));this.selectedElement.parentNode.replaceChild(linkElement,this.selectedElement);}return;}if(!this.linkElement&&this.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,''+this.selectedInstance.getSelectedHTML()+' ');}else this.selectedInstance.contentDocument.execCommand("createlink",false,"#mce_temp_url#");tinyMCE.linkElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");var elementArray=this.getElementsByAttributeValue(this.selectedInstance.contentDocument.body,"a","href","#mce_temp_url#");for(var i=0;i ';tinyMCE.execCommand("mceInsertContent",false,html);}else{if(!this.imgElement&&this.selectedInstance){if(tinyMCE.isSafari)tinyMCE.execCommand("mceInsertContent",false,' ');else this.selectedInstance.contentDocument.execCommand("insertimage",false,"#mce_temp_url#");tinyMCE.imgElement=this.getElementByAttributeValue(this.selectedInstance.contentDocument.body,"img","src","#mce_temp_url#");}}if(this.imgElement){var needsRepaint=false;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, tinyMCE.imgElement);");if(onmouseover&&onmouseover!="")onmouseover="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, tinyMCE.imgElement);")+"';";if(onmouseout&&onmouseout!="")onmouseout="this.src='"+eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, tinyMCE.imgElement);")+"';";if(typeof(title)=="undefined")title=alt;if(width!=this.imgElement.getAttribute("width")||height!=this.imgElement.getAttribute("height")||align!=this.imgElement.getAttribute("align"))needsRepaint=true;tinyMCE.setAttrib(this.imgElement,'src',src);tinyMCE.setAttrib(this.imgElement,'mce_real_src',src);tinyMCE.setAttrib(this.imgElement,'alt',alt);tinyMCE.setAttrib(this.imgElement,'title',title);tinyMCE.setAttrib(this.imgElement,'align',align);tinyMCE.setAttrib(this.imgElement,'border',border,true);tinyMCE.setAttrib(this.imgElement,'hspace',hspace,true);tinyMCE.setAttrib(this.imgElement,'vspace',vspace,true);tinyMCE.setAttrib(this.imgElement,'width',width,true);tinyMCE.setAttrib(this.imgElement,'height',height,true);tinyMCE.setAttrib(this.imgElement,'onmouseover',onmouseover);tinyMCE.setAttrib(this.imgElement,'onmouseout',onmouseout);if(width&&width!="")this.imgElement.style.pixelWidth=width;if(height&&height!="")this.imgElement.style.pixelHeight=height;if(needsRepaint)tinyMCE.selectedInstance.repaint();}tinyMCE.execCommand('mceEndUndoLevel');};TinyMCE.prototype.getElementByAttributeValue=function(node,element_name,attrib,value){var elements=this.getElementsByAttributeValue(node,element_name,attrib,value);if(elements.length==0)return null;return elements[0];};TinyMCE.prototype.getElementsByAttributeValue=function(node,element_name,attrib,value){var elements=new Array();if(node&&node.nodeName.toLowerCase()==element_name){if(node.getAttribute(attrib)&&node.getAttribute(attrib).indexOf(value)!=-1)elements[elements.length]=node;}if(node.hasChildNodes){for(var x=0,n=node.childNodes.length;x=strTok2.length){for(var i=0;i=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(strTok1.length=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break;}}}if(breakPoint==1)return url_to_relative;for(var i=0;i<(strTok1.length-(breakPoint-1));i++)outputString+="../";for(var i=breakPoint-1;i=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i];}baseURLParts=newBaseURLParts.reverse();var newRelURLParts=new Array();var numBack=0;for(var i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue;}if(numBack>0){numBack--;continue;}newRelURLParts[newRelURLParts.length]=relURLParts[i];}relURLParts=newRelURLParts.reverse();var len=baseURLParts.length-numBack;var absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');var start="",end="";if(baseURL['protocol'])start+=baseURL['protocol']+"://";if(baseURL['host'])start+=baseURL['host'];if(baseURL['port'])start+=":"+baseURL['port'];if(relURL['query'])end+="?"+relURL['query'];if(relURL['anchor'])end+="#"+relURL['anchor'];if(relative_url.charAt(relative_url.length-1)=="/")end+="/";return start+absPath+end;};TinyMCE.prototype.getParam=function(name,default_value,strip_whitespace,split_chr){var value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);var outArray=new Array();for(var i=0;i0);if(tinyMCE.settings['custom_undo_redo']){undoIndex=inst.undoIndex;undoLevels=inst.undoLevels.length;}tinyMCE.executeCallback('handleNodeChangeCallback','_handleNodeChange',0,editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection);}}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus();};TinyMCE.prototype._customCleanup=function(inst,type,content){var customCleanup=tinyMCE.settings['cleanup_callback'];if(customCleanup!=""&&eval("typeof("+customCleanup+")")!="undefined")content=eval(customCleanup+"(type, content, inst);");var plugins=tinyMCE.getParam('plugins','',true,',');for(var i=0;i0)className+=" ";className+=classNames[i];}return className;};TinyMCE.prototype.handleVisualAid=function(element,deep,state,inst){if(!element)return;var tableElement=null;switch(element.nodeName){case "TABLE":var oldW=element.style.width;var oldH=element.style.height;element.className=tinyMCE.getVisualAidClass(element.className,state&&element.getAttribute("border")==0);element.style.width=oldW;element.style.height=oldH;for(var y=0;y ','g');html_content=html_content.replace(re," ");}try{doc.body.innerHTML=html_content;}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content);}if(tinyMCE.isMSIE&&tinyMCE.settings['fix_content_duplication']){var paras=doc.getElementsByTagName("P");for(var i=0;i<\/o:p>"," ");html=tinyMCE.regexpReplace(html," <\/o:p>","");html=tinyMCE.regexpReplace(html,"","");html=tinyMCE.regexpReplace(html,"<\/p>","");html=tinyMCE.regexpReplace(html,"
<\/p>\r\n
<\/p>","");html=tinyMCE.regexpReplace(html,"
<\/p>"," ");html=tinyMCE.regexpReplace(html,"
\s*(
\s*)?","
");html=tinyMCE.regexpReplace(html,"<\/p>\s*(<\/p>\s*)?","
");}doc.body.innerHTML=html;}};TinyMCE.prototype.getImageSrc=function(str){var pos=-1;if(!str)return "";if((pos=str.indexOf('this.src='))!=-1){var src=str.substring(pos+10);src=src.substring(0,src.indexOf('\''));return src;}return "";};TinyMCE.prototype._getElementById=function(element_id){var elm=document.getElementById(element_id);if(!elm){for(var j=0;j0){for(var x=0;x0)tinyMCE.cssClasses=output;return output;};TinyMCE.prototype.regexpReplace=function(in_str,reg_exp,replace_str,opts){if(typeof(opts)=="undefined")opts='g';var re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str);};TinyMCE.prototype.trim=function(str){return str.replace(/^\s*|\s*$/g,"");};TinyMCE.prototype.cleanupEventStr=function(str){str=""+str;str=str.replace('function anonymous()\n{\n','');str=str.replace('\n}','');str=str.replace(/^return true;/gi,'');return str;};TinyMCE.prototype.getAbsPosition=function(node){var pos=new Object();pos.absLeft=pos.absTop=0;var parentNode=node;while(parentNode){pos.absLeft+=parentNode.offsetLeft;pos.absTop+=parentNode.offsetTop;parentNode=parentNode.offsetParent;}return pos;};TinyMCE.prototype.getControlHTML=function(control_name){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_getControlHTML";if(eval("typeof("+templateFunction+")")!='undefined'){var html=eval(templateFunction+"('"+control_name+"');");if(html!="")return tinyMCE.replaceVar(html,"pluginurl",tinyMCE.baseURL+"/plugins/"+themePlugins[i]);}}return eval('TinyMCE_'+tinyMCE.settings['theme']+"_getControlHTML"+"('"+control_name+"');");};TinyMCE.prototype._themeExecCommand=function(editor_id,element,command,user_interface,value){var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined'){if(eval(templateFunction+"(editor_id, element, command, user_interface, value);"))return true;}}templateFunction='TinyMCE_'+tinyMCE.settings['theme']+"_execCommand";if(eval("typeof("+templateFunction+")")!='undefined')return eval(templateFunction+"(editor_id, element, command, user_interface, value);");return false;};TinyMCE.prototype._getThemeFunction=function(suffix,skip_plugins){if(skip_plugins)return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;var themePlugins=tinyMCE.getParam('plugins','',true,',');var templateFunction;for(var i=themePlugins.length;i>=0;i--){templateFunction='TinyMCE_'+themePlugins[i]+suffix;if(eval("typeof("+templateFunction+")")!='undefined')return templateFunction;}return 'TinyMCE_'+tinyMCE.settings['theme']+suffix;};TinyMCE.prototype.isFunc=function(func_name){if(func_name==null||func_name=="")return false;return eval("typeof("+func_name+")")!="undefined";};TinyMCE.prototype.exec=function(func_name,args){var str=func_name+'(';for(var i=3;i\
- ';document.body.appendChild(debugDiv);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i';document.body.appendChild(debugDiv);elm=document.getElementById("tinymce_debug");}var args=this.debug.arguments;for(var i=0;i1&&tinyMCE.currentConfig!=this.settings['index']){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings['index'];}};TinyMCEControl.prototype.fixBrokenURLs=function(){var body=this.getBody();var elms=body.getElementsByTagName("img");for(var i=0;i0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node);}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length);}else rng.collapse(to_start);}sel.removeAllRanges();sel.addRange(rng);}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node;};TinyMCEControl.prototype.scrollToNode=function(node){var pos=tinyMCE.getAbsPosition(node);var doc=this.getDoc();var scrollX=doc.body.scrollLeft+doc.documentElement.scrollLeft;var scrollY=doc.body.scrollTop+doc.documentElement.scrollTop;var height=tinyMCE.isMSIE?document.getElementById(this.editorId).style.pixelHeight:this.targetElement.clientHeight;if(!tinyMCE.settings['auto_resize']&&!(node.absTop>scrollY&&node.absTop<(scrollY-25+height)))this.contentWindow.scrollTo(pos.absLeft,pos.absTop-height+25);};TinyMCEControl.prototype.getBody=function(){return this.getDoc().body;};TinyMCEControl.prototype.getDoc=function(){return this.contentWindow.document;};TinyMCEControl.prototype.getWin=function(){return this.contentWindow;};TinyMCEControl.prototype.getSel=function(){if(tinyMCE.isMSIE)return this.getDoc().selection;var sel=this.contentWindow.getSelection();if(tinyMCE.isSafari&&!sel.getRangeAt){var newSel=new Object();var doc=this.getDoc();function getRangeAt(idx){var rng=new Object();rng.startContainer=this.focusNode;rng.endContainer=this.anchorNode;rng.commonAncestorContainer=this.focusNode;rng.createContextualFragment=function(html){if(html.charAt(0)=='<'){var elm=doc.createElement("div");elm.innerHTML=html;return elm.firstChild;}return doc.createTextNode("UNSUPPORTED, DUE TO LIMITATIONS IN SAFARI!");};rng.deleteContents=function(){doc.execCommand("Delete",false,"");};return rng;}newSel.focusNode=sel.baseNode;newSel.focusOffset=sel.baseOffset;newSel.anchorNode=sel.extentNode;newSel.anchorOffset=sel.extentOffset;newSel.getRangeAt=getRangeAt;newSel.text=""+sel;newSel.realSelection=sel;newSel.toString=function(){return this.text;};return newSel;}return sel;};TinyMCEControl.prototype.getRng=function(){var sel=this.getSel();if(sel==null)return null;if(tinyMCE.isMSIE)return sel.createRange();if(tinyMCE.isSafari){var rng=this.getDoc().createRange();var sel=this.getSel().realSelection;rng.setStart(sel.baseNode,sel.baseOffset);rng.setEnd(sel.extentNode,sel.extentOffset);return rng;}return this.getSel().getRangeAt(0);};TinyMCEControl.prototype._insertPara=function(e){function isEmpty(para){function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()=="";}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;var nodes=tinyMCE.getNodeTree(para,new Array(),3);for(var i=0;i "+blockName+"><"+blockName+"> "+blockName+">";paraAfter=body.childNodes[1];}this.selectNode(paraAfter,true,true);return true;}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);var contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){var nodes=contents.firstChild.childNodes;for(var i=0;i0)rng.pasteHTML(''+rng.htmlText+"
");tinyMCE.triggerNodeChange();return;}}}switch(command){case "mceRepaint":this.repaint();return true;case "mceStoreSelection":this.selectionBookmark=this.getBookmark();return true;case "mceRestoreSelection":this.moveToBookmark(this.selectionBookmark);return true;case "InsertUnorderedList":case "InsertOrderedList":var tag=(command=="InsertUnorderedList")?"ul":"ol";if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,"<"+tag+"> <"+tag+">");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "Strikethrough":if(tinyMCE.isSafari)this.execCommand("mceInsertContent",false,""+this.getSelectedHTML()+" ");else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case "mceSelectNode":this.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case "FormatBlock":if(value==null||value==""){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)this.execCommand("mceRemoveNode",false,elm);}else this.getDoc().execCommand("FormatBlock",false,value);tinyMCE.triggerNodeChange();break;case "mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isMSIE){value.outerHTML=value.innerHTML;}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML));}tinyMCE.triggerNodeChange();break;case "mceSelectNodeDepth":var parentNode=this.getFocusElement();for(var i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue;}if(i==value){this.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return;}parentNode=parentNode.parentNode;}break;case "SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value['command'];var sname=value['name'];var svalue=value['value'];var wrapper=value['wrapper']?value['wrapper']:"span";var parentElm=null;if(tinyMCE.isMSIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0)parentElm=pelm;}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(/td|tr|tbody|table/ig.test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm;}if(parentElm){if(scmd=="setstyle")eval("parentElm.style."+sname+" = svalue;");if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);}else{doc.execCommand("fontname",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(var x=0;x=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(elm,elm.childNodes[0],isNew);continue;}if(elm.parentNode.childNodes.length==1){this._mergeElements(elm.parentNode,elm,false);}}var nodes=doc.getElementsByTagName(wrapper);for(var i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));if(new RegExp('|','gi').test(tmp.innerHTML)){for(var i=elm.childNodes.length-1;i>=0;i--){if(elm.parentNode!=null){elm.parentNode.insertBefore(elm.childNodes[i].cloneNode(true),elm);elm.parentNode.removeChild(elm);}}}}tinyMCE.triggerNodeChange();break;case "FontName":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"fontFamily",value:value});else this.getDoc().execCommand('FontName',false,value);break;case "FontSize":if(tinyMCE.getParam("convert_fonts_to_styles")){var sizes=new Array('',8,10,12,14,18,24,36);var size=sizes[value]==''?'':sizes[value]+'px';this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"fontSize",value:size});}else this.getDoc().execCommand('FontSize',false,value);break;case "forecolor":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"color",value:value});else{if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,true);this.getDoc().execCommand('forecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}else this.getDoc().execCommand('forecolor',false,value);}break;case "HiliteColor":if(tinyMCE.getParam("convert_fonts_to_styles"))this.execCommand("SetStyleInfo",false,{command:"setstyle",name:"backgroundColor",value:value});else{if(tinyMCE.isGecko){this.getDoc().execCommand("useCSS",false,false);this.getDoc().execCommand('hilitecolor',false,value);this.getDoc().execCommand("useCSS",false,true);}else this.getDoc().execCommand('BackColor',false,value);}break;case "Cut":case "Copy":case "Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.getLang('lang_clipboard_msg')))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return;}else tinyMCE.triggerNodeChange();break;case "mceSetContent":if(!value)value="";value=tinyMCE._customCleanup(this,"insert_to_editor",value);tinyMCE._setHTML(doc,value);doc.body.innerHTML=tinyMCE._cleanupHTML(this,doc,tinyMCE.settings,doc.body);tinyMCE.handleVisualAid(doc.body,true,this.visualAid,this);tinyMCE._setEventsEnabled(doc.body,true);return true;case "mceLink":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return;}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_real_href');if(mceRealHref!="")href=mceRealHref;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");action="update";}if(this.settings['insertlink_callback']){var returnVal=eval(this.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])tinyMCE.insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class']);}else{tinyMCE.openWindow(this.insertLinkTemplate,{href:href,target:target,title:title,onclick:onclick,action:action,className:style_class});}break;case "mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img;}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h);}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttrib(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:"";}onmouseover=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));onmouseout=tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));mceRealSrc=tinyMCE.getAttrib(img,'mce_real_src');if(mceRealSrc!="")src=mceRealSrc;src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");if(onmouseover!="")onmouseover=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseover, img, true);");if(onmouseout!="")onmouseout=eval(tinyMCE.settings['urlconverter_callback']+"(onmouseout, img, true);");action="update";}if(this.settings['insertimage_callback']){var returnVal=eval(this.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])tinyMCE.insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout']);}else tinyMCE.openWindow(this.insertImageTemplate,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action});break;case "mceCleanup":tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);this.getBody().innerHTML=tinyMCE._cleanupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),true);this.repaint();tinyMCE.triggerNodeChange();break;case "mceReplaceContent":var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text;}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value);}tinyMCE.triggerNodeChange();break;case "mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value['targets'])=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value['targets'];var targetNode=tinyMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value['name'],value['value']);tinyMCE.triggerNodeChange();}}break;case "mceSetCSSClass":this.execCommand("SetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case "mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getDoc().body.scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getDoc().body.scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)this.getBody().innerHTML=html.substring(0,pos)+value+html.substring(pos+key.length);this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case "mceInsertContent":if(!tinyMCE.isMSIE){var sel=this.getSel();var rng=this.getRng();var isHTML=value.indexOf('<')!=-1;if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value);}else value=rng.createContextualFragment(value);}else{var el=document.createElement("div");el.innerHTML=value;value=el.firstChild.nodeValue;value=doc.createTextNode(value);}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.triggerNodeChange();return true;}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true;}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node);}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng);}else rng.collapse(false);}else{var rng=doc.selection.createRange();if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);}tinyMCE.triggerNodeChange();break;case "mceStartTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex==-1){this.typingUndoIndex=this.undoIndex;this.execCommand('mceAddUndoLevel');}break;case "mceEndTyping":if(tinyMCE.settings['custom_undo_redo']&&this.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.typingUndoIndex=-1;}break;case "mceBeginUndoLevel":this.undoRedo=false;break;case "mceEndUndoLevel":this.undoRedo=true;this.execCommand('mceAddUndoLevel');break;case "mceAddUndoLevel":if(tinyMCE.settings['custom_undo_redo']&&this.undoRedo){if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;}var newHTML=tinyMCE.trim(this.getBody().innerHTML);if(newHTML!=this.undoLevels[this.undoIndex]){tinyMCE.executeCallback('onchange_callback','_onchange',0,this);var customUndoLevels=tinyMCE.settings['custom_undo_redo_levels'];if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(var i=0;i0){this.undoIndex--;this.getBody().innerHTML=this.undoLevels[this.undoIndex];this.repaint();}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "Redo":if(tinyMCE.settings['custom_undo_redo']){tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;this.getBody().innerHTML=this.undoLevels[this.undoIndex];this.repaint();}tinyMCE.triggerNodeChange();}else this.getDoc().execCommand(command,user_interface,value);break;case "mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case "removeformat":var text=this.getSelectedText();if(tinyMCE.isMSIE){try{win.focus();var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null);if(rng.text==rng.parentElement().innerText){rng.moveToElementText(rng.parentElement());rng.select();}rng.pasteHTML(rng.text);}catch(e){}}else this.getDoc().execCommand(command,user_interface,value);if(text.length==0)this.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel");};TinyMCEControl.prototype.queryCommandValue=function(command){return this.getDoc().queryCommandValue(command);};TinyMCEControl.prototype.queryCommandState=function(command){return this.getDoc().queryCommandState(command);};TinyMCEControl.prototype.onAdd=function(replace_element,form_element_name,target_document){var targetDoc=target_document?target_document:document;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings['theme'];this.settings['themeurl']=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false;}var templateFunction=tinyMCE._getThemeFunction('_getInsertLinkTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertLinkTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getInsertImageTemplate');if(eval("typeof("+templateFunction+")")!='undefined')this.insertImageTemplate=eval(templateFunction+'(this.settings);');var templateFunction=tinyMCE._getThemeFunction('_getEditorTemplate');if(eval("typeof("+templateFunction+")")=='undefined'){alert("Error: Could not find the template function: "+templateFunction);return false;}var editorTemplate=eval(templateFunction+'(this.settings, this.editorId);');var deltaWidth=editorTemplate['delta_width']?editorTemplate['delta_width']:0;var deltaHeight=editorTemplate['delta_height']?editorTemplate['delta_height']:0;var html=''+editorTemplate['html'];var templateFunction=tinyMCE._getThemeFunction('_handleNodeChange',true);if(eval("typeof("+templateFunction+")")!='undefined')this.settings['handleNodeChangeCallback']=templateFunction;html=tinyMCE.replaceVar(html,"editor_id",this.editorId);this.settings['default_document']=tinyMCE.baseURL+"/blank.htm";this.settings['old_width']=this.settings['width'];this.settings['old_height']=this.settings['height'];if(this.settings['width']==-1)this.settings['width']=replace_element.offsetWidth;if(this.settings['height']==-1)this.settings['height']=replace_element.offsetHeight;if(this.settings['width']==0)this.settings['width']=replace_element.style.width;if(this.settings['height']==0)this.settings['height']=replace_element.style.height;if(this.settings['width']==0)this.settings['width']=320;if(this.settings['height']==0)this.settings['height']=240;this.settings['area_width']=parseInt(this.settings['width']);this.settings['area_height']=parseInt(this.settings['height']);this.settings['area_width']+=deltaWidth;this.settings['area_height']+=deltaHeight;if((""+this.settings['width']).indexOf('%')!=-1)this.settings['area_width']="100%";if((""+this.settings['height']).indexOf('%')!=-1)this.settings['area_height']="100%";if((""+replace_element.style.width).indexOf('%')!=-1){this.settings['width']=replace_element.style.width;this.settings['area_width']="100%";}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings['height']=replace_element.style.height;this.settings['area_height']="100%";}html=tinyMCE.applyTemplate(html);this.settings['width']=this.settings['old_width'];this.settings['height']=this.settings['old_height'];this.visualAid=this.settings['visual'];this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName.toLowerCase()!="textarea"){this.oldTargetElement=replace_element.cloneNode(true);if(tinyMCE.settings['debug'])html+=' ';else html+=' ';html+=' ';if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.replaceChild(fragment,replace_element);}else replace_element.outerHTML=html;}else{html+=' ';this.oldTargetElement=replace_element;if(!tinyMCE.settings['debug'])this.oldTargetElement.style.display="none";if(!tinyMCE.isMSIE){var rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);var fragment=rng.createContextualFragment(html);replace_element.parentNode.insertBefore(fragment,replace_element);}else replace_element.insertAdjacentHTML("beforeBegin",html);}var dynamicIFrame=false;var tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isMSIE){if(tElm&&tElm.nodeName.toLowerCase()=="span"){tElm=tinyMCE._createIFrame(tElm);dynamicIFrame=true;}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName.toLowerCase()=="span")tElm=tinyMCE._createIFrame(tElm);else tElm=targetDoc.frames[this.editorId];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);this.contentDocument=tElm.window.document;this.contentWindow=tElm.window;this.getDoc().designMode="on";}var doc=this.contentDocument;if(dynamicIFrame){var html='blank_page ';try{this.getDoc().designMode="on";doc.open();doc.write(html);doc.close();}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm";}}if(tinyMCE.isMSIE)window.setTimeout("TinyMCE.prototype.addEventHandlers('"+this.editorId+"');",1);tinyMCE.setupContent(this.editorId,true);return true;};TinyMCEControl.prototype.getFocusElement=function(){if(tinyMCE.isMSIE){var doc=this.getDoc();var rng=doc.selection.createRange();if(rng.collapse)rng.collapse(true);var elm=rng.item?rng.item(0):rng.parentElement();}else{var sel=this.getSel();var rng=this.getRng();var elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset];}}}elm=tinyMCE.getParentElement(elm);}return elm;};var tinyMCE=new TinyMCE();var tinyMCELang=new Array();
\ No newline at end of file
diff --git a/wp-includes/js/tinymce/tiny_mce_popup.js b/wp-includes/js/tinymce/tiny_mce_popup.js
index b9f9c56026..0486e74367 100644
--- a/wp-includes/js/tinymce/tiny_mce_popup.js
+++ b/wp-includes/js/tinymce/tiny_mce_popup.js
@@ -1,52 +1,144 @@
-// Get tinyMCE window
-var win = window.opener ? window.opener : window.dialogArguments;
+/**
+ * $RCSfile: tiny_mce_popup.js,v $
+ * $Revision: 1.14 $
+ * $Date: 2005/08/23 17:01:39 $
+ *
+ * @author Moxiecode
+ * @copyright Copyright 2004, Moxiecode Systems AB, All rights reserved.
+ */
-var tinyMCE = null;
-var tinyMCELang = null;
+var tinyMCE = null, tinyMCELang = null;
-// Use top window if not defined
-if (!win)
- win = top;
+function TinyMCEPopup() {
+};
-var tinyMCE = win.tinyMCE;
-var tinyMCELang = win.tinyMCELang;
+TinyMCEPopup.prototype.init = function() {
+ var win = window.opener ? window.opener : window.dialogArguments;
-if (!tinyMCE)
- alert("tinyMCE object reference not found from popup.");
+ if (!win)
+ win = top;
-// Setup window openerer
-window.opener = win;
+ window.opener = win;
+ this.windowOpener = win;
-// Setup title
-var re = new RegExp('{|\\\$|}', 'g');
-var title = document.title.replace(re, "");
-if (typeof tinyMCELang[title] != "undefined") {
- var divElm = document.createElement("div");
- divElm.innerHTML = tinyMCELang[title];
- document.title = divElm.innerHTML;
-}
+ // Setup parent references
+ tinyMCE = win.tinyMCE;
+ tinyMCELang = win.tinyMCELang;
-// Setup dir
-if (tinyMCELang['lang_dir'])
- document.dir = tinyMCELang['lang_dir'];
-
-function TinyMCEPlugin_onLoad() {
- if (tinyMCE.getWindowArg('mce_replacevariables', true))
- document.body.innerHTML = tinyMCE.applyTemplate(document.body.innerHTML, tinyMCE.windowArgs);
-
- // Auto resize window
- if (tinyMCE.getWindowArg('mce_windowresize', true))
- TinyMCEPopup_autoResize();
-
- if (tinyMCE.settings["dialog_type"] == "window")
- window.focus();
-}
-
-function TinyMCEPopup_autoResize() {
- // Div mode, skip resize
- if (tinyMCE.settings["dialog_type"] == "div")
+ if (!tinyMCE) {
+ alert("tinyMCE object reference not found from popup.");
return;
+ }
+ this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
+ this.storeSelection = tinyMCE.isMSIE && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
+
+ // Store selection
+ if (this.storeSelection)
+ tinyMCE.selectedInstance.execCommand('mceStoreSelection');
+
+ // Setup dir
+ if (tinyMCELang['lang_dir'])
+ document.dir = tinyMCELang['lang_dir'];
+
+ // Setup title
+ var re = new RegExp('{|\\\$|}', 'g');
+ var title = document.title.replace(re, "");
+ if (typeof tinyMCELang[title] != "undefined") {
+ var divElm = document.createElement("div");
+ divElm.innerHTML = tinyMCELang[title];
+ document.title = divElm.innerHTML;
+
+ if (tinyMCE.setWindowTitle != null)
+ tinyMCE.setWindowTitle(window, divElm.innerHTML);
+ }
+
+ // Output Popup CSS class
+ document.write(' ');
+
+ tinyMCE.addEvent(window, "load", this.onLoad);
+};
+
+TinyMCEPopup.prototype.onLoad = function() {
+ var body = document.body;
+
+ if (tinyMCE.getWindowArg('mce_replacevariables', true))
+ body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
+
+ var dir = tinyMCE.selectedInstance.settings['directionality'];
+ if (dir == "rtl") {
+ var elms = document.forms[0].elements;
+ for (var i=0; i=0; i--) {
+ if (wrapper.hasChildNodes())
+ wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
+ else
+ wrapper.appendChild(nodes[i].cloneNode(true));
+
+ nodes[i].parentNode.removeChild(nodes[i]);
+ }
+
+ // Add wrapper
+ doc.body.appendChild(wrapper);
+
+ // Create iframe
+ iframe = document.createElement("iframe");
+ iframe.id = "mcWinIframe";
+ iframe.src = "about:blank";
+ iframe.width = "100%";
+ iframe.height = "100%";
+ iframe.style.margin = '0px';
+
+ // Add iframe
+ doc.body.appendChild(iframe);
+
+ // Measure iframe
+ iframe = document.getElementById('mcWinIframe');
+ dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
+ dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
+
+ // Resize window
+ // tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
+ window.resizeBy(dx, dy);
+
+ // Hide iframe and show wrapper
+ body.style.margin = oldMargin;
+ iframe.style.display = 'none';
+ wrapper.style.display = 'block';
+ }
+};
+
+TinyMCEPopup.prototype.resizeToContent = function() {
var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
@@ -74,23 +166,56 @@ function TinyMCEPopup_autoResize() {
window.moveTo(x, y);
}
}
-}
+};
-// Re-patch it
-if (tinyMCE.settings["dialog_type"] == "window") {
- tinyMCE.closeDialog = function() {
- // Remove div or close window
- if (tinyMCE.settings["dialog_type"] == "div") {
- var div = document.getElementById(tinyMCE._currentDialog);
- if (div)
- div.parentNode.removeChild(div);
- } else
- window.close();
- };
-}
+TinyMCEPopup.prototype.getWindowArg = function(name, default_value) {
+ return tinyMCE.getWindowArg(name, default_value);
+};
-// Add onload trigger
-tinyMCE.addEvent(window, "load", TinyMCEPlugin_onLoad);
+TinyMCEPopup.prototype.execCommand = function(command, user_interface, value) {
+ var inst = tinyMCE.selectedInstance;
-// Output Popup CSS class
-document.write(' ');
+ // Restore selection
+ if (this.storeSelection) {
+ inst.getWin().focus();
+ inst.execCommand('mceRestoreSelection');
+ }
+
+ inst.execCommand(command, user_interface, value);
+
+ // Store selection
+ if (this.storeSelection)
+ inst.execCommand('mceStoreSelection');
+};
+
+TinyMCEPopup.prototype.close = function() {
+ tinyMCE.closeWindow(window);
+};
+
+TinyMCEPopup.prototype.pickColor = function(e, element_id) {
+ tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
+ element_id : element_id,
+ document : document,
+ window : window,
+ store_selection : false
+ });
+};
+
+TinyMCEPopup.prototype.openBrowser = function(element_id, type, option) {
+ var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
+ var url = document.getElementById(element_id).value;
+
+ tinyMCE.setWindowArg("window", window);
+ tinyMCE.setWindowArg("document", document);
+
+ // Call to external callback
+ if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
+ alert("Callback function: " + cb + " could not be found.");
+ else
+ eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
+};
+
+// Setup global instance
+var tinyMCEPopup = new TinyMCEPopup();
+
+tinyMCEPopup.init();
diff --git a/wp-includes/js/tinymce/tiny_mce_src.js b/wp-includes/js/tinymce/tiny_mce_src.js
index ee3cdc0bd6..0147c8ea9c 100644
--- a/wp-includes/js/tinymce/tiny_mce_src.js
+++ b/wp-includes/js/tinymce/tiny_mce_src.js
@@ -1,13 +1,17 @@
/**
* $RCSfile: tiny_mce_src.js,v $
- * $Revision: 1.215 $
- * $Date: 2005/06/23 12:04:41 $
+ * $Revision: 1.233 $
+ * $Date: 2005/08/26 15:20:32 $
*
* @author Moxiecode
- * @copyright Copyright 2004, Moxiecode Systems AB, All rights reserved.
+ * @copyright Copyright 2004, Moxiecode Systems AB, All rights reserved.
*/
function TinyMCE() {
+ this.majorVersion = "2";
+ this.minorVersion = "0RC2";
+ this.releaseDate = "2005-09-12";
+
this.instances = new Array();
this.stickyClassesLookup = new Array();
this.windowArgs = new Array();
@@ -80,7 +84,9 @@ TinyMCE.prototype.init = function(settings) {
this.defParam("docs_language", this.settings['language']);
this.defParam("elements", "");
this.defParam("textarea_trigger", "mce_editable");
- this.defParam("valid_elements", "+a[name|href|target|title|class],strong/b[class],em/i[class],strike[class],u[class],+p[dir|class|align],ol,ul,li,br,img[class|src|border=0|alt|title|hspace|vspace|width|height|align],sub,sup,blockquote[dir|style],table[border=0|cellspacing|cellpadding|width|height|class|align],tr[class|rowspan|width|height|align|valign],td[dir|class|colspan|rowspan|width|height|align|valign],div[dir|class|align],span[class|align],pre[class|align],address[class|align],h1[dir|class|align],h2[dir|class|align],h3[dir|class|align],h4[dir|class|align],h5[dir|class|align],h6[dir|class|align],hr");
+ this.defParam("editor_selector", "");
+ this.defParam("editor_deselector", "mceNoEditor");
+ this.defParam("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/b[class|style],-em/i[class|style],-strike[class|style],-u[class|style],+p[style|dir|class|align],-ol[class],-ul[class],-li[class],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border=0|alt|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],-td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align],address[class|align],-h1[style|dir|class|align],-h2[style|dir|class|align],-h3[style|dir|class|align],-h4[style|dir|class|align],-h5[style|dir|class|align],-h6[style|dir|class|align],hr[class]");
this.defParam("extended_valid_elements", "");
this.defParam("invalid_elements", "");
this.defParam("encoding", "");
@@ -102,16 +108,14 @@ TinyMCE.prototype.init = function(settings) {
this.defParam("custom_undo_redo_levels", -1);
this.defParam("custom_undo_redo_keyboard_shortcuts", true);
this.defParam("verify_css_classes", false);
- this.defParam("trim_span_elements", true);
this.defParam("verify_html", true);
this.defParam("apply_source_formatting", false);
this.defParam("directionality", "ltr");
- this.defParam("auto_cleanup_word", false);
this.defParam("cleanup_on_startup", false);
this.defParam("inline_styles", false);
this.defParam("convert_newlines_to_brs", false);
- this.defParam("auto_reset_designmode", false);
- this.defParam("entities", "160,nbsp,38,amp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,181,micro,183,middot,8226,bull,8230,hellip,8242,prime,8243,Prime,167,sect,182,para,223,szlig,8249,lsaquo,8250,rsaquo,171,laquo,187,raquo,8216,lsquo,8217,rsquo,8220,ldquo,8221,rdquo,8218,sbquo,8222,bdquo,60,lt,62,gt,8804,le,8805,ge,8211,ndash,8212,mdash,175,macr,8254,oline,164,curren,166,brvbar,168,uml,161,iexcl,191,iquest,710,circ,732,tilde,176,deg,8722,minus,177,plusmn,247,divide,8260,frasl,215,times,185,sup1,178,sup2,179,sup3,188,frac14,189,frac12,190,frac34,402,fnof,8747,int,8721,sum,8734,infin,8730,radic,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8712,isin,8713,notin,8715,ni,8719,prod,8743,and,8744,or,172,not,8745,cap,8746,cup,8706,part,8704,forall,8707,exist,8709,empty,8711,nabla,8727,lowast,8733,prop,8736,ang,180,acute,184,cedil,170,ordf,186,ordm,8224,dagger,8225,Dagger,192,Agrave,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,202,Ecirc,203,Euml,204,Igrave,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,212,Ocirc,213,Otilde,214,Ouml,216,Oslash,338,OElig,217,Ugrave,219,Ucirc,220,Uuml,376,Yuml,222,THORN,224,agrave,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,234,ecirc,235,euml,236,igrave,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,244,ocirc,245,otilde,246,ouml,248,oslash,339,oelig,249,ugrave,251,ucirc,252,uuml,254,thorn,255,yuml,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,8501,alefsym,982,piv,8476,real,977,thetasym,978,upsih,8472,weierp,8465,image,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8756,there4,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,173,shy,233,eacute");
+ this.defParam("auto_reset_designmode", true);
+ this.defParam("entities", "160,nbsp,38,amp,34,quot,162,cent,8364,euro,163,pound,165,yen,169,copy,174,reg,8482,trade,8240,permil,181,micro,183,middot,8226,bull,8230,hellip,8242,prime,8243,Prime,167,sect,182,para,223,szlig,8249,lsaquo,8250,rsaquo,171,laquo,187,raquo,8216,lsquo,8217,rsquo,8220,ldquo,8221,rdquo,8218,sbquo,8222,bdquo,60,lt,62,gt,8804,le,8805,ge,8211,ndash,8212,mdash,175,macr,8254,oline,164,curren,166,brvbar,168,uml,161,iexcl,191,iquest,710,circ,732,tilde,176,deg,8722,minus,177,plusmn,247,divide,8260,frasl,215,times,185,sup1,178,sup2,179,sup3,188,frac14,189,frac12,190,frac34,402,fnof,8747,int,8721,sum,8734,infin,8730,radic,8764,sim,8773,cong,8776,asymp,8800,ne,8801,equiv,8712,isin,8713,notin,8715,ni,8719,prod,8743,and,8744,or,172,not,8745,cap,8746,cup,8706,part,8704,forall,8707,exist,8709,empty,8711,nabla,8727,lowast,8733,prop,8736,ang,180,acute,184,cedil,170,ordf,186,ordm,8224,dagger,8225,Dagger,192,Agrave,194,Acirc,195,Atilde,196,Auml,197,Aring,198,AElig,199,Ccedil,200,Egrave,202,Ecirc,203,Euml,204,Igrave,206,Icirc,207,Iuml,208,ETH,209,Ntilde,210,Ograve,212,Ocirc,213,Otilde,214,Ouml,216,Oslash,338,OElig,217,Ugrave,219,Ucirc,220,Uuml,376,Yuml,222,THORN,224,agrave,226,acirc,227,atilde,228,auml,229,aring,230,aelig,231,ccedil,232,egrave,234,ecirc,235,euml,236,igrave,238,icirc,239,iuml,240,eth,241,ntilde,242,ograve,244,ocirc,245,otilde,246,ouml,248,oslash,339,oelig,249,ugrave,251,ucirc,252,uuml,254,thorn,255,yuml,914,Beta,915,Gamma,916,Delta,917,Epsilon,918,Zeta,919,Eta,920,Theta,921,Iota,922,Kappa,923,Lambda,924,Mu,925,Nu,926,Xi,927,Omicron,928,Pi,929,Rho,931,Sigma,932,Tau,933,Upsilon,934,Phi,935,Chi,936,Psi,937,Omega,945,alpha,946,beta,947,gamma,948,delta,949,epsilon,950,zeta,951,eta,952,theta,953,iota,954,kappa,955,lambda,956,mu,957,nu,958,xi,959,omicron,960,pi,961,rho,962,sigmaf,963,sigma,964,tau,965,upsilon,966,phi,967,chi,968,psi,969,omega,8501,alefsym,982,piv,8476,real,977,thetasym,978,upsih,8472,weierp,8465,image,8592,larr,8593,uarr,8594,rarr,8595,darr,8596,harr,8629,crarr,8656,lArr,8657,uArr,8658,rArr,8659,dArr,8660,hArr,8756,there4,8834,sub,8835,sup,8836,nsub,8838,sube,8839,supe,8853,oplus,8855,otimes,8869,perp,8901,sdot,8968,lceil,8969,rceil,8970,lfloor,8971,rfloor,9001,lang,9002,rang,9674,loz,9824,spades,9827,clubs,9829,hearts,9830,diams,8194,ensp,8195,emsp,8201,thinsp,8204,zwnj,8205,zwj,8206,lrm,8207,rlm,173,shy,233,eacute,237,iacute,243,oacute,250,uacute,193,Aacute,225,aacute,201,Eacute,205,Iacute,211,Oacute,218,Uacute,221,Yacute,253,yacute");
this.defParam("entity_encoding", "named");
this.defParam("cleanup_callback", "");
this.defParam("add_unload_trigger", true);
@@ -125,6 +129,7 @@ TinyMCE.prototype.init = function(settings) {
this.defParam("submit_patch", true);
this.defParam("browsers", "msie,safari,gecko");
this.defParam("dialog_type", "window");
+ this.defParam("convert_fonts_to_styles", true);
// Browser check IE
if (this.isMSIE && this.settings['browsers'].indexOf('msie') == -1)
@@ -146,7 +151,8 @@ TinyMCE.prototype.init = function(settings) {
theme = this.settings['theme'];
- this.blockRegExp = new RegExp("^(h1|h2|h3|h4|h5|h6|p|div|address|pre|form|table|li|ol|ul|td)$", "i");
+ this.blockRegExp = new RegExp("^(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td)$", "i");
+ this.posKeyCodes = new Array(13,45,36,35,33,34,37,38,39,40);
// Theme url
this.settings['theme_href'] = tinyMCE.baseURL + "/themes/" + theme;
@@ -163,7 +169,7 @@ TinyMCE.prototype.init = function(settings) {
else
this.settings['content_css'] = cssPath;
} else
- this.settings['content_css'] = tinyMCE.baseURL + "/themes/" + theme + "/editor_content.css";
+ this.settings['content_css'] = '';
if (tinyMCE.getParam("popups_css", false)) {
var cssPath = tinyMCE.getParam("popups_css", "");
@@ -174,7 +180,7 @@ TinyMCE.prototype.init = function(settings) {
else
this.settings['popups_css'] = cssPath;
} else
- this.settings['popups_css'] = tinyMCE.baseURL + "/themes/" + theme + "/editor_popup.css";
+ this.settings['popups_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css";
if (tinyMCE.getParam("editor_css", false)) {
var cssPath = tinyMCE.getParam("editor_css", "");
@@ -185,7 +191,7 @@ TinyMCE.prototype.init = function(settings) {
else
this.settings['editor_css'] = cssPath;
} else
- this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/editor_ui.css";
+ this.settings['editor_css'] = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
if (tinyMCE.settings['debug']) {
var msg = "Debug: \n";
@@ -205,8 +211,8 @@ TinyMCE.prototype.init = function(settings) {
// Only do this once
if (this.configs.length == 0) {
// Is Safari enabled
-// if (this.isSafari)
-// alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.");
+ if (this.isSafari && this.getParam('safari_warning', true))
+ alert("Safari support is very limited and should be considered experimental.\nSo there is no need to even submit bugreports on this early version.");
tinyMCE.addEvent(window, "load", TinyMCE.prototype.onLoad);
@@ -260,6 +266,9 @@ TinyMCE.prototype.loadCSS = function(url) {
};
TinyMCE.prototype.importCSS = function(doc, css_file) {
+ if (css_file == '')
+ return;
+
if (tinyMCE.isMSIE)
var styleSheet = doc.createStyleSheet(css_file);
else {
@@ -299,7 +308,7 @@ TinyMCE.prototype.updateContent = function(form_element_name) {
tinyMCE._setHTML(doc, inst.formElement.value);
if (!tinyMCE.isMSIE)
- doc.body.innerHTML = tinyMCE._cleanupHTML(doc, this.settings, doc.body, inst.visualAid);
+ doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, doc.body, inst.visualAid);
}
}
};
@@ -333,9 +342,15 @@ TinyMCE.prototype.triggerSave = function(skip_cleanup, skip_callback) {
tinyMCE._setHTML(inst.getDoc(), inst.getBody().innerHTML);
- var htm = skip_cleanup ? inst.getBody().innerHTML : tinyMCE._cleanupHTML(inst.getDoc(), this.settings, inst.getBody(), this.visualAid, true);
+ // Remove visual aids when cleanup is disabled
+ if (inst.settings['cleanup'] == false) {
+ tinyMCE.handleVisualAid(inst.getBody(), true, false, inst);
+ tinyMCE._setEventsEnabled(inst.getBody(), false);
+ }
- //var htm = tinyMCE._cleanupHTML(inst.getDoc(), tinyMCE.settings, inst.getBody(), false, true);
+ tinyMCE._customCleanup(inst, "submit_content_dom", inst.contentWindow.document.body);
+ var htm = skip_cleanup ? inst.getBody().innerHTML : tinyMCE._cleanupHTML(inst, inst.getDoc(), this.settings, inst.getBody(), this.visualAid, true);
+ htm = tinyMCE._customCleanup(inst, "submit_content", htm);
if (tinyMCE.settings["encoding"] == "xml" || tinyMCE.settings["encoding"] == "html")
htm = tinyMCE.convertStringToXML(htm);
@@ -359,19 +374,27 @@ TinyMCE.prototype.triggerSave = function(skip_cleanup, skip_callback) {
}
};
-TinyMCE.prototype._convertOnClick = function(node) {
- // Skip on MSIE < 6+
- if (tinyMCE.isMSIE5)
- return;
+TinyMCE.prototype._setEventsEnabled = function(node, state) {
+ var events = new Array('onfocus','onblur','onclick','ondblclick',
+ 'onmousedown','onmouseup','onmouseover','onmousemove',
+ 'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup');
- // Convert all onclick to mce_onclick
var elms = node.getElementsByTagName("a");
for (var i=0; i", "", "gi");
+ content = tinyMCE.regexpReplace(content, "", "", "gi");
content = tinyMCE.regexpReplace(content, " ", " ", "gi");
inst.getBody().innerHTML = content;
@@ -649,13 +681,11 @@ TinyMCE.prototype.setupContent = function(editor_id) {
tinyMCE._setHTML(inst.getDoc(), content);
// Produces permission denied error in MSIE 5.5
- eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');
+ eval('try {inst.getBody().innerHTML = tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody());} catch(e) {}');
} else
tinyMCE._setHTML(inst.getDoc(), content);
}
- tinyMCE._convertOnClick(inst.getBody());
-
// Fix for bug #957681
//inst.getDoc().designMode = inst.getDoc().designMode;
@@ -666,14 +696,16 @@ TinyMCE.prototype.setupContent = function(editor_id) {
else
inst.formElement = parentElm.nextSibling;
- tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual']);
+ tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings['visual'], inst);
tinyMCE.executeCallback('setupcontent_callback', '_setupContent', 0, editor_id, inst.getBody(), inst.getDoc());
// Re-add design mode on mozilla
if (!tinyMCE.isMSIE)
TinyMCE.prototype.addEventHandlers(editor_id);
- inst.startContent = inst.getBody().innerHTML;
+ // Add blur handler
+ if (tinyMCE.isMSIE)
+ tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE.prototype.eventPatch);
// Trigger node change, this call locks buttons for tables and so forth
tinyMCE.selectedInstance = inst;
@@ -681,7 +713,12 @@ TinyMCE.prototype.setupContent = function(editor_id) {
tinyMCE.triggerNodeChange(false, true);
// Call custom DOM cleanup
- tinyMCE._customCleanup("insert_to_editor_dom", inst.contentWindow.document.body);
+ tinyMCE._customCleanup(inst, "insert_to_editor_dom", inst.getBody());
+ tinyMCE._customCleanup(inst, "setup_content_dom", inst.getBody());
+ tinyMCE._setEventsEnabled(inst.getBody(), true);
+
+ inst.startContent = tinyMCE.trim(inst.getBody().innerHTML);
+ inst.undoLevels[inst.undoLevels.length] = inst.startContent;
};
TinyMCE.prototype.cancelEvent = function(e) {
@@ -702,17 +739,53 @@ TinyMCE.prototype.removeTinyMCEFormElements = function(form_obj) {
}
};
+TinyMCE.prototype.accessibleEventHandler = function(e) {
+ var win = this._win;
+ e = tinyMCE.isMSIE ? win.event : e;
+ var elm = tinyMCE.isMSIE ? e.srcElement : e.target;
+
+ // Piggyback onchange
+ if (elm.nodeName == "SELECT" && !elm.oldonchange) {
+ elm.oldonchange = elm.onchange;
+ elm.onchange = null;
+ }
+
+ // Execute onchange and remove piggyback
+ if (e.keyCode == 13) {
+ elm.onchange = elm.oldonchange;
+ elm.onchange();
+ elm.oldonchange = null;
+ tinyMCE.cancelEvent(e);
+ }
+};
+
+TinyMCE.prototype.addSelectAccessibility = function(e, select, win) {
+ // Add event handlers
+ if (!select._isAccessible) {
+ select.onkeydown = tinyMCE.accessibleEventHandler;
+ select._isAccessible = true;
+ select._win = win;
+ }
+};
+
TinyMCE.prototype.handleEvent = function(e) {
// Remove odd, error
if (typeof(tinyMCE) == "undefined")
return true;
- //debug(e.type + " " + e.target.nodeName + " " + (e.relatedTarget ? e.relatedTarget.nodeName : ""));
+ //tinyMCE.debug(e.type + " " + e.target.nodeName + " " + (e.relatedTarget ? e.relatedTarget.nodeName : ""));
switch (e.type) {
+ case "blur":
+ if (tinyMCE.selectedInstance)
+ tinyMCE.selectedInstance.execCommand('mceEndTyping');
+
+ return;
+
case "submit":
tinyMCE.removeTinyMCEFormElements(tinyMCE.isMSIE ? window.event.srcElement : e.target);
tinyMCE.triggerSave();
+ tinyMCE.isNotDirty = true;
return;
case "reset":
@@ -722,27 +795,9 @@ TinyMCE.prototype.handleEvent = function(e) {
if (document.forms[i] == formObj)
window.setTimeout('tinyMCE.resetForm(' + i + ');', 10);
}
+
return;
- case "paste":
- if (tinyMCE.settings['auto_cleanup_word']) {
- var editorId = e.target.editorId;
-
- if (!editorId)
- editorId = e.target.ownerDocument.editorId;
-
- if (editorId)
- window.setTimeout("tinyMCE.execInstanceCommand('" + editorId + "', 'mceCleanupWord', false, null);", 1);
- }
-
- break;
-
- case "beforecut":
- case "beforepaste":
- if (tinyMCE.selectedInstance)
- tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");
- break;
-
case "keypress":
if (e.target.editorId) {
tinyMCE.selectedInstance = tinyMCE.instances[e.target.editorId];
@@ -768,6 +823,7 @@ TinyMCE.prototype.handleEvent = function(e) {
// Insert P element instead of BR
if (tinyMCE.selectedInstance._insertPara(e)) {
// Cancel event
+ tinyMCE.execCommand("mceAddUndoLevel");
e.preventDefault();
return false;
}
@@ -778,18 +834,14 @@ TinyMCE.prototype.handleEvent = function(e) {
// Insert P element instead of BR
if (tinyMCE.selectedInstance._handleBackSpace(e.type)) {
// Cancel event
+ tinyMCE.execCommand("mceAddUndoLevel");
e.preventDefault();
return false;
}
}
// Mozilla custom key handling
- if (!tinyMCE.isMSIE && e.ctrlKey && tinyMCE.settings['custom_undo_redo']) {
- if (e.charCode == 120 || e.charCode == 118) { // Ctrl+X, Ctrl+V
- tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");
- return;
- }
-
+ if (tinyMCE.isGecko && e.ctrlKey && tinyMCE.settings['custom_undo_redo']) {
if (tinyMCE.settings['custom_undo_redo_keyboard_shortcuts']) {
if (e.charCode == 122) { // Ctrl+Z
tinyMCE.selectedInstance.execCommand("Undo");
@@ -833,28 +885,6 @@ TinyMCE.prototype.handleEvent = function(e) {
}
}
- if (tinyMCE.settings['custom_undo_redo']) {
- // Check if it's a position key press
- var keys = new Array(13,45,36,35,33,34,37,38,39,40);
- var posKey = false;
- for (var i=0; i 18 && e.keyCode != 255)) {
- tinyMCE.selectedInstance.execCommand("mceAddUndoLevel");
- tinyMCE.selectedInstance.typing = true;
- tinyMCE.triggerNodeChange(false);
- }
-
- if (posKey && e.type == "keyup")
- tinyMCE.triggerNodeChange(false);
-
- var keys = new Array(8,46); // Backspace,Delete
- for (var i=0; i 0)
+ return;
+
+ if (val.indexOf('%') == -1)
+ val += 'px';
+ break;
+
+ case "vspace":
+ case "hspace":
+ elm.style.marginTop = val + "px";
+ elm.style.marginBottom = val + "px";
+ elm.removeAttribute(attrib);
+ return;
+
+ case "align":
+ if (elm.nodeName == "IMG") {
+ if (tinyMCE.isMSIE)
+ elm.style.styleFloat = val;
+ else
+ elm.style.cssFloat = val;
+ } else
+ elm.style.textAlign = val;
+
+ elm.removeAttribute(attrib);
+ return;
+ }
+
+ if (val != '') {
+ eval('elm.style.' + style + ' = val;');
+ elm.removeAttribute(attrib);
+ }
}
- }
+ } else {
+ if (style == '')
+ return;
- // Handle table, td and img elements
- if (eName == "TABLE" || eName == "TD" || eName == "IMG") {
- var value;
+ var val = eval('elm.style.' + style) == '' ? tinyMCE.getAttrib(elm, attrib) : eval('elm.style.' + style);
+ val = val == null ? '' : '' + val;
- // Setup width
- value = tinyMCE.isMSIE ? elm.width : elm.getAttribute("width");
- if (value && value != "") {
- if (typeof(value) != "string" || !value.indexOf("%"))
- value += "px";
+ switch (attrib) {
+ // Always move background to style
+ case "background":
+ if (val.indexOf('url') == -1 && val != '')
+ val = "url('" + val + "');";
- elm.style.width = value;
+ if (val != '') {
+ elm.style.backgroundImage = val;
+ elm.removeAttribute(attrib);
+ }
+ return;
+
+ case "border":
+ case "width":
+ case "height":
+ val = val.replace('px', '');
+ break;
+
+ case "align":
+ if (tinyMCE.getAttrib(elm, 'align') == '') {
+ if (elm.nodeName == "IMG") {
+ if (tinyMCE.isMSIE && elm.style.styleFloat != '') {
+ val = elm.style.styleFloat;
+ style = 'styleFloat';
+ } else if (tinyMCE.isGecko && elm.style.cssFloat != '') {
+ val = elm.style.cssFloat;
+ style = 'cssFloat';
+ }
+ }
+ }
+ break;
}
- // Setup height
- value = tinyMCE.isMSIE ? elm.height : elm.getAttribute("height");
- if (value && value != "") {
- if (typeof(value) != "string" || !value.indexOf("%"))
- value += "px";
-
- elm.style.height = value;
+ if (val != '') {
+ elm.removeAttribute(attrib);
+ elm.setAttribute(attrib, val);
+ eval('elm.style.' + style + ' = "";');
}
-
- // Setup border
- value = tinyMCE.isMSIE ? elm.border : elm.getAttribute("border");
- if (value && value != "" && (value != "0" && eName != "TABLE")) {
- elm.style.borderWidth = value + "px";
- }
- }
-
- // Setup align
- value = elm.getAttribute("align");
- if (value && value != "") {
- if (elm.nodeName.toLowerCase() == "img") {
- if (tinyMCE.isMSIE)
- elm.style.styleFloat = value;
- else
- elm.style.cssFloat = value;
- } else
- elm.style.textAlign = value;
- }
-
- // Setup vspace
- value = elm.getAttribute("vspace");
- if (value && value != "") {
- elm.style.marginTop = value + "px";
- elm.style.marginBottom = value + "px";
- }
-
- // Setup hspace
- value = elm.getAttribute("hspace");
- if (value && value != "") {
- elm.style.marginLeft = value + "px";
- elm.style.marginRight = value + "px";
}
};
@@ -1459,12 +1505,6 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
var attribMustBeValue = null;
var verified = false;
- // Inline styling, skip them
- if (tinyMCE.cleanup_inline_styles && (element_name == "table" || element_name == "td" || element_name == "img")) {
- if (attribName == "width" || attribName == "height" || attribName == "border" || attribName == "align" || attribName == "valign" || attribName == "hspace" || attribName == "vspace")
- return null;
- }
-
// Mozilla attibute, remove them
if (attribName.indexOf('moz_') != -1)
return null;
@@ -1508,10 +1548,6 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
}
}
- // Allways pass styles on table and td elements if visual_aid
- if ((element_name == "table" || element_name == "td") && attribName == "style")
- verified = true;
-
if (!verified)
return false;
} else
@@ -1524,30 +1560,19 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
attribValue = element_node.size;
break;
+ case "width":
+ case "height":
+ case "border":
+ // Old MSIE needs this
+ if (tinyMCE.isMSIE5)
+ attribValue = eval("element_node." + attribName);
+ break;
+
case "color":
if (tinyMCE.isMSIE5 && element_name == "font")
attribValue = element_node.color;
break;
- case "width":
- // MSIE 5.5 issue
- if (tinyMCE.isMSIE)
- attribValue = element_node.width;
- break;
-
- case "height":
- // MSIE 5.5 issue
- if (tinyMCE.isMSIE)
- attribValue = element_node.height;
- break;
-
- case "border":
- // MSIE 5.5 issue
- if (tinyMCE.isMSIE)
- attribValue = element_node.border;
- break;
-
-// case "className":
case "class":
if (element_name == "table" || element_name == "td") {
// Handle visual aid
@@ -1558,50 +1583,30 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
if (!tinyMCE._verifyClass(element_node) || attribValue == "")
return null;
-// if (tinyMCE.isMSIE)
-// attribValue = node.getAttribute('className');
+ break;
+
+ case "onfocus":
+ case "onblur":
+ case "onclick":
+ case "ondblclick":
+ case "onmousedown":
+ case "onmouseup":
+ case "onmouseover":
+ case "onmousemove":
+ case "onmouseout":
+ case "onkeypress":
+ case "onkeydown":
+ case "onkeydown":
+ case "onkeyup":
+ attribValue = tinyMCE.cleanupEventStr("" + attribValue);
+
+ if (attribValue.indexOf('return false;') == 0)
+ attribValue = attribValue.substring(14);
break;
case "style":
- attribValue = element_node.style.cssText.toLowerCase();
-
- // Compress borders some
- if (tinyMCE.isMSIE) {
- var border = element_node.style.border;
- var bt = element_node.style.borderTop;
- var bl = element_node.style.borderLeft;
- var br = element_node.style.borderRight;
- var bb = element_node.style.borderBottom;
-
- // All the same
- if (border != "" && (bt == border && bl == border && br == border && bb == border)) {
- attribValue = tinyMCE.regexpReplace(attribValue, 'border-top: ' + border + '?; ?', '');
- attribValue = tinyMCE.regexpReplace(attribValue, 'border-left: ' + border + '?; ?', '');
- attribValue = tinyMCE.regexpReplace(attribValue, 'border-right: ' + border + '?; ?', '');
- attribValue = tinyMCE.regexpReplace(attribValue, 'border-bottom: ' + border + '?;( ?)', 'border: ' + border + ';$1');
- }
- }
- break;
-
- // Handle onclick
- case "onclick":
- case "mce_onclick":
- // Skip on MSIE < 6+
- if (tinyMCE.isMSIE5)
- break;
-
- // Fix onclick attrib
- if (tinyMCE.cleanup_on_save) {
- if (element_node.getAttribute("mce_onclick")) {
- attribName = "onclick";
- attribValue = "" + element_node.getAttribute("mce_onclick");
- }
- } else {
- if (attribName == "onclick" && !tinyMCE.cleanup_on_save)
- return null;
- }
-
+ attribValue = tinyMCE.serializeStyle(tinyMCE.parseStyle(element_node.style.cssText));
break;
// Convert the URLs of these
@@ -1632,7 +1637,6 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
// Skip these
case "_moz-userdefined":
case "editorid":
- case "editor_id":
case "mce_real_href":
case "mce_real_src":
return null;
@@ -1660,6 +1664,78 @@ TinyMCE.prototype._cleanupAttribute = function(valid_attributes, element_name, a
return attrib;
};
+TinyMCE.prototype.parseStyle = function(str) {
+ var ar = new Array();
+ var st = str.split(';');
+
+ for (var i=0; i';
}
- // Handle inline styles
- if (tinyMCE.cleanup_inline_styles)
- tinyMCE._fixInlineStyles(node);
+ // Handle inline/outline styles
+ if (tinyMCE.cleanup_inline_styles) {
+ var re = new RegExp("^(TABLE|TD|TR|IMG|HR)$");
+ if (re.test(node.nodeName)) {
+ tinyMCE._moveStyle(node, 'width', 'width');
+ tinyMCE._moveStyle(node, 'height', 'height');
+ tinyMCE._moveStyle(node, 'borderWidth', 'border');
+ tinyMCE._moveStyle(node, '', 'vspace');
+ tinyMCE._moveStyle(node, '', 'hspace');
+ tinyMCE._moveStyle(node, 'textAlign', 'align');
+ tinyMCE._moveStyle(node, 'backgroundColor', 'bgColor');
+ tinyMCE._moveStyle(node, 'borderColor', 'borderColor');
+ tinyMCE._moveStyle(node, 'backgroundImage', 'background');
+
+ // Refresh element in old MSIE
+ if (tinyMCE.isMSIE5)
+ node.outerHTML = node.outerHTML;
+ } else if (tinyMCE.isBlockElement(node))
+ tinyMCE._moveStyle(node, 'textAlign', 'align');
+
+ if (node.nodeName == "FONT")
+ tinyMCE._moveStyle(node, 'color', 'color');
+ }
// Set attrib data
if (elementValidAttribs) {
@@ -1773,79 +1873,25 @@ TinyMCE.prototype.cleanupNode = function(node) {
}
}
- // Remove non needed span elements
- if (elementName == "span" && tinyMCE.cleanup_trim_span_elements) {
- var re = new RegExp('^[ \t]+', 'g');
- var onlyWhiteSpace = true;
- for (var a=0; a 0) {
for (var i=0; i";
} else {
- // Allways leave anchor elements open
- if (openTag)
- output += "<" + elementName + elementAttribs + ">" + elementName + ">";
- else {
- // No children
- output += "<" + elementName + elementAttribs + " />";
+ if (!nonEmptyTag) {
+ if (openTag)
+ output += "<" + elementName + elementAttribs + ">" + elementName + ">";
+ else
+ output += "<" + elementName + elementAttribs + " />";
}
}
@@ -1950,6 +1995,9 @@ TinyMCE.prototype._getCleanupElementName = function(chunk) {
if (chunk.charAt(0) == '+')
chunk = chunk.substring(1);
+ if (chunk.charAt(0) == '-')
+ chunk = chunk.substring(1);
+
if ((pos = chunk.indexOf('/')) != -1)
chunk = chunk.substring(0, pos);
@@ -2044,12 +2092,12 @@ TinyMCE.prototype._initCleanup = function() {
tinyMCE.settings['cleanup_entities']['c' + entities[i]] = entities[i+1];
};
-TinyMCE.prototype._cleanupHTML = function(doc, config, element, visual, on_save) {
+TinyMCE.prototype._cleanupHTML = function(inst, doc, config, element, visual, on_save) {
if (!tinyMCE.settings['cleanup'])
return element.innerHTML;
// Call custom cleanup code
- tinyMCE._customCleanup(on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body);
+ tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body);
// Set these for performance
tinyMCE.cleanup_validElements = tinyMCE.settings['cleanup_validElements'];
@@ -2061,7 +2109,6 @@ TinyMCE.prototype._cleanupHTML = function(doc, config, element, visual, on_save)
tinyMCE.cleanup_verify_css_classes = tinyMCE.settings['verify_css_classes'];
tinyMCE.cleanup_visual_table_class = tinyMCE.settings['visual_table_class'];
tinyMCE.cleanup_apply_source_formatting = tinyMCE.settings['apply_source_formatting'];
- tinyMCE.cleanup_trim_span_elements = tinyMCE.settings['trim_span_elements'];
tinyMCE.cleanup_inline_styles = tinyMCE.settings['inline_styles'];
tinyMCE.cleanup_visual_aid = visual;
tinyMCE.cleanup_on_save = on_save;
@@ -2070,22 +2117,31 @@ TinyMCE.prototype._cleanupHTML = function(doc, config, element, visual, on_save)
var startTime = new Date().getTime();
- tinyMCE._convertOnClick(element);
-
// Cleanup madness that breaks the editor in MSIE
if (tinyMCE.isMSIE) {
- element.innerHTML = tinyMCE.regexpReplace(element.innerHTML, '[ \n\r]*
[ \n\r]*', ' ', 'gi');
+ // Remove null ids from HR elements, results in runtime error
+ var nodes = element.getElementsByTagName("hr");
+ for (var i=0; i[ \n\r]*[ \n\r]*', ' ', 'gi');
element.innerHTML = tinyMCE.regexpReplace(element.innerHTML, '', '', 'gi');
}
var html = this.cleanupNode(element);
if (tinyMCE.settings['debug'])
- alert("Cleanup process executed in: " + (new Date().getTime()-startTime) + " ms.");
+ tinyMCE.debug("Cleanup process executed in: " + (new Date().getTime()-startTime) + " ms.");
// Remove pesky HR paragraphs
html = tinyMCE.regexpReplace(html, '
', ' ');
html = tinyMCE.regexpReplace(html, '
', ' ');
+ html = tinyMCE.regexpReplace(html, '\\s* \\s* ', ' ');
+
+ // Remove empty achors
+ html = html.replace(new RegExp('(.*?) ', 'gi'), '$1');
// Remove some mozilla crap
if (!tinyMCE.isMSIE)
@@ -2112,7 +2168,7 @@ TinyMCE.prototype._cleanupHTML = function(doc, config, element, visual, on_save)
html = html.replace(new RegExp('\r|\n', 'g'), ' ');
// Call custom cleanup code
- html = tinyMCE._customCleanup(on_save ? "get_from_editor" : "insert_to_editor", html);
+ html = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", html);
// Emtpy node, return empty
var chk = tinyMCE.regexpReplace(html, "[ \t\r\n]", "").toLowerCase();
@@ -2125,25 +2181,8 @@ TinyMCE.prototype._cleanupHTML = function(doc, config, element, visual, on_save)
return html;
};
-TinyMCE.prototype.setAttrib = function(element, name, value, no_fix_value) {
- if (!no_fix_value && value != null) {
- var re = new RegExp('[^0-9%]', 'g');
- value = value.replace(re, '');
- }
-
- if (value != null && value != "")
- element.setAttribute(name, value);
- else
- element.removeAttribute(name);
-
- if (value != null && value != "")
- element.setAttribute(name, value);
- else
- element.removeAttribute(name);
-};
-
TinyMCE.prototype.insertLink = function(href, target, title, onclick, style_class) {
- this.execCommand("mceAddUndoLevel");
+ tinyMCE.execCommand('mceBeginUndoLevel');
if (this.selectedInstance && this.selectedElement && this.selectedElement.nodeName.toLowerCase() == "img") {
var doc = this.selectedInstance.getDoc();
@@ -2159,7 +2198,7 @@ TinyMCE.prototype.insertLink = function(href, target, title, onclick, style_clas
tinyMCE.setAttrib(linkElement, 'href', href);
tinyMCE.setAttrib(linkElement, 'target', target);
tinyMCE.setAttrib(linkElement, 'title', title);
- tinyMCE.setAttrib(linkElement, 'mce_onclick', onclick);
+ tinyMCE.setAttrib(linkElement, 'onclick', onclick);
tinyMCE.setAttrib(linkElement, 'class', style_class);
if (newLink) {
@@ -2186,7 +2225,7 @@ TinyMCE.prototype.insertLink = function(href, target, title, onclick, style_clas
tinyMCE.setAttrib(elementArray[i], 'mce_real_href', href);
tinyMCE.setAttrib(elementArray[i], 'target', target);
tinyMCE.setAttrib(elementArray[i], 'title', title);
- tinyMCE.setAttrib(elementArray[i], 'mce_onclick', onclick);
+ tinyMCE.setAttrib(elementArray[i], 'onclick', onclick);
tinyMCE.setAttrib(elementArray[i], 'class', style_class);
}
@@ -2199,17 +2238,19 @@ TinyMCE.prototype.insertLink = function(href, target, title, onclick, style_clas
tinyMCE.setAttrib(this.linkElement, 'mce_real_href', href);
tinyMCE.setAttrib(this.linkElement, 'target', target);
tinyMCE.setAttrib(this.linkElement, 'title', title);
- tinyMCE.setAttrib(this.linkElement, 'mce_onclick', onclick);
+ tinyMCE.setAttrib(this.linkElement, 'onclick', onclick);
tinyMCE.setAttrib(this.linkElement, 'class', style_class);
}
+
+ tinyMCE.execCommand('mceEndUndoLevel');
};
TinyMCE.prototype.insertImage = function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
+ tinyMCE.execCommand('mceBeginUndoLevel');
+
if (src == "")
return;
- this.execCommand("mceAddUndoLevel");
-
if (!this.imgElement && tinyMCE.isSafari) {
var html = "";
@@ -2271,6 +2312,8 @@ TinyMCE.prototype.insertImage = function(src, alt, border, hspace, vspace, width
if (needsRepaint)
tinyMCE.selectedInstance.repaint();
}
+
+ tinyMCE.execCommand('mceEndUndoLevel');
};
TinyMCE.prototype.getElementByAttributeValue = function(node, element_name, attrib, value) {
@@ -2317,7 +2360,7 @@ TinyMCE.prototype.getParentBlockElement = function(node) {
};
TinyMCE.prototype.getNodeTree = function(node, node_array, type, node_name) {
- if (typeof(type) == "undefined" || node.nodeType == type && (typeof(node_name) == "undefined" || node.nodeName.toLowerCase() == node_name.toLowerCase()))
+ if (typeof(type) == "undefined" || node.nodeType == type && (typeof(node_name) == "undefined" || node.nodeName == node_name))
node_array[node_array.length] = node;
if (node.hasChildNodes()) {
@@ -2660,6 +2703,14 @@ TinyMCE.prototype.getLang = function(name, default_value, parse_entities) {
return value;
};
+TinyMCE.prototype.addToLang = function(prefix, ar) {
+ for (var key in ar)
+ tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = ar[key];
+
+// for (var key in ar)
+// tinyMCELang[(key.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix != '' ? (prefix + "_") : '') + key] = "|" + ar[key] + "|";
+};
+
TinyMCE.prototype.replaceVar = function(replace_haystack, replace_var, replace_str) {
var re = new RegExp('{\\\$' + replace_var + '}', 'g');
return replace_haystack.replace(re, replace_str);
@@ -2708,17 +2759,17 @@ TinyMCE.prototype.triggerNodeChange = function(focus, setup_content) {
this.selectedInstance.contentWindow.focus();
};
-TinyMCE.prototype._customCleanup = function(type, content) {
+TinyMCE.prototype._customCleanup = function(inst, type, content) {
// Call custom cleanup
var customCleanup = tinyMCE.settings['cleanup_callback'];
if (customCleanup != "" && eval("typeof(" + customCleanup + ")") != "undefined")
- content = eval(customCleanup + "(type, content);");
+ content = eval(customCleanup + "(type, content, inst);");
// Trigger plugin cleanups
var plugins = tinyMCE.getParam('plugins', '', true, ',');
for (var i=0; i ';
-
- div.innerHTML = html;
-
- document.body.appendChild(div);
-
- tinyMCE._currentDialog = id;
+ var win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable);
+ if (win == null) {
+ alert(tinyMCELang['lang_popup_blocked']);
+ return;
}
+
+ eval('try { win.resizeTo(width, height); } catch(e) { }');
+
+ // Make it bigger if statusbar is forced
+ if (tinyMCE.isGecko) {
+ if (win.document.defaultView.statusbar.visible)
+ win.resizeBy(0, tinyMCE.isMac ? 10 : 24);
+ }
+
+ win.focus();
}
}
};
-TinyMCE.prototype.closeDialog = function() {
- // Remove div or close window
- if (tinyMCE.settings["dialog_type"] == "div") {
- var div = document.getElementById(tinyMCE._currentDialog);
- if (div)
- div.parentNode.removeChild(div);
- } else
- window.close();
+TinyMCE.prototype.closeWindow = function(win) {
+ win.close();
};
TinyMCE.prototype.getVisualAidClass = function(class_name, state) {
@@ -2908,14 +2945,14 @@ TinyMCE.prototype.getVisualAidClass = function(class_name, state) {
return className;
};
-TinyMCE.prototype.handleVisualAid = function(element, deep, state) {
+TinyMCE.prototype.handleVisualAid = function(element, deep, state, inst) {
if (!element)
return;
var tableElement = null;
- switch (element.nodeName.toLowerCase()) {
- case "table":
+ switch (element.nodeName) {
+ case "TABLE":
var oldW = element.style.width;
var oldH = element.style.height;
@@ -2933,37 +2970,46 @@ TinyMCE.prototype.handleVisualAid = function(element, deep, state) {
break;
-/* case "a":
- var name = element.getAttribute("name");
- if (name && name != "" && state) {
- //element.innerHTML += ' ';
- return;
- }
+ case "A":
+ var anchorName = tinyMCE.getAttrib(element, "name");
- break;*/
+ if (anchorName != '' && state) {
+ element.title = anchorName;
+ element.className = 'mceItemAnchor';
+ } else if (anchorName != '' && !state)
+ element.className = '';
+
+ break;
}
if (deep && element.hasChildNodes()) {
for (var i=0; i 0) {
- var csses = null;
+ for (var x=0; x " + blockName + "><" + blockName + "> " + blockName + ">";
paraAfter = body.childNodes[1];
@@ -4025,14 +4096,37 @@ TinyMCEControl.prototype.autoResetDesignMode = function() {
};
TinyMCEControl.prototype.isDirty = function() {
- return this.isDirty;
+ // Is content modified and not in a submit procedure
+ return this.startContent != tinyMCE.trim(this.getBody().innerHTML) && !tinyMCE.isNotDirty;
+};
+
+TinyMCEControl.prototype._mergeElements = function(pa, ch, override) {
+ ch = ch.cloneNode(true);
+ var st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style"));
+ var stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
+ var className = tinyMCE.getAttrib(pa, "class");
+
+ className += " " + tinyMCE.getAttrib(ch, "class");
+
+ if (override) {
+ for (var n in st)
+ stc[n] = st[n];
+ } else {
+ for (var n in stc)
+ st[n] = stc[n];
+ }
+
+ tinyMCE.setAttrib(ch, "style", tinyMCE.serializeStyle(st));
+ tinyMCE.setAttrib(ch, "class", tinyMCE.trim(className));
+ pa.parentNode.replaceChild(ch, pa);
};
TinyMCEControl.prototype.execCommand = function(command, user_interface, value) {
var doc = this.getDoc();
var win = this.getWin();
+ var focusElm = this.getFocusElement();
- if (this.lastSafariSelection) {
+ if (this.lastSafariSelection && !new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command)) {
this.moveToBookmark(this.lastSafariSelection);
tinyMCE.selectedElement = this.lastSafariSelectedElement;
}
@@ -4050,39 +4144,63 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
if (tinyMCE._themeExecCommand(this.editorId, this.getBody(), command, user_interface, value))
return;
- // Add undo level of operation
- if (command != "mceAddUndoLevel" && command != "Undo" && command != "Redo" && command != "mceImage" && command != "mceLink" && command != "mceToggleVisualAid" && (command != "mceInsertTable" && !user_interface))
- this.execCommand("mceAddUndoLevel");
-
// Fix align on images
- if (this.getFocusElement() && this.getFocusElement().nodeName.toLowerCase() == "img") {
- var align = this.getFocusElement().getAttribute('align');
+ if (focusElm && focusElm.nodeName == "IMG") {
+ var align = focusElm.getAttribute('align');
+ var img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm;
switch (command) {
case "JustifyLeft":
if (align == 'left')
- this.getFocusElement().removeAttribute('align');
+ img.removeAttribute('align');
else
- this.getFocusElement().setAttribute('align', 'left');
+ img.setAttribute('align', 'left');
+ // Remove the div
+ var div = focusElm.parentNode;
+ if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
+ div.parentNode.replaceChild(img, div);
+
+ this.selectNode(img);
+ this.repaint();
tinyMCE.triggerNodeChange();
return;
case "JustifyCenter":
- if (align == 'middle')
- this.getFocusElement().removeAttribute('align');
- else
- this.getFocusElement().setAttribute('align', 'middle');
+ img.removeAttribute('align');
+ // Is centered
+ var div = tinyMCE.getParentElement(focusElm, "div");
+ if (div && div.style.textAlign == "center") {
+ // Remove div
+ if (div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
+ div.parentNode.replaceChild(img, div);
+ } else {
+ // Add div
+ var div = this.getDoc().createElement("div");
+ div.style.textAlign = 'center';
+ div.appendChild(img);
+ focusElm.parentNode.replaceChild(div, focusElm);
+ }
+
+ this.selectNode(img);
+ this.repaint();
tinyMCE.triggerNodeChange();
return;
case "JustifyRight":
if (align == 'right')
- this.getFocusElement().removeAttribute('align');
+ img.removeAttribute('align');
else
- this.getFocusElement().setAttribute('align', 'right');
+ img.setAttribute('align', 'right');
+ // Remove the div
+ var div = focusElm.parentNode;
+ if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
+ div.parentNode.replaceChild(img, div);
+
+ this.selectNode(img);
+ this.repaint();
tinyMCE.triggerNodeChange();
return;
}
@@ -4125,13 +4243,17 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
}
switch (command) {
+ case "mceRepaint":
+ this.repaint();
+ return true;
+
case "mceStoreSelection":
this.selectionBookmark = this.getBookmark();
- break;
+ return true;
case "mceRestoreSelection":
this.moveToBookmark(this.selectionBookmark);
- break;
+ return true;
case "InsertUnorderedList":
case "InsertOrderedList":
@@ -4215,13 +4337,157 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
break;
- case "HiliteColor":
- if (tinyMCE.isGecko) {
- this.getDoc().execCommand("useCSS", false, false);
- this.getDoc().execCommand('hilitecolor', false, value);
- this.getDoc().execCommand("useCSS", false, true);
+ case "SetStyleInfo":
+ var rng = this.getRng();
+ var sel = this.getSel();
+ var scmd = value['command'];
+ var sname = value['name'];
+ var svalue = value['value'];
+ var wrapper = value['wrapper'] ? value['wrapper'] : "span";
+ var parentElm = null;
+
+ // Whole element selected check
+ if (tinyMCE.isMSIE) {
+ // Control range
+ if (rng.item)
+ parentElm = rng.item(0);
+ else {
+ var pelm = rng.parentElement();
+ var prng = doc.selection.createRange();
+ prng.moveToElementText(pelm);
+
+ if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0)
+ parentElm = pelm;
+ }
+ } else {
+ var felm = this.getFocusElement();
+ if (sel.isCollapsed || (/td|tr|tbody|table/ig.test(felm.nodeName) && sel.anchorNode == felm.parentNode))
+ parentElm = felm;
+ }
+
+ // Whole element selected
+ if (parentElm) {
+ if (scmd == "setstyle")
+ eval("parentElm.style." + sname + " = svalue;");
+
+ if (scmd == "setattrib")
+ tinyMCE.setAttrib(parentElm, sname, svalue);
+ } else {
+ doc.execCommand("fontname", false, "#mce_temp_font#");
+ var elementArray = tinyMCE.getElementsByAttributeValue(this.getBody(), "font", "face", "#mce_temp_font#");
+
+ // Change them all
+ for (var x=0; x=0; i--) {
+ var elm = nodes[i];
+ var isNew = tinyMCE.getAttrib(elm, "mce_new") == "true";
+
+ elm.removeAttribute("mce_new");
+
+ // Is only child a element
+ if (elm.childNodes && elm.childNodes.length == 1 && elm.childNodes[0].nodeType == 1) {
+ // tinyMCE.debug("merge1" + isNew);
+ this._mergeElements(elm, elm.childNodes[0], isNew);
+ continue;
+ }
+
+ // Is I the only child
+ if (elm.parentNode.childNodes.length == 1) {
+ // tinyMCE.debug("merge2" + isNew);
+ this._mergeElements(elm.parentNode, elm, false);
+ }
+ }
+
+ // Remove empty wrappers
+ var nodes = doc.getElementsByTagName(wrapper);
+ for (var i=nodes.length-1; i>=0; i--) {
+ var elm = nodes[i];
+ var isEmpty = true;
+
+ // Check if it has any attribs
+ var tmp = doc.createElement("body");
+ tmp.appendChild(elm.cloneNode(false));
+
+ // Is empty span, remove it
+ if (new RegExp('|', 'gi').test(tmp.innerHTML)) {
+ for (var i=elm.childNodes.length-1; i>=0; i--) {
+ if (elm.parentNode != null) {
+ elm.parentNode.insertBefore(elm.childNodes[i].cloneNode(true), elm);
+ elm.parentNode.removeChild(elm);
+ }
+ }
+ }
+ }
+
+ tinyMCE.triggerNodeChange();
+
+ break;
+
+ case "FontName":
+ if (tinyMCE.getParam("convert_fonts_to_styles"))
+ this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "fontFamily", value : value});
+ else
+ this.getDoc().execCommand('FontName', false, value);
+ break;
+
+ case "FontSize":
+ if (tinyMCE.getParam("convert_fonts_to_styles")) {
+ var sizes = new Array('', 8, 10, 12, 14, 18, 24, 36);
+ var size = sizes[value] == '' ? '' : sizes[value] + 'px';
+
+ this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "fontSize", value : size});
} else
- this.getDoc().execCommand('BackColor', false, value);
+ this.getDoc().execCommand('FontSize', false, value);
+
+ break;
+
+ case "forecolor":
+ if (tinyMCE.getParam("convert_fonts_to_styles"))
+ this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "color", value : value});
+ else {
+ if (tinyMCE.isGecko) {
+ this.getDoc().execCommand("useCSS", false, true);
+ this.getDoc().execCommand('forecolor', false, value);
+ this.getDoc().execCommand("useCSS", false, true);
+ } else
+ this.getDoc().execCommand('forecolor', false, value);
+ }
+ break;
+
+ case "HiliteColor":
+ if (tinyMCE.getParam("convert_fonts_to_styles"))
+ this.execCommand("SetStyleInfo", false, {command : "setstyle", name : "backgroundColor", value : value});
+ else {
+ if (tinyMCE.isGecko) {
+ this.getDoc().execCommand("useCSS", false, false);
+ this.getDoc().execCommand('hilitecolor', false, value);
+ this.getDoc().execCommand("useCSS", false, true);
+ } else
+ this.getDoc().execCommand('BackColor', false, value);
+ }
break;
@@ -4249,10 +4515,11 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
value = "";
// Call custom cleanup code
- value = tinyMCE._customCleanup("insert_to_editor", value);
+ value = tinyMCE._customCleanup(this, "insert_to_editor", value);
tinyMCE._setHTML(doc, value);
- doc.body.innerHTML = tinyMCE._cleanupHTML(doc, tinyMCE.settings, doc.body);
- tinyMCE.handleVisualAid(doc.body, true, this.visualAid);
+ doc.body.innerHTML = tinyMCE._cleanupHTML(this, doc, tinyMCE.settings, doc.body);
+ tinyMCE.handleVisualAid(doc.body, true, this.visualAid, this);
+ tinyMCE._setEventsEnabled(doc.body, true);
return true;
case "mceLink":
@@ -4282,7 +4549,7 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
href = tinyMCE.getAttrib(tinyMCE.linkElement, 'href');
target = tinyMCE.getAttrib(tinyMCE.linkElement, 'target');
title = tinyMCE.getAttrib(tinyMCE.linkElement, 'title');
- onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'mce_onclick');
+ onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
style_class = tinyMCE.getAttrib(tinyMCE.linkElement, 'class');
// Try old onclick to if copy/pasted content
@@ -4385,65 +4652,15 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
tinyMCE.openWindow(this.insertImageTemplate, {src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align, title : title, onmouseover : onmouseover, onmouseout : onmouseout, action : action});
break;
- case "mceCleanupWord":
- if (tinyMCE.isMSIE) {
- var html = this.getBody().createTextRange().htmlText;
-
- if (html.indexOf('="mso') != -1) {
- tinyMCE._setHTML(this.contentDocument, this.getBody().innerHTML);
- html = tinyMCE._cleanupHTML(this.contentDocument, this.settings, this.getBody(), this.visualAid);
- }
-
- this.getBody().innerHTML = html;
- }
- break;
-
case "mceCleanup":
tinyMCE._setHTML(this.contentDocument, this.getBody().innerHTML);
- this.getBody().innerHTML = tinyMCE._cleanupHTML(this.contentDocument, this.settings, this.getBody(), this.visualAid);
- tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid);
+ this.getBody().innerHTML = tinyMCE._cleanupHTML(this, this.contentDocument, this.settings, this.getBody(), this.visualAid);
+ tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
+ tinyMCE._setEventsEnabled(this.getBody(), true);
this.repaint();
tinyMCE.triggerNodeChange();
break;
- case "mceAnchor":
- if (!user_interface) {
- var aElm = tinyMCE.getParentElement(this.getFocusElement(), "a", "name");
- if (aElm) {
- if (value == null || value == "") {
- if (tinyMCE.isMSIE) {
- aElm.outerHTML = aElm.innerHTML;
- } else {
- var rng = aElm.ownerDocument.createRange();
- rng.setStartBefore(aElm);
- rng.setEndAfter(aElm);
- rng.deleteContents();
- rng.insertNode(rng.createContextualFragment(aElm.innerHTML));
- }
- } else
- aElm.setAttribute('name', value);
- } else {
- this.getDoc().execCommand("fontname", false, "#mce_temp_font#");
- var elementArray = tinyMCE.getElementsByAttributeValue(this.getBody(), "font", "face", "#mce_temp_font#");
- for (var x=0; x 0);
- } else
- selectedText = (this.getSel().toString().length > 0);
-
- // Use selectedNode instead if defined
- if (tinyMCE.selectedNode)
- tinyMCE.selectedElement = tinyMCE.selectedNode;
-
- if (selectedText && !tinyMCE.selectedNode) {
- this.getDoc().execCommand("RemoveFormat", false, null);
- if (value == null)
- return this.execCommand("RemoveFormat", false, null);
-
- this.getDoc().execCommand("fontname", false, "#mce_temp_font#");
- var elementArray = tinyMCE.getElementsByAttributeValue(this.getBody(), "font", "face", "#mce_temp_font#");
-
- // Change them all
- for (var x=0; x customUndoLevels) {
for (var i=0; i 0) {
this.undoIndex--;
this.getBody().innerHTML = this.undoLevels[this.undoIndex];
+ this.repaint();
}
- // debug("Undo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
+ // tinyMCE.debug("Undo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
tinyMCE.triggerNodeChange();
} else
this.getDoc().execCommand(command, user_interface, value);
@@ -4688,10 +4872,13 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
case "Redo":
if (tinyMCE.settings['custom_undo_redo']) {
+ tinyMCE.execCommand("mceEndTyping");
+
if (this.undoIndex < (this.undoLevels.length-1)) {
this.undoIndex++;
this.getBody().innerHTML = this.undoLevels[this.undoIndex];
- // debug("Redo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
+ this.repaint();
+ // tinyMCE.debug("Redo - undo levels:" + this.undoLevels.length + ", undo index: " + this.undoIndex);
}
tinyMCE.triggerNodeChange();
@@ -4701,7 +4888,7 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
case "mceToggleVisualAid":
this.visualAid = !this.visualAid;
- tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid);
+ tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
tinyMCE.triggerNodeChange();
break;
@@ -4713,6 +4900,13 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
win.focus();
var rng = doc.selection.createRange();
rng.execCommand("RemoveFormat", false, null);
+
+ // If all element contents is selected, move selection around element
+ if (rng.text == rng.parentElement().innerText) {
+ rng.moveToElementText(rng.parentElement());
+ rng.select();
+ }
+
rng.pasteHTML(rng.text);
} catch (e) {
// Do nothing
@@ -4731,6 +4925,10 @@ TinyMCEControl.prototype.execCommand = function(command, user_interface, value)
this.getDoc().execCommand(command, user_interface, value);
tinyMCE.triggerNodeChange();
}
+
+ // Add undo level after modification
+ if (command != "mceAddUndoLevel" && command != "Undo" && command != "Redo" && command != "mceStartTyping" && command != "mceEndTyping")
+ tinyMCE.execCommand("mceAddUndoLevel");
};
TinyMCEControl.prototype.queryCommandValue = function(command) {
@@ -4779,7 +4977,6 @@ TinyMCEControl.prototype.onAdd = function(replace_element, form_element_name, ta
this.settings['handleNodeChangeCallback'] = templateFunction;
html = tinyMCE.replaceVar(html, "editor_id", this.editorId);
- html = tinyMCE.replaceVar(html, "default_document", tinyMCE.baseURL + "/blank.htm");
this.settings['default_document'] = tinyMCE.baseURL + "/blank.htm";
this.settings['old_width'] = this.settings['width'];
@@ -4838,7 +5035,7 @@ TinyMCEControl.prototype.onAdd = function(replace_element, form_element_name, ta
this.formTargetElementId = form_element_name;
// Get replace_element contents
- if (replace_element.nodeName.toLowerCase() == "textarea")
+ if (replace_element.nodeName == "TEXTAREA" || replace_element.nodeName == "INPUT")
this.startContent = replace_element.value;
else
this.startContent = replace_element.innerHTML;
@@ -4916,17 +5113,7 @@ TinyMCEControl.prototype.onAdd = function(replace_element, form_element_name, ta
// Setup base HTML
var doc = this.contentDocument;
if (dynamicIFrame) {
- var html = ""
- + ''
- + ''
- + ''
- + ' '
- + 'blank_page '
- + ' '
- + ''
- + ''
- + ''
- + '';
+ var html = 'blank_page ';
try {
this.getDoc().designMode = "on";
@@ -4960,10 +5147,26 @@ TinyMCEControl.prototype.getFocusElement = function() {
var elm = rng.item ? rng.item(0) : rng.parentElement();
} else {
var sel = this.getSel();
- var elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
+ var rng = this.getRng();
+ var elm = rng.commonAncestorContainer;
+ //var elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
- if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img")
- elm = tinyMCE.selectedElement;
+ // Handle selection a image or other control like element such as anchors
+ if (!rng.collapsed) {
+ // Is selection small
+ if (rng.startContainer == rng.endContainer) {
+ if (rng.startOffset - rng.endOffset < 2) {
+ if (rng.startContainer.hasChildNodes())
+ elm = rng.startContainer.childNodes[rng.startOffset];
+ }
+ }
+ }
+
+ // Get the element parent of the node
+ elm = tinyMCE.getParentElement(elm);
+
+ //if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img")
+ // elm = tinyMCE.selectedElement;
}
return elm;
@@ -4972,30 +5175,3 @@ TinyMCEControl.prototype.getFocusElement = function() {
// Global instances
var tinyMCE = new TinyMCE();
var tinyMCELang = new Array();
-
-function debug() {
- var msg = "";
-
- var elm = document.getElementById("tinymce_debug");
- if (!elm) {
- var debugDiv = document.createElement("div");
- debugDiv.setAttribute("className", "debugger");
- debugDiv.className = "debugger";
- debugDiv.innerHTML = '\
- Debug output:\
- \
- ';
-
- document.body.appendChild(debugDiv);
- elm = document.getElementById("tinymce_debug");
- }
-
- var args = this.debug.arguments;
- for (var i=0; i