先传个结果界面出来:
1.改了宽度和高度
var _toolbarStr = "\ <div id='EDiaryEditor'style='width: 692px;'>\ <div id='EDiaryEditorToolBar' style='position: relative; width: 692px; height: 69px; background-image: url(images/editor/toolbar_bg.gif);'>\ <div id='EDiaryEditorFontFamilyMenu' title='字体' style='position: absolute; left: 80px; top: 12px; width: 92px; height: 18px; line-height: 20px; padding-left: 4px; cursor: pointer;' action='Family' unselectable='on'>字体</div>\ <div id='EDiaryEditorFontSizeMenu' title='字号' style='position: absolute; left: 177px; top: 12px; width: 66px; height: 18px; line-height: 20px; padding-left: 4px; cursor: pointer;' action='Size' unselectable='on'>字号</div>\ <div id='EDiaryEditorFontStyleMenu' title='段落' style='position: absolute; left: 245px; top: 12px; width: 66px; height: 18px; line-height: 20px; padding-left: 4px; cursor: pointer;' action='Style' unselectable='on'>段落</div>\ </div>\ <div style='width: 692px; height: 25px; background-image: url(images/editor/title_bg.gif);'>\ </div>\ <div style='height: 390px; background-image: url(images/editor/guage.gif); padding-left: 39px; width: 653px!important ; width: 692px;' id='EDiaryEditorContent'>\ <iframe id='editor_body_area' name='editor_body_area' style='width: 652px; height: 390px; border-width: 0px; overflow-x: atuo; display: nones;' frameborder='0'></iframe>\ <textarea id='editor_body_textarea' name='editor_body' style='width: 650px; height: 390px; border-width: 0px; padding-top:8px; display: none;'></textarea>\ <input type='hidden' name='char_count' value='-1' id='EDiaryEditorStrLen'>\ </div>\ <div style='width: 692px; height: 59px; background-image: url(images/editor/editor_foot.gif)'>\ <div style='float: left; padding-top: 18px; margin-left: 18px; margin-top: 16px;'><input type='checkbox' id='ModeCheck'><label for='ModeCheck'>显示源代码</label></div>\ </div>\ </div>\
PS一下,把toolbar_bg.gif,guage.gif,editor_foot.gif的长度改一下,用PS的选区自由变换可以很容易修改
2.去掉功能
var _toolBarInfo = [ {l: 11, t: 12, w: 35, h: 51, a: "粘贴", n: "paste"}, {l: 46, t: 12, w: 21, h: 24, a: "剪切", n: "cut"}, {l: 46, t: 36, w: 21, h: 27, a: "复制", n: "copy"}, {l: 77, t: 41, w: 23, h: 23, a: "撤销", n: "undo"}, {l: 102, t: 41, w: 23, h: 23, a: "重做", n: "redo"}, {l: 133, t: 41, w: 23, h: 23, a: "粗体", n: "bold"}, {l: 158, t: 41, w: 24, h: 23, a: "斜体", n: "italic"}, {l: 184, t: 41, w: 24, h: 23, a: "下划线", n: "underline"}, {l: 210, t: 41, w: 24, h: 23, a: "文字颜色", n: "forecolor", c: "FColor"}, {l: 236, t: 41, w: 24, h: 23, a: "背景颜色", n: "hilitecolor", c: "HColor"}, {l: 262, t: 41, w: 24, h: 23, a: "横线", n: "inserthorizontalrule"}, /*{l: 288, t: 41, w: 24, h: 23, a: "插入表情", n: "face", c: "FaceBG"},*/ {l: 320, t: 41, w: 23, h: 23, a: "左对齐", n: "justifyleft"}, {l: 345, t: 41, w: 24, h: 23, a: "居中对齐", n: "justifycenter"}, {l: 371, t: 41, w: 24, h: 23, a: "右对齐", n: "justifyright"}, {l: 397, t: 41, w: 24, h: 23, a: "两端对齐", n: "justifyfull"}, {l: 429, t: 41, w: 59, h: 23, a: "图片排版", n: "justifyformat", c: "Justify"}, {l: 320, t: 10, w: 23, h: 23, a: "编号", n: "insertorderedlist"}, {l: 345, t: 10, w: 24, h: 23, a: "项目符号", n: "insertunorderedlist"}, {l: 371, t: 10, w: 24, h: 23, a: "减少缩进", n: "outdent"}, {l: 397, t: 10, w: 24, h: 23, a: "增加缩进", n: "indent"}, {l: 429, t: 10, w: 23, h: 23, a: "插入图片", n: "img"}, {l: 454, t: 10, w: 24, h: 23, a: "插入链接", n: "link"}, {l: 480, t: 10, w: 24, h: 23, a: "插入表格", n: "table"}, /*{l: 531, t: 10, w: 24, h: 23, a: "插入搜索", n: "iask"}, {l: 506, t: 10, w: 23, h: 23, a: "插入文本框", n: "textarea"},*/ {l: 496, t: 41, w: 59, h: 23, a: "预览文章", n: "view"}, {l: 563, t: 10, w: 48, h: 54, a: "段落化", n: "ParaFormatting"}, ];
把代码注释掉就行,当然如果嫌代码太多也可把具体的实现函数删除,但要注意删掉的东西不被其它对象调用才行。
3.添加功能
var _toolBarInfo = [{l: 531, t: 10, w: 24, h: 23, a: "新增功能", n: "new"},];
加多这行代码之后在runCMD: function (CMD, sValue) 中加入
else if (CMD == "undo" || CMD == "redo" || CMD == "cut" || CMD == "copy" || CMD == "paste") { if(window._isIE == true) { this.iframe.contentWindow.focus(); this.iframe.contentWindow.document.execCommand(CMD, false, sValue); this.iframe.contentWindow.focus(); } else { alert("该浏览器不支持本功能"); } } else if(CMD == "new"){ alert('new'); }