一、打开 template/wind/wysiwyg_editor.htm
找到:code: [ true, code, false ], 改成:code: [ true, showCode, false ],
二、打开js/wind_c_editor.js ,找到:function code(cmdID) {
editor.focusEditor();
text = editor.getsel();
sm = '['+cmdID+']'+text+'[/'+cmdID+']';
AddCode(sm,text);
};
改成(请注意把以下代码中一处[code ]和两处[/code ]的空格去掉):
[PHP] 纯文本查看 复制代码 function showCode(cmdID) {
editor.saveRange();
// editor.focusEditor();
var menu_editor = getObj("menu_editor");
menu_editor.className = "wy_menu_B";
editor.codeType = "none";
menu_editor.innerHTML = '<div style="width:150px;"><h4><div class="fr" style="cursor:pointer;" onclick="closep();" title="'+I18N['close']+'"><img src='+imgpath+'/close.gif></div>请选择代码类型</h4><div class="fl" style="padding:5px 30px;"><p class="f14 mb10"><div class="fl"><input name="" type="text" class="input" style="width:50px;" value="'+editor.codeType+'" /></div><div class="select_arrow fl" style="cursor:pointer;margin:2px 0 0 2px;" onclick="sell_dropdown()" >下拉</div><div class="fl"><div id="sell_dropdown" class="pw_menu" style="position:absolute;margin:20px 0 0 -17px;display:none;"><ul class="menuList tal" style="width:50px;" onmousedown="getSellValue(event)"><li><a href="javascript:;" title="默认不加高亮样式">none</a></li><li><a href="javascript:;" title="PHP">php</a></li><li><a href="javascript:;" title="Css">css</a></li><li><a href="javascript:;" title="C语言">cpp</a></li></ul></div></div><span id="sell_credit_span"></span><div class="c"></div></p></div><div class="p10 tac"><span class="btn2"><span><button onclick="insertCode()" type="button">确定</button></span></span><span class="bt2"><span><button type="button" onclick="closep()">取消</button></span></span></div></div>';
read.open('menu_editor','wy_code','2');
};
function insertCode() {
editor.restoreRange();
var text = editor.getsel();
var txt = getObj('pw_box').getElementsByTagName('input')[0].value;
if (txt != 'none') {
editor.codeType = txt;
sm = "[code="+txt+"]"+text+"[/code ]";
AddCode(sm,text);
closep();
}
else {
sm = "[code ]"+text+"[/code ]";
AddCode(sm,text);
closep();
}
} |