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

Changeset 7285


Ignore:
Timestamp:
May 20, 2008, 4:11:41 PM (11 years ago)
Author:
ebihara
Message:

Firefoxでのみ一度変更したフォントサイズを元に戻せるようにした

Location:
OpenPNE/branches/work/ebihara/prj_revert_font_size/public_html/js/tiny_mce/plugins/openpne
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/ebihara/prj_revert_font_size/public_html/js/tiny_mce/plugins/openpne/editor_plugin.js

    r7277 r7285  
    88return h;},postRender:function(){tinymce.dom.Event.add(this.id,'click',this.showMenu,this);}});tinymce.create('tinymce.ui.OpenPNECmdButton:tinymce.ui.Button',{renderHTML:function(){var s=this.settings;var h='<a id="'+this.id+'" href="javascript:;" class="mceButton mceButtonEnabled '+s['class']+'" style="width:40px;" onmousedown="return false;" onclick="return false;" title="'+tinymce.DOM.encode(s.title)+'"><img class="mceIcon" style="width:40px;" src="'+s.image+'" /></a>';return h;}});tinymce.PluginManager.requireLangPack('openpne');var config=pne_mce_editor_get_config();tinymce.create('tinymce.plugins.OpenPNEPlugin',{init:function(ed,url){var t=this;ed.settings.content_css=url+"/css/editor.css";ed.addCommand('mceOpenPNE_op_b',function(){tinyMCE.execCommand("Bold");});ed.addCommand('mceOpenPNE_op_u',function(){tinyMCE.execCommand("Underline");});ed.addCommand('mceOpenPNE_op_s',function(){tinyMCE.execCommand("Strikethrough");});ed.addCommand('mceOpenPNE_op_i',function(){tinyMCE.execCommand("Italic");});ed.addCommand('mceOpenPNE_op_large',function(){tinyMCE.execCommand("Fontsize",false,5);});ed.addCommand('mceOpenPNE_op_small',function(){tinyMCE.execCommand("Fontsize",false,1);});ed.addCommand('mceOpenPNE_op_image',function(){window.open(config.op_image.contentURL,'','width=600,height=550,toolbar=no,scrollbars=yes,left=10,top=10');});ed.addCommand('mceOpenPNE_op_cmd',function(){window.open('http://www.openpne.jp/cmd/');});for(var key in config){var value=config[key];if(value.isEnabled&&key!="op_color"){ed.addButton(key,{title:'{#openpne.'+key+'}',image:value.imageURL,cmd:'mceOpenPNE_'+key});}}
    99ed.onBeforeSetContent.add(function(ed,o){o.content=t._textToPreview(o.content);});ed.onPostProcess.add(function(ed,o){if(o.save){if(ed.isHidden()){o.content=ed.getElement().value.replace(/\n\n/g,"\n \n");}else{o.content=t._previewToText(o.content,ed);}}});ed.onNodeChange.add(function(ed,cm,n){cm.setActive('mce_editor_textarea_op_b',false);cm.setActive('mce_editor_textarea_op_u',false);cm.setActive('mce_editor_textarea_op_s',false);cm.setActive('mce_editor_textarea_op_i',false);cm.setActive('mce_editor_textarea_op_large',false);cm.setActive('mce_editor_textarea_op_small',false);var elm=n;while(elm.parentNode){var tagname=t._getTagName(elm);if((tagname=="large"||tagname=="small")&&(cm.get('mce_editor_textarea_op_large').isActive()||cm.get('mce_editor_textarea_op_small').isActive())){elm=elm.parentNode;continue;}
    10 cm.setActive('mce_editor_textarea_op_'+tagname,true);elm=elm.parentNode;}});},createControl:function(n,cm){var c=null;if(n=="op_color"&&config["op_color"].isEnabled){c=this._createOpenPNEColorButton("op_color",{title:"{#openpne.op_color}",image:config["op_color"].imageURL,cmd:"ForeColor"},cm);}
     10cm.setActive('mce_editor_textarea_op_'+tagname,true);elm=elm.parentNode;}});ed.onExecCommand.add(function(ed,cmd,ui,val){var rng=ed.selection.getRng();var beginElm=rng.startContainer;var beginOff=rng.startOffset;var finishElm=rng.endContainer;var elm=beginElm;while(elm.parentNode){var tagname=t._getTagName(elm);if((tagname=="large"&&cmd=="mceOpenPNE_op_large")||(tagname=="small"&&cmd=="mceOpenPNE_op_small")){var body=rng.extractContents();rng.setStartBefore(elm);var insertElm=rng.startContainer;var insertPoint=rng.startOffset;rng.insertNode(body);rng.selectNode(beginElm);rng.setEnd(beginElm,beginOff);var headContainer=document.createElement(rng.startContainer.nodeName);for(var i=0;i<rng.startContainer.attributes.length;i++){var attr=rng.startContainer.attributes[i];headContainer.setAttribute(attr.nodeName,attr.nodeValue);}
     11headContainer.appendChild(rng.extractContents());rng.setStart(insertElm,insertPoint);rng.setEnd(insertElm,insertPoint);rng.insertNode(headContainer);break;}
     12elm=elm.parentNode;}});},createControl:function(n,cm){var c=null;if(n=="op_color"&&config["op_color"].isEnabled){c=this._createOpenPNEColorButton("op_color",{title:"{#openpne.op_color}",image:config["op_color"].imageURL,cmd:"ForeColor"},cm);}
    1113if(n=="op_emoji_docomo"||n=="op_emoji_au"&&config["op_emoji_au"].isEnabled||n=="op_emoji_softbank"&&config["op_emoji_softbank"].isEnabled){var emoji_config={op_emoji_docomo:{carrier:"i",emoji:[{start:1,end:252}],title:"{#openpne."+n+"}",image:config[n].imageURL},op_emoji_au:{carrier:"e",emoji:[{start:1,end:518},{start:700,end:822}],title:"{#openpne."+n+"}",image:config[n].imageURL},op_emoji_softbank:{carrier:"s",emoji:[{start:1,end:485}],title:"{#openpne."+n+"}",image:config[n].imageURL}}
    1214c=this._createOpenPNEEmojiButton(n,emoji_config[n],cm);}
    1315if(n=="op_cmd"){c=this._createOpenPNECmdButton(n,{title:"{#openpne.op_cmd}",image:config["op_cmd"].imageURL,cmd:"mceOpenPNE_op_cmd"},cm);}
    14 return c;},getInfo:function(){return{longname:'OpenPNE plugin',author:'Kousuke Ebihara',version:"1.0"}},_getTagName:function(elm){var tagname=elm.nodeName.toLowerCase();if(Prototype.Browser.WebKit&&tagname=="span"){if(elm.style.fontWeight=='bold'){return'b';}
     16return c;},getInfo:function(){return{longname:'OpenPNE plugin',author:'Kousuke Ebihara',version:"1.0"}},_getTagName:function(elm){if(!elm||elm.nodeType!=1){return false;}
     17var tagname=elm.nodeName.toLowerCase();if(Prototype.Browser.WebKit&&tagname=="span"){if(elm.style.fontWeight=='bold'){return'b';}
    1518if(elm.style.textDecoration=='underline'){return'u';}
    1619if(elm.style.textDecoration=='line-through'){return's';}
  • OpenPNE/branches/work/ebihara/prj_revert_font_size/public_html/js/tiny_mce/plugins/openpne/editor_plugin.js.src

    r7277 r7285  
    181181                    }
    182182                    cm.setActive('mce_editor_textarea_op_' + tagname,  true);
     183                    elm = elm.parentNode;
     184                }
     185            });
     186            ed.onExecCommand.add(function(ed, cmd, ui, val) {
     187                var rng = ed.selection.getRng();
     188
     189                var beginElm = rng.startContainer;
     190                var beginOff = rng.startOffset;
     191                var finishElm = rng.endContainer;
     192
     193                var elm = beginElm;
     194                while (elm.parentNode) {
     195                    var tagname = t._getTagName(elm);
     196                    if ((tagname == "large" && cmd == "mceOpenPNE_op_large") || (tagname == "small" && cmd == "mceOpenPNE_op_small") ) {
     197                        var body = rng.extractContents();
     198
     199                        rng.setStartBefore(elm);
     200                        var insertElm = rng.startContainer;
     201                        var insertPoint = rng.startOffset;
     202                        rng.insertNode(body);
     203
     204                        rng.selectNode(beginElm);
     205                        rng.setEnd(beginElm, beginOff);
     206                        var headContainer = document.createElement(rng.startContainer.nodeName);
     207                        for (var i = 0; i < rng.startContainer.attributes.length; i++) {
     208                            var attr = rng.startContainer.attributes[i];
     209                            headContainer.setAttribute(attr.nodeName, attr.nodeValue);
     210                        }
     211                        headContainer.appendChild(rng.extractContents());
     212                        rng.setStart(insertElm, insertPoint);
     213                        rng.setEnd(insertElm, insertPoint);
     214                        rng.insertNode(headContainer);
     215
     216                        break;
     217                    }
    183218                    elm = elm.parentNode;
    184219                }
     
    232267
    233268        _getTagName : function(elm) {
     269            if (!elm || elm.nodeType != 1) {
     270                return false;
     271            }
     272
    234273            var tagname = elm.nodeName.toLowerCase();
    235274            if (Prototype.Browser.WebKit && tagname == "span") {
Note: See TracChangeset for help on using the changeset viewer.