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

Changeset 7385


Ignore:
Timestamp:
May 25, 2008, 4:12:31 PM (14 years ago)
Author:
ebihara
Message:

#2352:IEで開始タグもしくは終了タグが消えることがあったのを修正

Location:
OpenPNE/trunk/public_html/js/tiny_mce/plugins/openpne
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/trunk/public_html/js/tiny_mce/plugins/openpne/editor_plugin.js

    r7358 r7385  
    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"){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';}
     
    3940tagList=doc.getElementsByTagName(org_tagname);}
    4041s=editorDoc.innerHTML;}
    41 var convertList=new Array('span','b','u','s','i','font');for(var i=0;i<convertList.length;i++){convertHtmlTagToDecoTag(editor.getBody(),convertList[i]);}
    42 rep(/<\/?div>/gi,"");if(tinymce.isIE){rep(/<op/gi,"<op:");rep(/<\/op/gi,"</op:");}
     42var convertList=new Array('span','font','b','u','s','i');for(var i=0;i<convertList.length;i++){convertHtmlTagToDecoTag(editor.getBody(),convertList[i]);}
     43rep(/<\/?div>/gi,"");if(Prototype.Browser.IE){rep(/<(\/?)(b|u|s|i)>/gi,'<$1op:$2>');rep(/<(\/?)op(large|small|color)/gi,'<$1op:$2');}
    4344rep(/<br\s?\/?[^>]*>/gi,"\n\n");rep(/&nbsp;/gi," ");rep(/&quot;/gi,"\"");rep(/&lt;/gi,"<");rep(/&gt;/gi,">");rep(/&amp;/gi,"&");return s;},_textToPreview:function(s){s=tinymce.trim(s);var rule=/&lt;op:(b|u|s|i|large|small|color)( code="(#[0-9a-f]{3,6})"|)&gt;(.*?)&lt;\/op:\1&gt;/i;function rep(re,str){s=s.replace(re,str);};function convertDecoTagToHtmlTag(matches)
    4445{var tagname=matches[1];var color=matches[3];var value=matches[4].gsub(rule,convertDecoTagToHtmlTag);var opt='';if(tagname=='color'&&color){tagname='font';opt=' color="'+color+'"';}
  • OpenPNE/trunk/public_html/js/tiny_mce/plugins/openpne/editor_plugin.js.src

    r7358 r7385  
    378378                var org_tagname = tagname;
    379379                var args = {};
     380
     381                if (Prototype.Browser.IE && org_tagname != "font") {
     382                    return;
     383                }
    380384
    381385                while (tagList.length) {
     
    466470            }
    467471
    468             var convertList = new Array('span', 'b', 'u', 's', 'i', 'font');
     472            var convertList = new Array('span', 'font', 'b', 'u', 's', 'i');
    469473            for (var i = 0; i < convertList.length; i++) {
    470474                convertHtmlTagToDecoTag(editor.getBody(), convertList[i]);
     
    473477            rep(/<\/?div>/gi,"");  // for Safari
    474478
    475             if (tinymce.isIE) {
    476                 rep(/<op/gi, "<op:");
    477                 rep(/<\/op/gi, "</op:");
     479            if (Prototype.Browser.IE) {
     480                rep(/<(\/?)(b|u|s|i)>/gi, '<$1op:$2>');
     481                rep(/<(\/?)op(large|small|color)/gi, '<$1op:$2');
    478482            }
    479483
Note: See TracChangeset for help on using the changeset viewer.