ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 7288


Ignore:
Timestamp:
May 20, 2008, 10:15:23 PM (11 years ago)
Author:
ebihara
Message:

#2352:IEの場合、FONT要素を除き、正規表現によって文字装飾タグへの変換をおこなうよう変更

Location:
OpenPNE/branches/stable-2.12.x/public_html/js/tiny_mce/plugins/openpne
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/stable-2.12.x/public_html/js/tiny_mce/plugins/openpne/editor_plugin.js

    r7286 r7288  
    3131id=t.prefix+id;s=tinymce.extend({title:s.title,'class':'mce_'+id,'menu_class':ed.getParam('skin')+'Skin',scope:s.scope},s);c=new tinymce.ui.OpenPNECmdButton(id,s);ed.onPostRender.add(function(){var parentContainer=document.getElementById(c.id).parentNode;parentContainer.style.width="45px";});ed.onRemove.add(function(){c.destroy();});return t.add(c);},_previewToText:function(s,editor){var editorDoc=editor.getBody();function rep(re,str){s=s.replace(re,str);};if(!tinymce.isWebKit){s=tinymce.trim(s);rep('/<(\/?)strong>/gi','<\1b>');rep('/<(\/?)strike>/gi','<\1s>');rep('/<(\/?)em>/gi','<\1i>');editor.dom.setHTML(editor.getBody(),s);}
    3232function convertHtmlTagToDecoTag(doc,tagname)
    33 {var tagList=doc.getElementsByTagName(tagname);var org_tagname=tagname;var args={};while(tagList.length){targetObj=tagList[0];if(org_tagname=="font"){var size=targetObj.getAttribute("size");var color=targetObj.getAttribute("color");if(size&&color){if(tinymce.isIE){targetObj.removeAttribute("color");targetObj.innerHTML='<font color="'+color+'">'+targetObj.innerHTML+"</font>";}else{var fontSize=document.createElement("font");fontSize.setAttribute("size",size);fontSize.removeAttribute("color");var clone=targetObj.cloneNode(true);clone.removeAttribute("size");fontSize.appendChild(clone);targetObj.parentNode.replaceChild(fontSize,targetObj);}
     33{var tagList=doc.getElementsByTagName(tagname);var org_tagname=tagname;var args={};if(Prototype.Browser.IE&&org_tagname!="font"){var reg=new RegExp("<"+tagname+">","gi");editorDoc.innerHTML=editorDoc.innerHTML.replace(reg,"<op"+tagname+">");var reg=new RegExp("</"+tagname+">","gi");editorDoc.innerHTML=editorDoc.innerHTML.replace(reg,"</op"+tagname+">");s=editorDoc.innerHTML;return;}
     34while(tagList.length){targetObj=tagList[0];if(org_tagname=="font"){var size=targetObj.getAttribute("size");var color=targetObj.getAttribute("color");if(size&&color){if(tinymce.isIE){targetObj.removeAttribute("color");targetObj.innerHTML='<font color="'+color+'">'+targetObj.innerHTML+"</font>";}else{var fontSize=document.createElement("font");fontSize.setAttribute("size",size);fontSize.removeAttribute("color");var clone=targetObj.cloneNode(true);clone.removeAttribute("size");fontSize.appendChild(clone);targetObj.parentNode.replaceChild(fontSize,targetObj);}
    3435tagList=doc.getElementsByTagName(org_tagname);args={};continue;}
    3536if(size=='5'){tagname='op:large';}else if(size=='1'){tagname='op:small';}
  • OpenPNE/branches/stable-2.12.x/public_html/js/tiny_mce/plugins/openpne/editor_plugin.js.src

    r7286 r7288  
    378378                var org_tagname = tagname;
    379379                var args = {};
     380
     381                if (Prototype.Browser.IE && org_tagname != "font") {
     382                    var reg = new RegExp("<" + tagname + ">", "gi");
     383                    editorDoc.innerHTML = editorDoc.innerHTML.replace(reg, "<op" + tagname + ">");
     384
     385                    var reg = new RegExp("</" + tagname + ">", "gi");
     386                    editorDoc.innerHTML = editorDoc.innerHTML.replace(reg, "</op" + tagname + ">");
     387
     388                    s = editorDoc.innerHTML;
     389                    return;
     390                }
    380391
    381392                while (tagList.length) {
Note: See TracChangeset for help on using the changeset viewer.