From f9c2d71a23ad6b407af102481012a9ccc1b5597d Mon Sep 17 00:00:00 2001 From: matt Date: Wed, 17 Aug 2005 23:47:27 +0000 Subject: [PATCH] Resize the text area on the fly git-svn-id: http://svn.automattic.com/wordpress/trunk@2787 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- .../themes/advanced/editor_template.js | 6 +- .../themes/advanced/editor_template_src.js | 224 +++++++++++++++--- .../tinymce/themes/advanced/editor_ui.css | 86 +++---- .../advanced/images/statusbar_resize.gif | Bin 0 -> 79 bytes 4 files changed, 218 insertions(+), 98 deletions(-) create mode 100644 wp-admin/tinymce/themes/advanced/images/statusbar_resize.gif diff --git a/wp-admin/tinymce/themes/advanced/editor_template.js b/wp-admin/tinymce/themes/advanced/editor_template.js index d8c5e61d64..dec2355ad9 100644 --- a/wp-admin/tinymce/themes/advanced/editor_template.js +++ b/wp-admin/tinymce/themes/advanced/editor_template.js @@ -1,5 +1,5 @@ /* Import theme specific language pack */ - tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_advanced_autoImportCSSClasses=true;var TinyMCE_advanced_foreColor="#000000";var TinyMCE_advanced_anchorName="";var TinyMCE_advanced_buttons=[['bold','{$lang_bold_img}','{$lang_bold_desc}','Bold'],['italic','{$lang_italic_img}','{$lang_italic_desc}','Italic'],['underline','{$lang_underline_img}','{$lang_underline_desc}','Underline'],['strikethrough','strikethrough.gif','{$lang_striketrough_desc}','Strikethrough'],['justifyleft','left.gif','{$lang_justifyleft_desc}','JustifyLeft'],['justifycenter','center.gif','{$lang_justifycenter_desc}','JustifyCenter'],['justifyright','right.gif','{$lang_justifyright_desc}','JustifyRight'],['justifyfull','full.gif','{$lang_justifyfull_desc}','JustifyFull'],['bullist','bullist.gif','{$lang_bullist_desc}','InsertUnorderedList'],['numlist','numlist.gif','{$lang_numlist_desc}','InsertOrderedList'],['outdent','outdent.gif','{$lang_outdent_desc}','Outdent'],['indent','indent.gif','{$lang_indent_desc}','Indent'],['cut','cut.gif','{$lang_cut_desc}','Cut'],['copy','copy.gif','{$lang_copy_desc}','Copy'],['paste','paste.gif','{$lang_paste_desc}','Paste'],['undo','undo.gif','{$lang_undo_desc}','Undo'],['redo','redo.gif','{$lang_redo_desc}','Redo'],['link','link.gif','{$lang_link_desc}','mceLink',true],['unlink','unlink.gif','{$lang_unlink_desc}','unlink'],['image','image.gif','{$lang_image_desc}','mceImage',true],['cleanup','cleanup.gif','{$lang_cleanup_desc}','mceCleanup'],['help','help.gif','{$lang_help_desc}','mceHelp'],['code','code.gif','{$lang_theme_code_desc}','mceCodeEditor'],['hr','hr.gif','{$lang_theme_hr_desc}','inserthorizontalrule'],['removeformat','removeformat.gif','{$lang_theme_removeformat_desc}','removeformat'],['sub','sub.gif','{$lang_theme_sub_desc}','subscript'],['sup','sup.gif','{$lang_theme_sup_desc}','superscript'],['forecolor','forecolor.gif','{$lang_theme_forecolor_desc}','mceForeColor',true],['backcolor','backcolor.gif','{$lang_theme_backcolor_desc}','mceBackColor',true],['charmap','charmap.gif','{$lang_theme_charmap_desc}','mceCharMap'],['visualaid','visualaid.gif','{$lang_theme_visualaid_desc}','mceToggleVisualAid'],['anchor','anchor.gif','{$lang_theme_anchor_desc}','mceInsertAnchor'],['newdocument','newdocument.gif','{$lang_newdocument_desc}','mceNewDocument']];function TinyMCE_advanced_getControlHTML(button_name){var buttonTileMap=new Array('anchor.gif','backcolor.gif','bullist.gif','center.gif','charmap.gif','cleanup.gif','code.gif','copy.gif','custom_1.gif','cut.gif','forecolor.gif','full.gif','help.gif','hr.gif','image.gif','indent.gif','left.gif','link.gif','numlist.gif','outdent.gif','paste.gif','redo.gif','removeformat.gif','right.gif','strikethrough.gif','sub.gif','sup.gif','undo.gif','unlink.gif','visualaid.gif');for(var i=0;i';}}}return '';}}switch(button_name){case "formatselect":var html='';return html;case "styleselect":return '';case "fontselect":return '';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}']];html+='';for(var i=0;i'+lookup[x][1]+'';}}}html+='';return html;case "styleselect":return '';case "fontselect":return '';case "|":case "separator":return '';case "spacer":return '';case "rowseparator":return '
';}return "";}function TinyMCE_advanced_execCommand(editor_id,element,command,user_interface,value){switch(command){case "mceForeColor":var template=new Array();var inputColor=TinyMCE_advanced_foreColor;if(!inputColor){inputColor="#000000";}template['file']='color_picker.htm';template['width']=210;template['height']=200;tinyMCE.openWindow(template,{editor_id:editor_id,command:"forecolor",input_color:inputColor});return true;case "mceBackColor":var template=new Array();var inputColor=TinyMCE_advanced_foreColor;if(!inputColor){inputColor="#000000";}template['file']='color_picker.htm';template['width']=210;template['height']=200;tinyMCE.openWindow(template,{editor_id:editor_id,command:"HiliteColor",input_color:inputColor});return true;case "mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=tinyMCE.getParam("theme_advanced_source_editor_width",500);template['height']=tinyMCE.getParam("theme_advanced_source_editor_height",400);tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no"});return true;case "mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550;template['height']=280;tinyMCE.openWindow(template,{editor_id:editor_id});return true;case "mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=130;tinyMCE.openWindow(template,{editor_id:editor_id,name:TinyMCE_advanced_anchorName,action:(TinyMCE_advanced_anchorName==""?"insert":"update")});return true;case "mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,'');return true;}return false;}function TinyMCE_advanced_getEditorTemplate(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array();for(var i=0;i'+key+'';}TinyMCE_advanced_autoImportCSSClasses=false;}switch(layoutManager){case "SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var buttonNamesRow1=tinyMCE.getParam("theme_advanced_buttons1","bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",true,',');buttonNamesRow1=removeFromArray(buttonNamesRow1,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow1=addToArray(buttonNamesRow1,tinyMCE.getParam("theme_advanced_buttons1_add","",true,','));buttonNamesRow1=addToArray(tinyMCE.getParam("theme_advanced_buttons1_add_before","",true,','),buttonNamesRow1);for(var i=0;i0){toolbarHTML+="
";deltaHeight-=23;}var buttonNamesRow2=tinyMCE.getParam("theme_advanced_buttons2","bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",true,',');buttonNamesRow2=removeFromArray(buttonNamesRow2,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow2=addToArray(buttonNamesRow2,tinyMCE.getParam("theme_advanced_buttons2_add","",true,','));buttonNamesRow2=addToArray(tinyMCE.getParam("theme_advanced_buttons2_add_before","",true,','),buttonNamesRow2);for(var i=0;i0){toolbarHTML+="
";deltaHeight-=23;}var buttonNamesRow3=tinyMCE.getParam("theme_advanced_buttons3","hr,removeformat,visualaid,separator,sub,sup,separator,charmap",true,',');buttonNamesRow3=removeFromArray(buttonNamesRow3,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow3=addToArray(buttonNamesRow3,tinyMCE.getParam("theme_advanced_buttons3_add","",true,','));buttonNamesRow3=addToArray(tinyMCE.getParam("theme_advanced_buttons3_add_before","",true,','),buttonNamesRow3);for(var i=0;i0){deltaHeight-=20;}template['html']='';if(toolbarLocation=="top"){template['html']+='';}if(pathLocation=="top"){template['html']+='';deltaHeight-=23;}template['html']+='';if(toolbarLocation=="bottom"){template['html']+='';}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCE.settings);toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCELang);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"editor_id",editorId);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"default_document",tinyMCE.baseURL+"/blank.htm");elm.className="mceToolbarExternal";elm.id="mceExternalToolbar";elm.innerHTML='
'+toolbarHTML+'
'+pathHTML+'
'+toolbarHTML+'
'+toolbarHTML+'
';bod.appendChild(elm);bod.style.marginTop=elm.offsetHeight+"px";tinyMCE.isExternalToolbar=true;}else{tinyMCE.isExternalToolbar=false;}if(pathLocation=="bottom"){template['html']+=''+pathHTML+'';deltaHeight-=23;}template['html']+='';break;case "RowLayout":template['html']='';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i';deltaHeight-=23;}template['html']+='
\ + ';case "|":case "separator":return '';case "spacer":return '';case "rowseparator":return '
';}return "";}function TinyMCE_advanced_execCommand(editor_id,element,command,user_interface,value){switch(command){case "mceForeColor":var template=new Array();var inputColor=TinyMCE_advanced_foreColor;if(!inputColor)inputColor="#000000";template['file']='color_picker.htm';template['width']=220;template['height']=240;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"forecolor",input_color:inputColor});return true;case "mceBackColor":var template=new Array();var inputColor=TinyMCE_advanced_foreColor;if(!inputColor){inputColor="#000000";}template['file']='color_picker.htm';template['width']=210;template['height']=200;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"HiliteColor",input_color:inputColor});return true;case "mceColorPicker":if(user_interface){var template=new Array();var inputColor=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=220;template['height']=210;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",command:"mceColorPicker",input_color:inputColor});}else{var savedVal=tinyMCE.lastColorPickerValue;savedVal['document'].getElementById(savedVal['element_id']).value=value;}return true;case "mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=tinyMCE.getParam("theme_advanced_source_editor_width",500);template['height']=tinyMCE.getParam("theme_advanced_source_editor_height",400);tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case "mceCharMap":var template=new Array();template['file']='charmap.htm';template['width']=550;template['height']=280;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case "mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=130;tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes",name:TinyMCE_advanced_anchorName,action:(TinyMCE_advanced_anchorName==""?"insert":"update")});return true;case "mceNewDocument":if(confirm(tinyMCE.getLang('lang_newdocument')))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,'');return true;}return false;}function TinyMCE_advanced_getEditorTemplate(settings,editorId){function removeFromArray(in_array,remove_array){var outArray=new Array();for(var i=0;i 

';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i'+key+'';}TinyMCE_advanced_autoImportCSSClasses=false;}switch(layoutManager){case "SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var buttonNamesRow1=tinyMCE.getParam("theme_advanced_buttons1","bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",true,',');buttonNamesRow1=removeFromArray(buttonNamesRow1,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow1=addToArray(buttonNamesRow1,tinyMCE.getParam("theme_advanced_buttons1_add","",true,','));buttonNamesRow1=addToArray(tinyMCE.getParam("theme_advanced_buttons1_add_before","",true,','),buttonNamesRow1);for(var i=0;i0){toolbarHTML+="
";deltaHeight-=23;}var buttonNamesRow2=tinyMCE.getParam("theme_advanced_buttons2","bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",true,',');buttonNamesRow2=removeFromArray(buttonNamesRow2,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow2=addToArray(buttonNamesRow2,tinyMCE.getParam("theme_advanced_buttons2_add","",true,','));buttonNamesRow2=addToArray(tinyMCE.getParam("theme_advanced_buttons2_add_before","",true,','),buttonNamesRow2);for(var i=0;i0){toolbarHTML+="
";deltaHeight-=23;}var buttonNamesRow3=tinyMCE.getParam("theme_advanced_buttons3","hr,removeformat,visualaid,separator,sub,sup,separator,charmap",true,',');buttonNamesRow3=removeFromArray(buttonNamesRow3,tinyMCE.getParam("theme_advanced_disable","",true,','));buttonNamesRow3=addToArray(buttonNamesRow3,tinyMCE.getParam("theme_advanced_buttons3_add","",true,','));buttonNamesRow3=addToArray(tinyMCE.getParam("theme_advanced_buttons3_add_before","",true,','),buttonNamesRow3);for(var i=0;i0){deltaHeight-=20;}template['html']='';if(toolbarLocation=="top"){template['html']+='';}if(statusbarLocation=="top"){template['html']+='';deltaHeight-=23;}template['html']+='';if(toolbarLocation=="bottom"){template['html']+='';}if(toolbarLocation=="external"){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCE.settings);toolbarHTML=tinyMCE.replaceVars(toolbarHTML,tinyMCELang);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"editor_id",editorId);toolbarHTML=tinyMCE.replaceVar(toolbarHTML,"default_document",tinyMCE.baseURL+"/blank.htm");elm.className="mceToolbarExternal";elm.id="mceExternalToolbar";elm.innerHTML='
'+toolbarHTML+'
'+statusbarHTML+'
'+toolbarHTML+'
'+toolbarHTML+'
';bod.appendChild(elm);bod.style.marginTop=elm.offsetHeight+"px";tinyMCE.isExternalToolbar=true;}else{tinyMCE.isExternalToolbar=false;}if(statusbarLocation=="bottom"){template['html']+='
'+statusbarHTML+'
';break;case "RowLayout":template['html']='';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i';}else if(containers[i]=="mceElementpath"){var pathClass="mcePath";if(i==containers.length-1){pathClass="mcePathBottom";}else if(i==0){pathClass="mcePathTop";}else{deltaHeight-=2;}template['html']+='';deltaHeight-=22;}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);for(var j=0;j0){curContainerHTML+="
";deltaHeight-=23;}template['html']+='
';}}template['html']+='
\ \ -
'+pathHTML+'
'+curContainerHTML+'
';break;case "BorderLayout":break;case "CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);");}break;default:alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');break;}template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template;}function TinyMCE_advanced_getInsertLinkTemplate(){var template=new Array();template['file']='link.htm';template['width']=300;template['height']=150;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);return template;};function TinyMCE_advanced_getInsertImageTemplate(){var template=new Array();template['file']='image.htm?src={$src}';template['width']=340;template['height']=280;template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);return template;};function TinyMCE_advanced_handleNodeChange(editor_id,node,undo_index,undo_levels,visual_aid,any_selection){function selectByValue(select_elm,value){if(select_elm){for(var i=0;i=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName=="b"){nodeName="strong";}if(nodeName=="i"){nodeName="em";}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" ";}if(getAttrib(path[i],'class')!=""){nodeData+="class: "+path[i].getAttribute('class')+" ";}if(getAttrib(path[i],'className')!=""){nodeData+="class: "+path[i].getAttribute('className')+" ";}if(getAttrib(path[i],'src')!=""){nodeData+="src: "+path[i].getAttribute('src')+" ";}if(getAttrib(path[i],'href')!=""){nodeData+="href: "+path[i].getAttribute('href')+" ";}if(nodeName=="img"&&getAttrib(path[i],'name')=="mce_plugin_flash"){nodeName="flash";nodeData="";}if(getAttrib(path[i],'name').indexOf("mce_")!=0){if(getAttrib(path[i],"className")!=""){nodeName+="."+getAttrib(path[i],"className");}else if(getAttrib(path[i],"class")!=""){nodeName+="."+getAttrib(path[i],"class");}}if(tinyMCE.isMSIE){html+=''+nodeName+'';}else{html+=''+nodeName+'';}if(i>0){html+=" » ";}}pathElm.innerHTML=html+" ";}var colorElm=tinyMCE.getParentElement(node,"font","color");if(colorElm){TinyMCE_advanced_foreColor=""+colorElm.color.toUpperCase();}tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_link','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_unlink','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_image','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonNormal');var anchorName=tinyMCE.getParentElement(node,"a","name");TinyMCE_advanced_anchorName="";if(anchorName){TinyMCE_advanced_anchorName=anchorName.getAttribute("name");tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonSelected');}var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClassSticky(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal',false);}tinyMCE.switchClassSticky(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal',false);if(undo_levels!=-1){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonDisabled',true);}if(tinyMCE.getParentElement(node,"li,blockquote")){tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index0)){tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index>0&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonNormal',false);}var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_advanced_setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i");}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"font","face");if(elm){selectByValue(selectElm,elm.getAttribute("face"));}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"font","size");if(elm&&getAttrib(elm,"size")!=""){selectByValue(selectElm,elm.getAttribute("size"));}else{selectByValue(selectElm,"0");}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align')){continue;}switch(alignNode.getAttribute('align').toLowerCase()){case "left":tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case "right":tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case "middle":case "center":tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case "justify":tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break;}}while(!breakOut&&(alignNode=alignNode.parentNode));if(tinyMCE.isGecko&&node.nodeType==3){var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();if(doc.queryCommandState("Bold")){tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');}if(doc.queryCommandState("Italic")){tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');}if(doc.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A")){tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');}if(doc.queryCommandState("Strikethrough")){tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');}}do{switch(node.nodeName.toLowerCase()){case "b":case "strong":tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');break;case "i":case "em":tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');break;case "u":tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');break;case "strike":tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');break;case "ul":tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonSelected');break;case "ol":tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonSelected');break;case "sub":tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonSelected');break;case "sup":tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonSelected');break;case "hr":tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonSelected');break;case "img":if(getAttrib(node,'name').indexOf('mce_')!=0){tinyMCE.switchClassSticky(editor_id+'_image','mceButtonSelected');}break;}}while((node=node.parentNode));};function TinyMCE_advanced_setupCSSClasses(editor_id){if(!TinyMCE_advanced_autoImportCSSClasses){return;}var selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(var i=0;i0){selectElm.setAttribute('cssImported','true');}}}; \ No newline at end of file + ';}else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom";}else if(i==0){pathClass="mceStatusbar";}else{deltaHeight-=2;}template['html']+=''+statusbarHTML+'';deltaHeight-=22;}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class",defaultContainerCSS);for(var j=0;j0){curContainerHTML+="
";deltaHeight-=23;}template['html']+=''+curContainerHTML+'';}}template['html']+='';break;case "BorderLayout":break;case "CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);");}break;default:alert('UNDEFINED LAYOUT MANAGER! PLEASE CHECK YOUR TINYMCE CONFIG!');break;}template['html']+='
';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);template['delta_width']=0;template['delta_height']=deltaHeight;return template;}function TinyMCE_advanced_setResizing(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_advanced_resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;if(tinyMCE.isMSIE){width+=2;height+=2;}resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";resizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_advanced_resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_advanced_resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_advanced_resizeEventHandler);resizer.eventHandlers=true;}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",false);}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display="block";inst.getDoc().designMode="On";}}function TinyMCE_advanced_resizeEventHandler(e){var resizer=TinyMCE_advanced_resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case "mousemove":if(resizer.horizontal)resizeBox.style.width=(resizer.width+dx)+"px";resizeBox.style.height=(resizer.height+dy)+"px";break;case "mouseup":resizer.resizing=false;TinyMCE_advanced_setResizing(e,editorId,false);var editorContainer=document.getElementById(editorId+'_parent');var tableElm=editorContainer.firstChild;var inst=tinyMCE.getInstanceById(editorId);var width=resizer.width+dx;var height=resizer.height+dy;if(resizer.horizontal)var iframeWidth=resizer.iframeWidth+dx;var iframeHeight=resizer.iframeHeight+dy;if(tinyMCE.isGecko){width+=2;height+=2;}if(iframeHeight<40)return;if(resizer.horizontal)tableElm.style.width=width+"px";tableElm.style.height=height+"px";if(resizer.horizontal)inst.iframeElement.style.width=iframeWidth+"px";if(tinyMCE.isGecko&&!resizer.horizontal)inst.iframeElement.style.width=resizer.iframeWidth+"px";inst.iframeElement.style.height=iframeHeight+"px";if(resizer.horizontal){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName=="b"){nodeName="strong";}if(nodeName=="i"){nodeName="em";}if(getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" ";}var className=tinyMCE.getVisualAidClass(getAttrib(path[i],"className"),false);if(className!=""){nodeData+="class: "+className+" ";}if(getAttrib(path[i],'src')!=""){nodeData+="src: "+path[i].getAttribute('src')+" ";}if(getAttrib(path[i],'href')!=""){nodeData+="href: "+path[i].getAttribute('href')+" ";}if(nodeName=="img"&&getAttrib(path[i],'name')=="mce_plugin_flash"){nodeName="flash";nodeData="";}if(getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(getAttrib(path[i],"className"),false);if(className!=""){nodeName+="."+className;}}if(tinyMCE.isMSIE){html+=''+nodeName+'';}else{html+=''+nodeName+'';}if(i>0){html+=" » ";}}pathElm.innerHTML=tinyMCE.getLang('lang_theme_path')+": "+html+" ";}var colorElm=tinyMCE.getParentElement(node,"font","color");if(colorElm){TinyMCE_advanced_foreColor=""+colorElm.color.toUpperCase();}tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_link','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_unlink','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_image','mceButtonNormal');tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonNormal');var anchorName=tinyMCE.getParentElement(node,"a","name");TinyMCE_advanced_anchorName="";if(anchorName){TinyMCE_advanced_anchorName=anchorName.getAttribute("name");tinyMCE.switchClassSticky(editor_id+'_anchor','mceButtonSelected');}var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClassSticky(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal',false);tinyMCE.switchClassSticky(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal',false);}tinyMCE.switchClassSticky(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal',false);if(undo_levels!=-1){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonDisabled',true);tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonDisabled',true);}if(tinyMCE.getParentElement(node,"li,blockquote")){tinyMCE.switchClassSticky(editor_id+'_outdent','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index0)){tinyMCE.switchClassSticky(editor_id+'_redo','mceButtonNormal',false);}if(undo_index!=-1&&(undo_index>0&&undo_levels>0)){tinyMCE.switchClassSticky(editor_id+'_undo','mceButtonNormal',false);}var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_advanced_setupCSSClasses(editor_id);classNode=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i");}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"font","face");if(elm){selectByValue(selectElm,elm.getAttribute("face"));}else{selectByValue(selectElm,"");}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"font","size");if(elm&&getAttrib(elm,"size")!=""){selectByValue(selectElm,elm.getAttribute("size"));}else{selectByValue(selectElm,"0");}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align')){continue;}switch(alignNode.getAttribute('align').toLowerCase()){case "left":tinyMCE.switchClassSticky(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case "right":tinyMCE.switchClassSticky(editor_id+'_justifyright','mceButtonSelected');breakOut=true;break;case "middle":case "center":tinyMCE.switchClassSticky(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case "justify":tinyMCE.switchClassSticky(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break;}}while(!breakOut&&(alignNode=alignNode.parentNode));if(tinyMCE.isGecko&&node.nodeType==3){var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();if(doc.queryCommandState("Bold")){tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');}if(doc.queryCommandState("Italic")){tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');}if(doc.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A")){tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');}if(doc.queryCommandState("Strikethrough")){tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');}}do{switch(node.nodeName.toLowerCase()){case "b":case "strong":tinyMCE.switchClassSticky(editor_id+'_bold','mceButtonSelected');break;case "i":case "em":tinyMCE.switchClassSticky(editor_id+'_italic','mceButtonSelected');break;case "u":tinyMCE.switchClassSticky(editor_id+'_underline','mceButtonSelected');break;case "strike":tinyMCE.switchClassSticky(editor_id+'_strikethrough','mceButtonSelected');break;case "ul":tinyMCE.switchClassSticky(editor_id+'_bullist','mceButtonSelected');break;case "ol":tinyMCE.switchClassSticky(editor_id+'_numlist','mceButtonSelected');break;case "sub":tinyMCE.switchClassSticky(editor_id+'_sub','mceButtonSelected');break;case "sup":tinyMCE.switchClassSticky(editor_id+'_sup','mceButtonSelected');break;case "hr":tinyMCE.switchClassSticky(editor_id+'_hr','mceButtonSelected');break;case "img":if(getAttrib(node,'name').indexOf('mce_')!=0){tinyMCE.switchClassSticky(editor_id+'_image','mceButtonSelected');}break;}}while((node=node.parentNode));};function TinyMCE_advanced_setupCSSClasses(editor_id){if(!TinyMCE_advanced_autoImportCSSClasses){return;}var selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(var i=0;i0){selectElm.setAttribute('cssImported','true');}}}; \ No newline at end of file diff --git a/wp-admin/tinymce/themes/advanced/editor_template_src.js b/wp-admin/tinymce/themes/advanced/editor_template_src.js index 00ee9b7835..71bb9177cc 100644 --- a/wp-admin/tinymce/themes/advanced/editor_template_src.js +++ b/wp-admin/tinymce/themes/advanced/editor_template_src.js @@ -5,6 +5,7 @@ tinyMCE.importThemeLanguagePack('advanced'); var TinyMCE_advanced_autoImportCSSClasses = true; var TinyMCE_advanced_foreColor = "#000000"; var TinyMCE_advanced_anchorName = ""; +var TinyMCE_advanced_resizer = new Object(); var TinyMCE_advanced_buttons = [ // Control id, button img, button title, command, user_interface, value ['bold', '{$lang_bold_img}', '{$lang_bold_desc}', 'Bold'], @@ -181,16 +182,13 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac var inputColor = TinyMCE_advanced_foreColor; if (!inputColor) - { inputColor = "#000000"; - } template['file'] = 'color_picker.htm'; - template['width'] = 210; - template['height'] = 200; + template['width'] = 220; + template['height'] = 240; - tinyMCE.openWindow(template, {editor_id : editor_id, command : "forecolor", input_color : inputColor}); - //mceForeColor + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "forecolor", input_color : inputColor}); return true; case "mceBackColor": @@ -206,10 +204,27 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac template['width'] = 210; template['height'] = 200; - tinyMCE.openWindow(template, {editor_id : editor_id, command : "HiliteColor", input_color : inputColor}); + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "HiliteColor", input_color : inputColor}); //mceBackColor return true; + case "mceColorPicker": + if (user_interface) { + var template = new Array(); + var inputColor = value['document'].getElementById(value['element_id']).value; + + template['file'] = 'color_picker.htm'; + template['width'] = 220; + template['height'] = 210; + + tinyMCE.lastColorPickerValue = value; + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", command : "mceColorPicker", input_color : inputColor}); + } else { + var savedVal = tinyMCE.lastColorPickerValue; + savedVal['document'].getElementById(savedVal['element_id']).value = value; + } + return true; + case "mceCodeEditor": var template = new Array(); @@ -217,7 +232,7 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac template['width'] = tinyMCE.getParam("theme_advanced_source_editor_width", 500); template['height'] = tinyMCE.getParam("theme_advanced_source_editor_height", 400); - tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no"}); + tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"}); //mceCodeEditor return true; @@ -228,7 +243,7 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac template['width'] = 550; template['height'] = 280; - tinyMCE.openWindow(template, {editor_id : editor_id}); + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"}); //mceCharMap return true; @@ -239,8 +254,7 @@ function TinyMCE_advanced_execCommand(editor_id, element, command, user_interfac template['width'] = 320; template['height'] = 130; - tinyMCE.openWindow(template, {editor_id : editor_id, name : TinyMCE_advanced_anchorName, action : (TinyMCE_advanced_anchorName == "" ? "insert" : "update")}); - //mceInsertAnchor + tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes", name : TinyMCE_advanced_anchorName, action : (TinyMCE_advanced_anchorName == "" ? "insert" : "update")}); return true; case "mceNewDocument": @@ -297,7 +311,9 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId) var template = new Array(); var deltaHeight = 0; - var pathHTML = '{$lang_theme_path}:  '; + var resizing = tinyMCE.getParam("theme_advanced_resizing", false); + var path = tinyMCE.getParam("theme_advanced_path", true); + var statusbarHTML = '
 

'; var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout"); // Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY! @@ -325,7 +341,8 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId) var toolbarHTML = ""; var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom"); var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center"); - var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); + var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity + var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation); // Render row 1 var buttonNamesRow1 = tinyMCE.getParam("theme_advanced_buttons1", "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect", true, ','); @@ -385,9 +402,9 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId) template['html'] += '' + toolbarHTML + ''; } - if (pathLocation == "top") + if (statusbarLocation == "top") { - template['html'] += '' + pathHTML + ''; + template['html'] += '' + statusbarHTML + ''; deltaHeight -= 23; } @@ -425,9 +442,9 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId) tinyMCE.isExternalToolbar = false; } - if (pathLocation == "bottom") + if (statusbarLocation == "bottom") { - template['html'] += '' + pathHTML + ''; + template['html'] += '' + statusbarHTML + ''; deltaHeight -= 23; } @@ -451,24 +468,24 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId) \ '; } - else if (containers[i] == "mceElementpath") // ... mceElementpath: + else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath: { - var pathClass = "mcePath"; + var pathClass = "mceStatusbar"; if (i == containers.length-1) { - pathClass = "mcePathBottom"; + pathClass = "mceStatusbarBottom"; } else if (i == 0) { - pathClass = "mcePathTop"; + pathClass = "mceStatusbar"; } else { deltaHeight-=2; } - template['html'] += '' + pathHTML + ''; + template['html'] += '' + statusbarHTML + ''; deltaHeight -= 22; } else //Render normal Container: @@ -516,6 +533,7 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId) break; } + template['html'] += '
'; template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML); template['delta_width'] = 0; template['delta_height'] = deltaHeight; @@ -523,6 +541,147 @@ function TinyMCE_advanced_getEditorTemplate(settings, editorId) return template; } +/** + * Starts/stops the editor resizing. + */ +function TinyMCE_advanced_setResizing(e, editor_id, state) { + e = typeof(e) == "undefined" ? window.event : e; + + var resizer = TinyMCE_advanced_resizer; + var editorContainer = document.getElementById(editor_id + '_parent'); + var editorArea = document.getElementById(editor_id + '_parent').firstChild; + var resizeBox = document.getElementById(editor_id + '_resize_box'); + var inst = tinyMCE.getInstanceById(editor_id); + + if (state) { + // Place box over editor area + var width = editorArea.clientWidth; + var height = editorArea.clientHeight; + + if (tinyMCE.isMSIE) { + width += 2; + height += 2; + } + + resizeBox.style.width = width + "px"; + resizeBox.style.height = height + "px"; + + resizer.iframeWidth = inst.iframeElement.clientWidth; + resizer.iframeHeight = inst.iframeElement.clientHeight; + + // Hide editor and show resize box + editorArea.style.display = "none"; + resizeBox.style.display = "block"; + + // Add event handlers, only once + if (!resizer.eventHandlers) { + if (tinyMCE.isMSIE) + tinyMCE.addEvent(document, "mousemove", TinyMCE_advanced_resizeEventHandler); + else + tinyMCE.addEvent(window, "mousemove", TinyMCE_advanced_resizeEventHandler); + + tinyMCE.addEvent(document, "mouseup", TinyMCE_advanced_resizeEventHandler); + + resizer.eventHandlers = true; + } + + resizer.resizing = true; + resizer.downX = e.screenX; + resizer.downY = e.screenY; + resizer.width = parseInt(resizeBox.style.width); + resizer.height = parseInt(resizeBox.style.height); + resizer.editorId = editor_id; + resizer.resizeBox = resizeBox; + resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", false); + } else { + resizer.resizing = false; + resizeBox.style.display = "none"; + editorArea.style.display = "block"; + inst.getDoc().designMode = "On"; + } +} + +/** + * Handles resizing events. + */ +function TinyMCE_advanced_resizeEventHandler(e) { + var resizer = TinyMCE_advanced_resizer; + + // Do nothing + if (!resizer.resizing) + return; + + e = typeof(e) == "undefined" ? window.event : e; + + var dx = e.screenX - resizer.downX; + var dy = e.screenY - resizer.downY; + var resizeBox = resizer.resizeBox; + var editorId = resizer.editorId; + + switch (e.type) { + case "mousemove": + if (resizer.horizontal) + resizeBox.style.width = (resizer.width + dx) + "px"; + + resizeBox.style.height = (resizer.height + dy) + "px"; + break; + + case "mouseup": + resizer.resizing = false; + TinyMCE_advanced_setResizing(e, editorId, false); + + var editorContainer = document.getElementById(editorId + '_parent'); + var tableElm = editorContainer.firstChild; + var inst = tinyMCE.getInstanceById(editorId); + var width = resizer.width + dx; + var height = resizer.height + dy; + + if (resizer.horizontal) + var iframeWidth = resizer.iframeWidth + dx; + + var iframeHeight = resizer.iframeHeight + dy; + + if (tinyMCE.isGecko) { + width += 2; + height += 2; + } + + // Range check + if (iframeHeight < 40) + return; + + // Resize editor container + if (resizer.horizontal) + tableElm.style.width = width + "px"; + + tableElm.style.height = height + "px"; + + // Resize iframe + if (resizer.horizontal) + inst.iframeElement.style.width = iframeWidth + "px"; + + // Fixes 100% bug + if (tinyMCE.isGecko && !resizer.horizontal) + inst.iframeElement.style.width = resizer.iframeWidth + "px"; + + inst.iframeElement.style.height = iframeHeight + "px"; + + // Is it to small, make it bigger again + if (resizer.horizontal) { + var tableBodyElm = tableElm.firstChild; + var minIframeWidth = tableBodyElm.scrollWidth; + if (inst.iframeElement.clientWidth < minIframeWidth) { + dx = minIframeWidth - inst.iframeElement.clientWidth; + + tableElm.style.width = (width + dx) + "px"; + inst.iframeElement.style.width = (iframeWidth + dx) + "px"; + } + } + + break; + } +} + /** * Insert link template function. */ @@ -640,14 +799,10 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index, nodeData += "id: " + path[i].getAttribute('id') + " "; } - if (getAttrib(path[i], 'class') != "") + var className = tinyMCE.getVisualAidClass(getAttrib(path[i], "className"), false); + if (className != "") { - nodeData += "class: " + path[i].getAttribute('class') + " "; - } - - if (getAttrib(path[i], 'className') != "") - { - nodeData += "class: " + path[i].getAttribute('className') + " "; + nodeData += "class: " + className + " "; } if (getAttrib(path[i], 'src') != "") @@ -668,13 +823,10 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index, if (getAttrib(path[i], 'name').indexOf("mce_") != 0) { - if (getAttrib(path[i], "className") != "") + var className = tinyMCE.getVisualAidClass(getAttrib(path[i], "className"), false); + if (className != "") { - nodeName += "." + getAttrib(path[i], "className"); - } - else if (getAttrib(path[i], "class") != "") - { - nodeName += "." + getAttrib(path[i], "class"); + nodeName += "." + className; } } @@ -693,7 +845,7 @@ function TinyMCE_advanced_handleNodeChange (editor_id, node, undo_index, } } - pathElm.innerHTML = html + " "; + pathElm.innerHTML = tinyMCE.getLang('lang_theme_path') + ": " + html + " "; } // Get element color diff --git a/wp-admin/tinymce/themes/advanced/editor_ui.css b/wp-admin/tinymce/themes/advanced/editor_ui.css index fd0bd767b3..76b30db71e 100644 --- a/wp-admin/tinymce/themes/advanced/editor_ui.css +++ b/wp-admin/tinymce/themes/advanced/editor_ui.css @@ -1,3 +1,5 @@ +/* This file contains the CSS data for the editor UI of TinyMCE instances */ + .mceButtonNormal, .mceButtonOver, .mceButtonDown, .mceSeparator, .mceButtonDisabled, .mceButtonSelected { margin-top: 1px; margin-left: 1px; @@ -13,20 +15,12 @@ } .mceButtonOver { -/* border-top: 1px solid buttonhighlight; - border-left: 1px solid buttonhighlight; - border-bottom: 1px solid buttonshadow; - border-right: 1px solid buttonshadow;*/ border: 1px solid #0A246A; cursor: arrow; background-color: #B6BDD2; } .mceButtonDown { -/* border-bottom: 1px solid buttonhighlight; - border-right: 1px solid buttonhighlight; - border-top: 1px solid buttonshadow; - border-left: 1px solid buttonshadow;*/ cursor: arrow; border: 1px solid #0A246A; background-color: #8592B5; @@ -118,21 +112,29 @@ border-top: 1px solid #cccccc; } -.mcePathTop, .mcePathBottom, .mcePath { - font-family: "MS Sans Serif"; - font-size: 9pt; - padding: 2px; +.mceStatusbarTop, .mceStatusbarBottom, .mceStatusbar { height: 20px; } -.mcePathTop { +.mceStatusbarTop .mceStatusbarPathText, .mceStatusbarBottom .mceStatusbarPathText, .mceStatusbar .mceStatusbarPathText { + font-family: "MS Sans Serif"; + font-size: 9pt; + padding: 2px; + line-height: 16px; +} + +.mceStatusbarTop { border-bottom: 1px solid #cccccc; } -.mcePathBottom { +.mceStatusbarBottom { border-top: 1px solid #cccccc; } +.mceStatusbar { + border-bottom: 1px solid #cccccc; +} + .mcePathItem, .mcePathItem:link, .mcePathItem:visited, .mcePathItem:hover { text-decoration: none; font-family: "MS Sans Serif"; @@ -144,56 +146,22 @@ text-decoration: underline; } -.mcePath { - border-bottom: 1px solid #cccccc; -} - -.mceDialog { - position: absolute; - left: 100px; - top: 100px; - z-index: 1000; -} - -.mceDialogHeader { - background: #F0F0EE; - width: 100%; - height: 16px; - margin: 0px; - padding: 0px; - border: 1px solid black; - border-bottom: 0px; -} - -.mceDialogTitle { +.mceStatusbarPathText { float: left; - font-family: "MS Sans Serif"; - font-size: 9pt; - height: 14px; } -.mceDialogClose { +.mceStatusbarResize { float: right; - width: 16px; - height: 16px; - background-image: url('images/close.gif'); + background-image: url('images/statusbar_resize.gif'); background-repeat: no-repeat; - background-position: 0px 1px; - margin: 0px; - padding: 0px; + width: 11px; + height: 20px; + cursor: se-resize; } -.mceDialogClose a { - width: 16px; - height: 14px; - display: block; - font-family: "MS Sans Serif"; - font-size: 9pt; - margin: 0px; - padding: 0px; -} - -.mceDialogIFrameWrapper { - border: 1px solid black; - clear: both; +.mceResizeBox { + width: 10px; + height: 10px; + display: none; + border: 1px dotted gray; } diff --git a/wp-admin/tinymce/themes/advanced/images/statusbar_resize.gif b/wp-admin/tinymce/themes/advanced/images/statusbar_resize.gif new file mode 100644 index 0000000000000000000000000000000000000000..af89d803f8f0eeb965d9443473d5be009641cacf GIT binary patch literal 79 zcmZ?wbhEHbX*~6o0ZXGB7YP=m6OaAbAERg(>|jPrv0~%%#ha d_MXKm)lqT2YSDtso)?w9Z@gz^T^C`n1_07v8bkm9 literal 0 HcmV?d00001