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

Changeset 7970


Ignore:
Timestamp:
Aug 11, 2008, 3:02:48 PM (14 years ago)
Author:
ebihara
Message:

#2899:IEで絵文字を連続入力した際に選択順に反映されなかったのを修正し、テキスト挿入処理の共通化を実施した

Location:
OpenPNE/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/trunk/public_html/js/pc_emoji_palet/pc_emoji_palet.js

    r7228 r7970  
    1414function emojiPallet(i,career,target){var src="./skin/default/img/emoji/"+career+"/"+career+i+".gif";var alt="["+career+":"+i+"]";if(target){var doc=document;var div=doc.getElementById(target);var img=doc.createElement("img");img.setAttribute("src",src);img.setAttribute("alt",alt);img.onclick=function(){putEmojiToSelf(alt)};div.appendChild(img);}else{var onclick="putEmojiToSelf('["+career+":"+i+"]')";document.write('<img src="'+src+'" alt="'+alt+'" onclick="'+onclick+'">');}}
    1515function putEmojiToSelf(emoji){var body=document.getElementsByName("body");for(var i=0;i<body.length;i++){if(body[i].nodeName.toLowerCase()=='textarea'){var elm=body[i];break;}}
    16 var selection=new Selection(elm);var pos=selection.create();var head=elm.value.substring(0,pos.start);var tail=elm.value.substring(pos.end,elm.value.length);elm.value=head+emoji+tail;}
     16pne_insert_str_to_selection(elm,emoji);}
    1717function togglePallet(pallet){if($(pallet).style.display=="none"){if(!Element.hasClassName(pallet,'isLoadEmojiImage')){Element.addClassName(pallet,"processLoadEmojiImage");var carrier='';if(pallet=='epDocomo'){carrier='docomo';}
    1818if(pallet=='epAu'){carrier='au';}
  • OpenPNE/trunk/public_html/js/pc_emoji_palet/pc_emoji_palet.js.src

    r7228 r7970  
    154154    }
    155155
    156     var selection = new Selection(elm);
    157     var pos = selection.create();
    158 
    159     var head = elm.value.substring(0, pos.start);
    160     var tail = elm.value.substring(pos.end, elm.value.length);
    161     elm.value =  head + emoji + tail;
     156    pne_insert_str_to_selection(elm, emoji);
    162157}
    163158
  • OpenPNE/trunk/public_html/js/pc_emoji_palet/pc_emoji_palet_popup.js

    r7140 r7970  
    88function emojiPalletPopup(i,career){document.write('<img src="../../skin/default/img/emoji/'+career+'/'+career+i+'.gif" alt="['+career+':'+i+']" onclick=\'putEmojiToParent("['+career+':'+i+']")\'>');}
    99function putEmojiToParent(emoji){var body=opener.document.getElementsByName("body");for(var i=0;i<body.length;i++){if(body[i].nodeName.toLowerCase()=='textarea'){var elm=body[i];break;}}
    10 var selection=new Selection(elm);var pos=selection.create();var head=elm.value.substring(0,pos.start);var tail=elm.value.substring(pos.end,elm.value.length);elm.value=head+emoji+tail;}
     10pne_insert_str_to_selection(elm,emoji);}
  • OpenPNE/trunk/public_html/js/pc_emoji_palet/pc_emoji_palet_popup.js.src

    r7140 r7970  
    5757    }
    5858
    59     var selection = new Selection(elm);
    60     var pos = selection.create();
    61 
    62     var head = elm.value.substring(0, pos.start);
    63     var tail = elm.value.substring(pos.end, elm.value.length);
    64     elm.value =  head + emoji + tail;
     59    pne_insert_str_to_selection(elm, emoji);
    6560}
  • OpenPNE/trunk/public_html/js/pne_decoration.js

    r7407 r7970  
    66{tinyMCE.init({mode:"textareas",theme:"advanced",editor_selector:"mceEditor_dummy_selector",plugins:"openpne",theme_advanced_toolbar_location:"top",theme_advanced_toolbar_align:"left",theme_advanced_buttons1:"op_b,op_u,op_s,op_i,op_large,op_small,op_color,op_image,op_emoji_docomo,op_emoji_au,op_emoji_softbank,op_cmd",theme_advanced_buttons2:"",theme_advanced_buttons3:"",valid_elements:"b/strong,u,s/strike,i,font[color|size],br",forced_root_block:false,force_p_newlines:false,force_br_newlines:true,inline_styles:false,language:"ja",entity_encoding:"raw",remove_linebreaks:false,custom_undo_redo_levels:0,custom_undo_redo:false});var textmode_checkbox=document.getElementById("mce_editor_mode_changer_1");var previewmode_checkbox=document.getElementById("mce_editor_mode_changer_2");if(previewmode_checkbox.checked){textmode_checkbox.checked=true;previewmode_checkbox.checked=false;}}
    77function pne_mce_insert_tagname(id,tagname,opt)
    8 {var opt=opt||"";var elm=document.getElementById(id);var selection=new Selection(elm);var pos=selection.create();if(tagname=="op:color"&&!opt){pne_mce_show_color_table(id,tagname);return;}
    9 var replace="<"+tagname+opt+">"+elm.value.substring(pos.start,pos.end)+"</"+tagname+">";var head=elm.value.substring(0,pos.start);var tail=elm.value.substring(pos.end,elm.value.length);elm.value=head+replace+tail;}
     8{var opt=opt||"";var elm=document.getElementById(id);if(tagname=="op:color"&&!opt){pne_mce_show_color_table(id,tagname);return;}
     9var selection=new Selection(elm);var pos=selection.create();elm.focus();var replace="<"+tagname+opt+">"+elm.value.substring(pos.start,pos.end)+"</"+tagname+">";var head=elm.value.substring(0,pos.start);var tail=elm.value.substring(pos.end,elm.value.length);elm.value=head+replace+tail;}
    1010function pne_mce_show_color_table(id,tagname)
    1111{var table=document.getElementById("mce_editor_color_table")
     
    1919var table=document.getElementById("mce_editor_color_table")
    2020table.style.display='none';Event.stopObserving(document,'mousedown',pne_mce_hide_color_table);}
     21function pne_insert_str_to_selection(elm,str)
     22{var selection=new Selection(elm);var pos=selection.create();elm.focus();var head=elm.value.substring(0,pos.start);var tail=elm.value.substring(pos.end,elm.value.length);elm.value=head+str+tail;}
  • OpenPNE/trunk/public_html/js/pne_decoration.js.src

    r7407 r7970  
    5757
    5858    var elm = document.getElementById(id);
    59     var selection = new Selection(elm);
    60 
    61     var pos = selection.create();
    6259
    6360    if (tagname == "op:color" && !opt) {
     
    6663    }
    6764
     65
     66    var selection = new Selection(elm);
     67    var pos = selection.create();
     68    elm.focus();
     69
    6870    var replace = "<" + tagname + opt + ">" + elm.value.substring(pos.start, pos.end) + "</" + tagname + ">";
     71
    6972    var head = elm.value.substring(0, pos.start);
    7073    var tail = elm.value.substring(pos.end, elm.value.length);
     
    174177}
    175178
     179function pne_insert_str_to_selection(elm, str)
     180{
     181    var selection = new Selection(elm);
     182    var pos = selection.create();
     183    elm.focus();
     184
     185    var head = elm.value.substring(0, pos.start);
     186    var tail = elm.value.substring(pos.end, elm.value.length);
     187    elm.value =  head + str + tail;
     188}
     189
  • OpenPNE/trunk/webapp/modules/pc/templates/h_album_image_insert_dialog.tpl

    r7956 r7970  
    88<script type="text/javascript" src="./js/Selection.js?r7140"></script>
    99<script type="text/javascript" src="./js/tiny_mce/tiny_mce_popup.js?r7140"></script>
     10<script type="text/javascript" src="./js/pne_decoration.js"></script>
    1011<title>({$INC_HEADER_title})</title>
    1112({t_url_style})
     
    2122        tinyMCEPopup.execCommand('mceInsertContent', false, replace);
    2223    } else {
    23         var selection = new Selection(elm);
    24 
    25         var pos = selection.create();
    26 
    27         var head = elm.value.substring(0, pos.start);
    28         var tail = elm.value.substring(pos.end, elm.value.length);
    29         elm.value =  head + replace + tail;
     24        pne_insert_str_to_selection(elm, replace);
    3025    }
    3126}
  • OpenPNE/trunk/webapp/modules/pc/templates/h_album_insert_dialog.tpl

    r7956 r7970  
    88<script type="text/javascript" src="./js/Selection.js?r7140"></script>
    99<script type="text/javascript" src="./js/tiny_mce/tiny_mce_popup.js?r7140"></script>
     10<script type="text/javascript" src="./js/pne_decoration.js"></script>
    1011<title>({$INC_HEADER_title})</title>
    1112({t_url_style})
     
    2122        tinyMCEPopup.execCommand('mceInsertContent', false, replace);
    2223    } else {
    23         var selection = new Selection(elm);
    24 
    25         var pos = selection.create();
    26 
    27         var head = elm.value.substring(0, pos.start);
    28         var tail = elm.value.substring(pos.end, elm.value.length);
    29         elm.value =  head + replace + tail;
     24        pne_insert_str_to_selection(elm, replace);
    3025    }
    3126}
Note: See TracChangeset for help on using the changeset viewer.