- 浏览: 345252 次
- 性别:
- 来自: 厦门
文章分类
最新评论
-
弦月001:
我目前也是碰到这样的情况,在jsp里面没有问题,但在free ...
Spring+Freemarker(国际化) -
laj12347:
zhangsw_00 写道我参照你的方法,配置环境,在jsp文 ...
Spring+Freemarker(国际化) -
yctan:
hi,能不能把发送邮件的代码也贴一下啊。
用webdav协议访问exchange邮件服务器,下载附件的问题 -
maketc:
楼上正解,这个问题也被郁闷了半天,试过重启tomcat、ecl ...
Tomcat 部署 Could not copy all resources to 或者Undeployment Failure could not be re -
masuweng:
楼上正解,这个问题曾被郁闷了半天
Tomcat 部署 Could not copy all resources to 或者Undeployment Failure could not be re
网上有些免费的在线HTML编辑器,有的功能实在是过于强大但显得臃肿不堪;有的外表轻松紧凑但又没有直接的源码提供。根据163、sina、sohu等门户网站邮箱里的编辑器样式,个人改造了一个功能简单的Editor:
编辑器一般包括二个部分: 工具条和文本区,文本区又可以通过按钮进行源码方式和文本方式的切换即存在文本域与源码域。
首先是采用一个标准的样式表来规范编辑器的页面,有以下基于图形toolbar.gif的文件editor.css:
toolbar.gif如下:
editor.css如下:
#dvPanel {...}{ position:relative;width:600px;height:240px; }
#dvToobar{...}{ padding-left:3px;padding-top:2px;background-color: #EEEEEE; border-top:1px solid #AAAAAA;border-right:1px solid #AAAAAA;border-left:1px solid #AAAAAA; height:26px; }
#divEditor{...}{background-color:#EEEEEE;border-top:1px solid #AAAAAA;border-right:1px solid #AAAAAA; border-left:1px solid #AAAAAA;border-bottom:1px solid #AAAAAA;height:224px;}
#dvToobar a {...}{background-repeat:no-repeat;display:block;float:left;margin-right:3px;border:1px solid #dfdfdf;border-top:1px solid #E2E3E2;border-bottom:1px solid #E2E3E2; background-image:url(toolbar.gif);height:20px; font-size:0px;}
#dvToobar a:hover{...}{border-top:1px solid #CCC;border-right:1px solid #999;border-bottom:1px solid #999;border-left:1px solid #CCC;background-color:#FFF}
#dvToobar a.icoCut{...}{background-position:-1px -3px;width:22px; }
#dvToobar a.icoCpy{...}{background-position:-28px -3px; width:24px; }
#dvToobar a.icoPse{...}{background-position:-57px -3px; width:52px}
#dvToobar a.icoWgt{...}{background-position:-108px -3px; width:24px}
#dvToobar a.icoIta{...}{background-position:-136px -3px; width:22px}
#dvToobar a.icoUln{...}{background-position:-164px -3px; width:24px}
#dvToobar a.icoAgn{...}{background-position:-192px -3px; width:24px;}
#dvToobar a.icoLst{...}{background-position:-220px -3px; width:24px;}
#dvToobar a.icoOdt{...}{background-position:-248px -3px; width:26px;}
#dvToobar a.icoFcl{...}{background-position:-332px -1px; width:24px;}
#dvToobar a.icoUrl{...}{background-position:-360px -3px; width:24px;}
#dvToobar a.icoImg{...}{background-position:-388px -1px; width:24px;}
#dvToobar a.icoMfc{...}{background-position:-416px -3px; width:24px;}
#dvToobar a.icoHtm{...}{background-position:-442px -3px; width:44px;}
#dvAlign {...}{ background:#FFFFFF;border:1px solid #838383;padding:1px; width:60px;height:60px;}
#dvAlign a{...}{font-size:12px; height:16px;line-height:16px; display:block;padding:2px;color:#000000;text-decoration:none;position:relative}
#dvAlign a:hover{...}{ background:#E5E5E5}
#dvOrder {...}{ background:#FFFFFF;border:1px solid #838383;padding:1px; width:60px;height:40px;}
#dvOrder a{...}{font-size:12px; height:16px;line-height:16px; display:block;padding:2px;color:#000000;text-decoration:none;position:relative}
#dvOrder a:hover{...}{ background:#E5E5E5}
#dvDent {...}{ background:#FFFFFF;border:1px solid #838383;padding:1px; width:60px;height:40px;}
#dvDent a{...}{font-size:12px; height:16px;line-height:16px; display:block;padding:2px;color:#000000;text-decoration:none;position:relative}
#dvDent a:hover{...}{ background:#E5E5E5}
#dvForeColor {...}{ position:relative;left:50px;background:#FFFFFF;border:1px solid #838383;width:90px;}
#dvForeColor a{...}{font-size:12px;height:16px;line-height:16px;display:block;padding:2px;color:#000000;text-decoration:none;position:relative}
#dvForeColor a:hover{...}{ background:#E5E5E5}
#dvForeColor span{...}{position:absolute;left:19px;top:0px;cursor:hand!important;cursor:pointer;color:#333}
#dvForeColor b{...}{font-size:0;display:block;width:10px;height:8px;position:relative;left:4px;top:1px;cursor:hand!important;cursor:pointer}
.fontfamily {...}{ position: relative;width:100px;height:22px;font-size:12px;float:left;margin-right:5px;}
.fontsize {...}{ position: relative;width: 50px;height:22px;font-size:12px;float:left;margin-right:5px;}
.HtmlEditor {...}{ width:100%; height:100%; }
.sourceEditor{...}{
height:100%;
width:100%;
border:0px;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
在初始化函数中我们必须先加载这一样式单:
loadcss:function () ...{
var links= document.createElement("Link");
links.setAttribute("type","text/css");
links.setAttribute("rel","stylesheet");
links.setAttribute("href","editor.css");
document.getElementsByTagName("head")[0].appendChild(links);
}
这样就可以准备装载工具条了:
工具条包括了字体字号、粘贴复制、粗体倾斜下划链接等,其中对齐编号缩进颜色包括多项这里我也采用了浮层菜单的方式。对工具条的加载包括三个部分:
1.对象或者对象元素数组的的初始化(代码部分就不解释了)
var EditorKit=...{
mode: 1, //change the appearence between HTML and SOURCE
FontColors:...{ "0":["暗红色","#800000"],"1":["紫色","#800080"],"2":["红色","#F00000"],"3":["鲜粉色","#F000F0"],"4":["深蓝色","#000080"],"5":["蓝色","#0000F0"],"6":["湖蓝色","#00F0F0"],"7":["蓝绿色","#008080"],"8":["绿色","#008000"],"9":["橄榄色","#808000"],"10":["浅绿色","#00F000"],"11":["橙黄色","#F0C000"],"12":["黑色","#000000"],"13":["灰色","#808080"],"14":["银色","#C0C0C0"],"15":["白色","#FFFFFF"] },
fonts:["字体","宋体","黑体","楷体_GB2312","隶书","幼圆","Arial","Arial Narrow","Arial Black","Comic Sans MS","Courier","System","Times New Roman"],
sizes:["字号","1","2","3","4","5","6","7"],
aligns:...{"0":["Justifyleft","左对齐"],"1":["Justifycenter","居中对齐"],"2":["Justifyright","右对齐"]},
orders:...{"0":["Insertorderedlist","数字列表"],"1":["Insertunorderedlist","符号列表"]},
dents :...{"0":["Indent","增加缩进"],"1":["Outdent","减少缩进"]},
divs:["dvAlign","dvOrder","dvDent","dvForeColor","dvImgFace"],
//including the following methods;
}
2.工具对应的功能函数
format:function(type, para)...{
var f = window.frames["HtmlEditor"];
f.focus();
if(!para) f.document.execCommand(type);
else f.document.execCommand(type,false,para);
f.focus();
},
changeMode:function ()...{ var sourceEditor =document.getElementById("sourceEditor");
var HtmlEditor =document.getElementById("HtmlEditor");
var divEditor = document.getElementById("divEditor");
var f = window.frames["HtmlEditor"];
var body = f.document.getElementsByTagName("BODY")[0];
if(this.mode)...{
sourceEditor.style.display = "";
HtmlEditor.style.display = "none";
sourceEditor.value = body.innerHTML;
}else...{
sourceEditor.style.display = "none";
HtmlEditor.style.display = "";
body.innerHTML = sourceEditor.value;
}
this.mode=1-this.mode;
},
//隐藏所有已打开的菜单浮动层
hideAllMenu:function () ...{
for (each in this.divs)
...{
if(document.getElementById(this.divs[each])) document.getElementById(this.divs[each]).style.display="none";
}
},
//加载对齐下拉浮动菜单层;首次点击时进行
loadAlign: function () ...{
var aligndiv=document.createElement("div");
aligndiv.style.display="none";
aligndiv.setAttribute("id","dvAlign");
aligndiv.style.position="absolute";
//计算偏移位置,在单击按钮align正下方24px处;
var e=document.getElementById("alignbtn");
var x=e.offsetLeft;
var y=e.offsetTop;
while(e=e.offsetParent)...{ x+=e.offsetLeft; y+=e.offsetTop; }
y+=24;
aligndiv.style.left= x+"px";
aligndiv.style.top = y+"px";
var aligna;
for(each in this.aligns) ...{
aligna=document.createElement("A");
aligna.setAttribute("href","javascript:EditorKit.setAlign('"+this.aligns[each][0]+"')");
aligna.appendChild(document.createTextNode(this.aligns[each][1]));
aligndiv.appendChild(aligna);
}
document.getElementsByTagName("body")[0].appendChild(aligndiv);
},
showAlign:function () ...{
if(!document.getElementById("dvAlign")) this.loadAlign();
var aligndiv=document.getElementById("dvAlign");
this.hideAllMenu();
aligndiv.style.display="";
},
setAlign:function(type) ...{
this.format(type);
document.getElementById("dvAlign").style.display="none";
},
loadOrder:function() ...{
var orderdiv=document.createElement("div");
orderdiv.style.display="none";
orderdiv.setAttribute("id","dvOrder");
orderdiv.style.position="absolute";
//计算偏移位置,在单击按钮align正下方24px处;
var e=document.getElementById("orderbtn");
var x=e.offsetLeft;
var y=e.offsetTop;
while(e=e.offsetParent)...{ x+=e.offsetLeft; y+=e.offsetTop; }
y+=24;
orderdiv.style.left= x+"px";
orderdiv.style.top = y+"px";
var ordera;
for(each in this.orders) ...{
ordera=document.createElement("A");
ordera.setAttribute("href","javascript:EditorKit.setOrder('"+this.orders[each][0]+"')");
ordera.appendChild(document.createTextNode(this.orders[each][1]));
orderdiv.appendChild(ordera);
}
document.getElementsByTagName("body")[0].appendChild(orderdiv);
},
showOrder:function() ...{
if(!document.getElementById("dvOrder")) this.loadOrder();
var orderdiv=document.getElementById("dvOrder");
this.hideAllMenu();
orderdiv.style.display="";
},
setOrder:function(type) ...{
this.format(type);
document.getElementById("dvOrder").style.display="none";
},
loadDent:function() ...{
var dentdiv=document.createElement("div");
dentdiv.style.display="none";
dentdiv.setAttribute("id","dvDent");
dentdiv.style.position="absolute";
//计算偏移位置,在单击按钮align正下方24px处;
var e=document.getElementById("dentbtn");
var x=e.offsetLeft;
var y=e.offsetTop;
while(e=e.offsetParent)...{ x+=e.offsetLeft; y+=e.offsetTop; }
y+=24;
dentdiv.style.left= x+"px";
dentdiv.style.top = y+"px";
var denta;
for(each in this.dents) ...{
denta=document.createElement("A");
denta.setAttribute("href","javascript:EditorKit.setDent('"+this.dents[each][0]+"')");
denta.appendChild(document.createTextNode(this.dents[each][1]));
dentdiv.appendChild(denta);
}
document.getElementsByTagName("body")[0].appendChild(dentdiv);
},
showDent:function() ...{
if(!document.getElementById("dvDent")) this.loadDent();
var dentdiv=document.getElementById("dvDent");
this.hideAllMenu();
dentdiv.style.display="";
},
setDent:function(type) ...{
this.format(type);
document.getElementById("dvDent").style.display="none";
},
loadForeColor:function() ...{
var colordiv=document.createElement("div");
colordiv.setAttribute("id","dvForeColor");
colordiv.style.display="none";
colordiv.style.position="absolute";
var e=document.getElementById("foreColorbtn");
var x=e.offsetLeft;
var y=e.offsetTop;
while(e=e.offsetParent)...{ x+=e.offsetLeft; y+=e.offsetTop; }
y+=24;
colordiv.style.left= x+"px";
colordiv.style.top = y+"px";
var newcolor;
var block;
var stext;
for(each in this.FontColors) ...{
newcolor=document.createElement("A");
newcolor.setAttribute("href","javascript:EditorKit.setForeColor('"+this.FontColors[each][1]+"')");
block=document.createElement("B");
block.style.backgroundColor =this.FontColors[each][1];
stext=document.createElement("span");
stext.appendChild(document.createTextNode(this.FontColors[each][0]));
newcolor.appendChild(stext);
newcolor.insertBefore(block,stext);
colordiv.appendChild(newcolor);
}
document.getElementsByTagName("body")[0].appendChild(colordiv);
},
showForeColor:function() ...{
if(!document.getElementById("dvForeColor")) this.loadForeColor();
var foreColordiv=document.getElementById("dvForeColor");
this.hideAllMenu();
foreColordiv.style.display="";
},
setForeColor:function(para) ...{
this.format("forecolor",para);
document.getElementById("dvForeColor").style.display="none";
},
setFontname:function () ...{
var index=document.getElementById("fontfamily").selectedIndex;
if(index!=0) ...{
EditorKit.format("fontname",EditorKit.fonts[index]);
}
},
setFontsize:function () ...{
var index=document.getElementById("fontsize").selectedIndex;
if(index!=0) ...{
EditorKit.format("fontsize",EditorKit.sizes[index]);
}
},
showToolbar:function () ...{
document.getElementById("dvToobar").style.display="";
},
createLink: function () ...{
var sURL=window.prompt("请输入链接 (如:http://www.163.com/):", "http://");
if ((sURL!=null) && (sURL!="http://")) ...{ this.format("CreateLink", sURL); }
},
insertimgInit:function() ...{
var file=document.createElement("input");
file.style.display="none";
file.setAttribute("type","file");
file.setAttribute("id","imgname");
document.getElementsByTagName("body")[0].appendChild(file);
},
insertImg:function ()...{
if(!document.getElementById("imgname")) this.insertimgInit();
document.getElementById("imgname").click();
document.getElementById("imgname").onChange=document.getElementById("imgname").value!=""?this.format("InsertImage",document.getElementById("imgname").value):null;
}
在加载浮层菜单时候用到了元素绝对地址的计算,方法也很简单。
3.在初始化函数中添加这些元素
//加载工具条
var dvToobar=document.createElement("div");
dvToobar.setAttribute("id","dvToobar");
dvToobar.style.display="none";
//1.加载字体类型
var family=document.createElement("select");
family.className="fontfamily";
family.setAttribute("id","fontfamily");
family.attachEvent("onchange",EditorKit.setFontname);
var newfont;
for(each in this.fonts) ...{
newfont=document.createElement("option");
newfont.value=this.fonts[each];
newfont.appendChild(document.createTextNode(this.fonts[each]));
family.appendChild(newfont);
}
dvToobar.appendChild(family);
//2.加载字体大小
var fontsizes=document.createElement("select");
fontsizes.className="fontsize";
fontsizes.setAttribute("id","fontsize");
fontsizes.attachEvent("onchange",EditorKit.setFontsize);
var newsize;
for(each in this.sizes) ...{
newsize=document.createElement("option");
newsize.appendChild(document.createTextNode(this.sizes[each]));
fontsizes.appendChild(newsize);
}
dvToobar.appendChild(fontsizes);
//3.加载一些小按钮
//剪切
var cutBtn=document.createElement("A");
cutBtn.className="icoCut";
cutBtn.setAttribute("href","javascript:EditorKit.format('Cut')");
cutBtn.setAttribute("title","剪切");
dvToobar.appendChild(cutBtn);
//复制
var cpyBtn=document.createElement("A");
cpyBtn.className="icoCpy";
cpyBtn.setAttribute("href","javascript:EditorKit.format('Copy')");
cpyBtn.setAttribute("title","复制");
dvToobar.appendChild(cpyBtn);
//粘贴
var pseBtn=document.createElement("A");
pseBtn.className="icoPse";
pseBtn.setAttribute("href","javascript:EditorKit.format('Paste')");
pseBtn.setAttribute("title","粘贴");
dvToobar.appendChild(pseBtn);
//加粗
var bldBtn=document.createElement("A");
bldBtn.className="icoWgt";
bldBtn.setAttribute("href","javascript:EditorKit.format('Bold')");
bldBtn.setAttribute("title","加粗");
dvToobar.appendChild(bldBtn);
//斜体
var itaBtn=document.createElement("A");
itaBtn.className="icoIta";
itaBtn.setAttribute("href","javascript:EditorKit.format('Italic')");
itaBtn.setAttribute("title","斜体");
dvToobar.appendChild(itaBtn);
//下划线
var ulnBtn=document.createElement("A");
ulnBtn.className="icoUln";
ulnBtn.setAttribute("href","javascript:EditorKit.format('Underline')");
ulnBtn.setAttribute("title","下划线");
dvToobar.appendChild(ulnBtn);
//对齐
var agnBtn=document.createElement("A");
agnBtn.className="icoAgn";
agnBtn.setAttribute("href","javascript:EditorKit.showAlign()");
agnBtn.setAttribute("id","alignbtn");
agnBtn.setAttribute("title","对齐");
dvToobar.appendChild(agnBtn);
//编号
var lstBtn=document.createElement("A");
lstBtn.className="icoLst";
lstBtn.setAttribute("href","javascript:EditorKit.showOrder()");
lstBtn.setAttribute("id","orderbtn");
lstBtn.setAttribute("title","编号");
dvToobar.appendChild(lstBtn);
//缩进
var odtBtn=document.createElement("A");
odtBtn.className="icoOdt";
odtBtn.setAttribute("href","javascript:EditorKit.showDent()");
odtBtn.setAttribute("id","dentbtn");
odtBtn.setAttribute("title","缩进");
dvToobar.appendChild(odtBtn);
//字体颜色
var fclBtn=document.createElement("A");
fclBtn.className="icoFcl";
fclBtn.setAttribute("href","javascript:EditorKit.showForeColor()");
fclBtn.setAttribute("id","foreColorbtn");
fclBtn.setAttribute("title","字体颜色");
dvToobar.appendChild(fclBtn);
//超链接
var urlBtn=document.createElement("A");
urlBtn.className="icoUrl";
urlBtn.setAttribute("href","javascript:EditorKit.createLink()");
urlBtn.setAttribute("title","超链接");
dvToobar.appendChild(urlBtn);
//增加图片
var imgBtn=document.createElement("A");
imgBtn.className="icoImg";
imgBtn.setAttribute("href","javascript:EditorKit.insertImg()");
imgBtn.setAttribute("title","增加图片");
dvToobar.appendChild(imgBtn);
//魔法表情
var mfcBtn=document.createElement("A");
mfcBtn.className="icoMfc";
mfcBtn.setAttribute("href","javascript:loadimgface()");
mfcBtn.setAttribute("title","魔法表情");
dvToobar.appendChild(mfcBtn);
//模式切换
var htmBtn=document.createElement("A");
htmBtn.className="icoHtm";
htmBtn.setAttribute("href","javascript:EditorKit.changeMode()");
htmBtn.setAttribute("title","模式切换");
dvToobar.appendChild(htmBtn);
根据前面的分析,文本区的加载自然包括二个部分:
//文本面板: 包括一个框架和一个文本域
var txtpanel=document.createElement("div");
txtpanel.setAttribute("id","divEditor");
//一个框架,可以进行正常的编辑面板
var HtmlEditor=document.createElement("iframe");
HtmlEditor.frameBorder =0;
HtmlEditor.marginHeight=0;
HtmlEditor.marginWidth =0;
HtmlEditor.src="about:blank";
HtmlEditor.setAttribute("id","HtmlEditor");
HtmlEditor.className="HtmlEditor";
HtmlEditor.attachEvent("onfocus",EditorKit.showToolbar);
txtpanel.appendChild(HtmlEditor);
var sourceEditor=document.createElement("textarea");
sourceEditor.className="sourceEditor";
sourceEditor.setAttribute("id","sourceEditor");
txtpanel.appendChild(sourceEditor);
var dvpanel=document.createElement("div");
dvpanel.setAttribute("id","dvPanel");
dvpanel.appendChild(dvToobar);
dvpanel.appendChild(txtpanel);
document.getElementsByTagName("body")[0].appendChild(dvpanel);
这里我已经绑定了点击后就弹出隐藏的工具栏函数,参见前面的代码。
最后是激活这个编辑器控件:
aliveEditor:function () ...{
var f = window.frames["HtmlEditor"];
var html = '<HEAD></HEAD><BODY><div></div></BODY>';
f.document.open("text/html","replace");
f.document.write(html);
f.document.close();
f.document.designMode="on";
var sourceEditor =document.getElementById("sourceEditor");
sourceEditor.style.display = "none";
}
其实更好的方法是仅仅提供一个工具条的接口给页面使用,在实际中应努力做好需要时再加载且之加载一次,
而不再去关联实际需要的文本区,进而免去对文本区不必要的束缚。
编辑器一般包括二个部分: 工具条和文本区,文本区又可以通过按钮进行源码方式和文本方式的切换即存在文本域与源码域。
首先是采用一个标准的样式表来规范编辑器的页面,有以下基于图形toolbar.gif的文件editor.css:
toolbar.gif如下:
editor.css如下:
#dvPanel {...}{ position:relative;width:600px;height:240px; }
#dvToobar{...}{ padding-left:3px;padding-top:2px;background-color: #EEEEEE; border-top:1px solid #AAAAAA;border-right:1px solid #AAAAAA;border-left:1px solid #AAAAAA; height:26px; }
#divEditor{...}{background-color:#EEEEEE;border-top:1px solid #AAAAAA;border-right:1px solid #AAAAAA; border-left:1px solid #AAAAAA;border-bottom:1px solid #AAAAAA;height:224px;}
#dvToobar a {...}{background-repeat:no-repeat;display:block;float:left;margin-right:3px;border:1px solid #dfdfdf;border-top:1px solid #E2E3E2;border-bottom:1px solid #E2E3E2; background-image:url(toolbar.gif);height:20px; font-size:0px;}
#dvToobar a:hover{...}{border-top:1px solid #CCC;border-right:1px solid #999;border-bottom:1px solid #999;border-left:1px solid #CCC;background-color:#FFF}
#dvToobar a.icoCut{...}{background-position:-1px -3px;width:22px; }
#dvToobar a.icoCpy{...}{background-position:-28px -3px; width:24px; }
#dvToobar a.icoPse{...}{background-position:-57px -3px; width:52px}
#dvToobar a.icoWgt{...}{background-position:-108px -3px; width:24px}
#dvToobar a.icoIta{...}{background-position:-136px -3px; width:22px}
#dvToobar a.icoUln{...}{background-position:-164px -3px; width:24px}
#dvToobar a.icoAgn{...}{background-position:-192px -3px; width:24px;}
#dvToobar a.icoLst{...}{background-position:-220px -3px; width:24px;}
#dvToobar a.icoOdt{...}{background-position:-248px -3px; width:26px;}
#dvToobar a.icoFcl{...}{background-position:-332px -1px; width:24px;}
#dvToobar a.icoUrl{...}{background-position:-360px -3px; width:24px;}
#dvToobar a.icoImg{...}{background-position:-388px -1px; width:24px;}
#dvToobar a.icoMfc{...}{background-position:-416px -3px; width:24px;}
#dvToobar a.icoHtm{...}{background-position:-442px -3px; width:44px;}
#dvAlign {...}{ background:#FFFFFF;border:1px solid #838383;padding:1px; width:60px;height:60px;}
#dvAlign a{...}{font-size:12px; height:16px;line-height:16px; display:block;padding:2px;color:#000000;text-decoration:none;position:relative}
#dvAlign a:hover{...}{ background:#E5E5E5}
#dvOrder {...}{ background:#FFFFFF;border:1px solid #838383;padding:1px; width:60px;height:40px;}
#dvOrder a{...}{font-size:12px; height:16px;line-height:16px; display:block;padding:2px;color:#000000;text-decoration:none;position:relative}
#dvOrder a:hover{...}{ background:#E5E5E5}
#dvDent {...}{ background:#FFFFFF;border:1px solid #838383;padding:1px; width:60px;height:40px;}
#dvDent a{...}{font-size:12px; height:16px;line-height:16px; display:block;padding:2px;color:#000000;text-decoration:none;position:relative}
#dvDent a:hover{...}{ background:#E5E5E5}
#dvForeColor {...}{ position:relative;left:50px;background:#FFFFFF;border:1px solid #838383;width:90px;}
#dvForeColor a{...}{font-size:12px;height:16px;line-height:16px;display:block;padding:2px;color:#000000;text-decoration:none;position:relative}
#dvForeColor a:hover{...}{ background:#E5E5E5}
#dvForeColor span{...}{position:absolute;left:19px;top:0px;cursor:hand!important;cursor:pointer;color:#333}
#dvForeColor b{...}{font-size:0;display:block;width:10px;height:8px;position:relative;left:4px;top:1px;cursor:hand!important;cursor:pointer}
.fontfamily {...}{ position: relative;width:100px;height:22px;font-size:12px;float:left;margin-right:5px;}
.fontsize {...}{ position: relative;width: 50px;height:22px;font-size:12px;float:left;margin-right:5px;}
.HtmlEditor {...}{ width:100%; height:100%; }
.sourceEditor{...}{
height:100%;
width:100%;
border:0px;
white-space: pre-wrap;
white-space: -moz-pre-wrap;
white-space: -pre-wrap;
white-space: -o-pre-wrap;
word-wrap: break-word;
}
在初始化函数中我们必须先加载这一样式单:
loadcss:function () ...{
var links= document.createElement("Link");
links.setAttribute("type","text/css");
links.setAttribute("rel","stylesheet");
links.setAttribute("href","editor.css");
document.getElementsByTagName("head")[0].appendChild(links);
}
这样就可以准备装载工具条了:
工具条包括了字体字号、粘贴复制、粗体倾斜下划链接等,其中对齐编号缩进颜色包括多项这里我也采用了浮层菜单的方式。对工具条的加载包括三个部分:
1.对象或者对象元素数组的的初始化(代码部分就不解释了)
var EditorKit=...{
mode: 1, //change the appearence between HTML and SOURCE
FontColors:...{ "0":["暗红色","#800000"],"1":["紫色","#800080"],"2":["红色","#F00000"],"3":["鲜粉色","#F000F0"],"4":["深蓝色","#000080"],"5":["蓝色","#0000F0"],"6":["湖蓝色","#00F0F0"],"7":["蓝绿色","#008080"],"8":["绿色","#008000"],"9":["橄榄色","#808000"],"10":["浅绿色","#00F000"],"11":["橙黄色","#F0C000"],"12":["黑色","#000000"],"13":["灰色","#808080"],"14":["银色","#C0C0C0"],"15":["白色","#FFFFFF"] },
fonts:["字体","宋体","黑体","楷体_GB2312","隶书","幼圆","Arial","Arial Narrow","Arial Black","Comic Sans MS","Courier","System","Times New Roman"],
sizes:["字号","1","2","3","4","5","6","7"],
aligns:...{"0":["Justifyleft","左对齐"],"1":["Justifycenter","居中对齐"],"2":["Justifyright","右对齐"]},
orders:...{"0":["Insertorderedlist","数字列表"],"1":["Insertunorderedlist","符号列表"]},
dents :...{"0":["Indent","增加缩进"],"1":["Outdent","减少缩进"]},
divs:["dvAlign","dvOrder","dvDent","dvForeColor","dvImgFace"],
//including the following methods;
}
2.工具对应的功能函数
format:function(type, para)...{
var f = window.frames["HtmlEditor"];
f.focus();
if(!para) f.document.execCommand(type);
else f.document.execCommand(type,false,para);
f.focus();
},
changeMode:function ()...{ var sourceEditor =document.getElementById("sourceEditor");
var HtmlEditor =document.getElementById("HtmlEditor");
var divEditor = document.getElementById("divEditor");
var f = window.frames["HtmlEditor"];
var body = f.document.getElementsByTagName("BODY")[0];
if(this.mode)...{
sourceEditor.style.display = "";
HtmlEditor.style.display = "none";
sourceEditor.value = body.innerHTML;
}else...{
sourceEditor.style.display = "none";
HtmlEditor.style.display = "";
body.innerHTML = sourceEditor.value;
}
this.mode=1-this.mode;
},
//隐藏所有已打开的菜单浮动层
hideAllMenu:function () ...{
for (each in this.divs)
...{
if(document.getElementById(this.divs[each])) document.getElementById(this.divs[each]).style.display="none";
}
},
//加载对齐下拉浮动菜单层;首次点击时进行
loadAlign: function () ...{
var aligndiv=document.createElement("div");
aligndiv.style.display="none";
aligndiv.setAttribute("id","dvAlign");
aligndiv.style.position="absolute";
//计算偏移位置,在单击按钮align正下方24px处;
var e=document.getElementById("alignbtn");
var x=e.offsetLeft;
var y=e.offsetTop;
while(e=e.offsetParent)...{ x+=e.offsetLeft; y+=e.offsetTop; }
y+=24;
aligndiv.style.left= x+"px";
aligndiv.style.top = y+"px";
var aligna;
for(each in this.aligns) ...{
aligna=document.createElement("A");
aligna.setAttribute("href","javascript:EditorKit.setAlign('"+this.aligns[each][0]+"')");
aligna.appendChild(document.createTextNode(this.aligns[each][1]));
aligndiv.appendChild(aligna);
}
document.getElementsByTagName("body")[0].appendChild(aligndiv);
},
showAlign:function () ...{
if(!document.getElementById("dvAlign")) this.loadAlign();
var aligndiv=document.getElementById("dvAlign");
this.hideAllMenu();
aligndiv.style.display="";
},
setAlign:function(type) ...{
this.format(type);
document.getElementById("dvAlign").style.display="none";
},
loadOrder:function() ...{
var orderdiv=document.createElement("div");
orderdiv.style.display="none";
orderdiv.setAttribute("id","dvOrder");
orderdiv.style.position="absolute";
//计算偏移位置,在单击按钮align正下方24px处;
var e=document.getElementById("orderbtn");
var x=e.offsetLeft;
var y=e.offsetTop;
while(e=e.offsetParent)...{ x+=e.offsetLeft; y+=e.offsetTop; }
y+=24;
orderdiv.style.left= x+"px";
orderdiv.style.top = y+"px";
var ordera;
for(each in this.orders) ...{
ordera=document.createElement("A");
ordera.setAttribute("href","javascript:EditorKit.setOrder('"+this.orders[each][0]+"')");
ordera.appendChild(document.createTextNode(this.orders[each][1]));
orderdiv.appendChild(ordera);
}
document.getElementsByTagName("body")[0].appendChild(orderdiv);
},
showOrder:function() ...{
if(!document.getElementById("dvOrder")) this.loadOrder();
var orderdiv=document.getElementById("dvOrder");
this.hideAllMenu();
orderdiv.style.display="";
},
setOrder:function(type) ...{
this.format(type);
document.getElementById("dvOrder").style.display="none";
},
loadDent:function() ...{
var dentdiv=document.createElement("div");
dentdiv.style.display="none";
dentdiv.setAttribute("id","dvDent");
dentdiv.style.position="absolute";
//计算偏移位置,在单击按钮align正下方24px处;
var e=document.getElementById("dentbtn");
var x=e.offsetLeft;
var y=e.offsetTop;
while(e=e.offsetParent)...{ x+=e.offsetLeft; y+=e.offsetTop; }
y+=24;
dentdiv.style.left= x+"px";
dentdiv.style.top = y+"px";
var denta;
for(each in this.dents) ...{
denta=document.createElement("A");
denta.setAttribute("href","javascript:EditorKit.setDent('"+this.dents[each][0]+"')");
denta.appendChild(document.createTextNode(this.dents[each][1]));
dentdiv.appendChild(denta);
}
document.getElementsByTagName("body")[0].appendChild(dentdiv);
},
showDent:function() ...{
if(!document.getElementById("dvDent")) this.loadDent();
var dentdiv=document.getElementById("dvDent");
this.hideAllMenu();
dentdiv.style.display="";
},
setDent:function(type) ...{
this.format(type);
document.getElementById("dvDent").style.display="none";
},
loadForeColor:function() ...{
var colordiv=document.createElement("div");
colordiv.setAttribute("id","dvForeColor");
colordiv.style.display="none";
colordiv.style.position="absolute";
var e=document.getElementById("foreColorbtn");
var x=e.offsetLeft;
var y=e.offsetTop;
while(e=e.offsetParent)...{ x+=e.offsetLeft; y+=e.offsetTop; }
y+=24;
colordiv.style.left= x+"px";
colordiv.style.top = y+"px";
var newcolor;
var block;
var stext;
for(each in this.FontColors) ...{
newcolor=document.createElement("A");
newcolor.setAttribute("href","javascript:EditorKit.setForeColor('"+this.FontColors[each][1]+"')");
block=document.createElement("B");
block.style.backgroundColor =this.FontColors[each][1];
stext=document.createElement("span");
stext.appendChild(document.createTextNode(this.FontColors[each][0]));
newcolor.appendChild(stext);
newcolor.insertBefore(block,stext);
colordiv.appendChild(newcolor);
}
document.getElementsByTagName("body")[0].appendChild(colordiv);
},
showForeColor:function() ...{
if(!document.getElementById("dvForeColor")) this.loadForeColor();
var foreColordiv=document.getElementById("dvForeColor");
this.hideAllMenu();
foreColordiv.style.display="";
},
setForeColor:function(para) ...{
this.format("forecolor",para);
document.getElementById("dvForeColor").style.display="none";
},
setFontname:function () ...{
var index=document.getElementById("fontfamily").selectedIndex;
if(index!=0) ...{
EditorKit.format("fontname",EditorKit.fonts[index]);
}
},
setFontsize:function () ...{
var index=document.getElementById("fontsize").selectedIndex;
if(index!=0) ...{
EditorKit.format("fontsize",EditorKit.sizes[index]);
}
},
showToolbar:function () ...{
document.getElementById("dvToobar").style.display="";
},
createLink: function () ...{
var sURL=window.prompt("请输入链接 (如:http://www.163.com/):", "http://");
if ((sURL!=null) && (sURL!="http://")) ...{ this.format("CreateLink", sURL); }
},
insertimgInit:function() ...{
var file=document.createElement("input");
file.style.display="none";
file.setAttribute("type","file");
file.setAttribute("id","imgname");
document.getElementsByTagName("body")[0].appendChild(file);
},
insertImg:function ()...{
if(!document.getElementById("imgname")) this.insertimgInit();
document.getElementById("imgname").click();
document.getElementById("imgname").onChange=document.getElementById("imgname").value!=""?this.format("InsertImage",document.getElementById("imgname").value):null;
}
在加载浮层菜单时候用到了元素绝对地址的计算,方法也很简单。
3.在初始化函数中添加这些元素
//加载工具条
var dvToobar=document.createElement("div");
dvToobar.setAttribute("id","dvToobar");
dvToobar.style.display="none";
//1.加载字体类型
var family=document.createElement("select");
family.className="fontfamily";
family.setAttribute("id","fontfamily");
family.attachEvent("onchange",EditorKit.setFontname);
var newfont;
for(each in this.fonts) ...{
newfont=document.createElement("option");
newfont.value=this.fonts[each];
newfont.appendChild(document.createTextNode(this.fonts[each]));
family.appendChild(newfont);
}
dvToobar.appendChild(family);
//2.加载字体大小
var fontsizes=document.createElement("select");
fontsizes.className="fontsize";
fontsizes.setAttribute("id","fontsize");
fontsizes.attachEvent("onchange",EditorKit.setFontsize);
var newsize;
for(each in this.sizes) ...{
newsize=document.createElement("option");
newsize.appendChild(document.createTextNode(this.sizes[each]));
fontsizes.appendChild(newsize);
}
dvToobar.appendChild(fontsizes);
//3.加载一些小按钮
//剪切
var cutBtn=document.createElement("A");
cutBtn.className="icoCut";
cutBtn.setAttribute("href","javascript:EditorKit.format('Cut')");
cutBtn.setAttribute("title","剪切");
dvToobar.appendChild(cutBtn);
//复制
var cpyBtn=document.createElement("A");
cpyBtn.className="icoCpy";
cpyBtn.setAttribute("href","javascript:EditorKit.format('Copy')");
cpyBtn.setAttribute("title","复制");
dvToobar.appendChild(cpyBtn);
//粘贴
var pseBtn=document.createElement("A");
pseBtn.className="icoPse";
pseBtn.setAttribute("href","javascript:EditorKit.format('Paste')");
pseBtn.setAttribute("title","粘贴");
dvToobar.appendChild(pseBtn);
//加粗
var bldBtn=document.createElement("A");
bldBtn.className="icoWgt";
bldBtn.setAttribute("href","javascript:EditorKit.format('Bold')");
bldBtn.setAttribute("title","加粗");
dvToobar.appendChild(bldBtn);
//斜体
var itaBtn=document.createElement("A");
itaBtn.className="icoIta";
itaBtn.setAttribute("href","javascript:EditorKit.format('Italic')");
itaBtn.setAttribute("title","斜体");
dvToobar.appendChild(itaBtn);
//下划线
var ulnBtn=document.createElement("A");
ulnBtn.className="icoUln";
ulnBtn.setAttribute("href","javascript:EditorKit.format('Underline')");
ulnBtn.setAttribute("title","下划线");
dvToobar.appendChild(ulnBtn);
//对齐
var agnBtn=document.createElement("A");
agnBtn.className="icoAgn";
agnBtn.setAttribute("href","javascript:EditorKit.showAlign()");
agnBtn.setAttribute("id","alignbtn");
agnBtn.setAttribute("title","对齐");
dvToobar.appendChild(agnBtn);
//编号
var lstBtn=document.createElement("A");
lstBtn.className="icoLst";
lstBtn.setAttribute("href","javascript:EditorKit.showOrder()");
lstBtn.setAttribute("id","orderbtn");
lstBtn.setAttribute("title","编号");
dvToobar.appendChild(lstBtn);
//缩进
var odtBtn=document.createElement("A");
odtBtn.className="icoOdt";
odtBtn.setAttribute("href","javascript:EditorKit.showDent()");
odtBtn.setAttribute("id","dentbtn");
odtBtn.setAttribute("title","缩进");
dvToobar.appendChild(odtBtn);
//字体颜色
var fclBtn=document.createElement("A");
fclBtn.className="icoFcl";
fclBtn.setAttribute("href","javascript:EditorKit.showForeColor()");
fclBtn.setAttribute("id","foreColorbtn");
fclBtn.setAttribute("title","字体颜色");
dvToobar.appendChild(fclBtn);
//超链接
var urlBtn=document.createElement("A");
urlBtn.className="icoUrl";
urlBtn.setAttribute("href","javascript:EditorKit.createLink()");
urlBtn.setAttribute("title","超链接");
dvToobar.appendChild(urlBtn);
//增加图片
var imgBtn=document.createElement("A");
imgBtn.className="icoImg";
imgBtn.setAttribute("href","javascript:EditorKit.insertImg()");
imgBtn.setAttribute("title","增加图片");
dvToobar.appendChild(imgBtn);
//魔法表情
var mfcBtn=document.createElement("A");
mfcBtn.className="icoMfc";
mfcBtn.setAttribute("href","javascript:loadimgface()");
mfcBtn.setAttribute("title","魔法表情");
dvToobar.appendChild(mfcBtn);
//模式切换
var htmBtn=document.createElement("A");
htmBtn.className="icoHtm";
htmBtn.setAttribute("href","javascript:EditorKit.changeMode()");
htmBtn.setAttribute("title","模式切换");
dvToobar.appendChild(htmBtn);
根据前面的分析,文本区的加载自然包括二个部分:
//文本面板: 包括一个框架和一个文本域
var txtpanel=document.createElement("div");
txtpanel.setAttribute("id","divEditor");
//一个框架,可以进行正常的编辑面板
var HtmlEditor=document.createElement("iframe");
HtmlEditor.frameBorder =0;
HtmlEditor.marginHeight=0;
HtmlEditor.marginWidth =0;
HtmlEditor.src="about:blank";
HtmlEditor.setAttribute("id","HtmlEditor");
HtmlEditor.className="HtmlEditor";
HtmlEditor.attachEvent("onfocus",EditorKit.showToolbar);
txtpanel.appendChild(HtmlEditor);
var sourceEditor=document.createElement("textarea");
sourceEditor.className="sourceEditor";
sourceEditor.setAttribute("id","sourceEditor");
txtpanel.appendChild(sourceEditor);
var dvpanel=document.createElement("div");
dvpanel.setAttribute("id","dvPanel");
dvpanel.appendChild(dvToobar);
dvpanel.appendChild(txtpanel);
document.getElementsByTagName("body")[0].appendChild(dvpanel);
这里我已经绑定了点击后就弹出隐藏的工具栏函数,参见前面的代码。
最后是激活这个编辑器控件:
aliveEditor:function () ...{
var f = window.frames["HtmlEditor"];
var html = '<HEAD></HEAD><BODY><div></div></BODY>';
f.document.open("text/html","replace");
f.document.write(html);
f.document.close();
f.document.designMode="on";
var sourceEditor =document.getElementById("sourceEditor");
sourceEditor.style.display = "none";
}
其实更好的方法是仅仅提供一个工具条的接口给页面使用,在实际中应努力做好需要时再加载且之加载一次,
而不再去关联实际需要的文本区,进而免去对文本区不必要的束缚。
发表评论
-
javascript 键盘事件大全(兼容性研究)
2010-08-05 10:22 2486转载 javascript 键盘事 ... -
JavaScript Base64编码和解码,实现URL参数传递。
2009-12-16 13:09 1695为什么需要对参数进行编码?相信有过开发的经验的广大程序员都知道 ... -
JavaScript处理xmlhttprequest返回的xml文档
2009-12-03 17:02 2093<script type="text/java ... -
认识hasLayout——IE浏览器css bug的一大罪恶根源
2009-11-09 10:36 1862什么是hasLayout?hasLayout ... -
Javascript 文件操作 Javascript File 对象
2009-11-06 17:14 5490一、功能实现核心:FileSystemObject 对象 ... -
js 中执行swf中的方法
2009-10-26 11:05 1221注意:本方法在as3中测试可行,在as2未测试。 funct ... -
前台js encodeURIComponent编码 后台java对中文解码方法
2009-10-24 09:21 4103new String(request.getParameter ... -
js 三种编解码方式
2009-10-24 09:20 970js对文字进行编码涉及3个函数:escape,encodeUR ... -
发布一个史上最简单代码最少Javascript Timer,解决一切定时执行的问题
2009-10-20 13:34 1391function TimerStart(func,delay) ... -
JS里setTimeout为0的小应用
2009-10-19 23:02 1896在示例B中,虽然setTimeout设置为0,但是,从Java ... -
js call apply
2009-10-19 15:21 1086Function.prototype.apply = func ... -
如何向回调函数中传入其他参数
2009-10-19 13:58 1984最近写JS经常会因为向回调函数中传参而头疼,今天总结一下向回 ... -
客户端上传工具-SWFUpload
2009-10-14 10:28 2404最近由于项目中多文件上传的需求,我才发现SWFUpload已经 ... -
ie ff下Clipboard的读写js脚本
2009-09-28 15:37 2825//Firefox下Clipboard的读写js脚本 /*** ... -
jQuery对象之间的继承关系
2009-09-21 10:48 2514主要也就是jQuery,jQuery.fn和jQuery.fn ... -
jQuery选择的工作原理和优化
2009-09-21 10:39 1029至于有那些选择器,在帮助手册中都有,自己去看,这篇主要是分析他 ... -
键盘KeyCode值列表
2009-09-18 17:47 997keycode 0 = keycode 1 = key ... -
javascript图片浏览器的核心:图片预加载
2009-09-10 22:45 1810来源:热爱斯诺克的程序员 - 博客园 网站开发时经常需要 ... -
网站前端优化一些小经验
2009-08-26 16:23 881先说说目标,前端优化的 ... -
JavaScript面试的忽悠题
2009-08-26 15:51 1240<script type="text/java ...
相关推荐
对于开发者来说,163在线编辑器可能提供了API接口,允许开发者将其功能嵌入到自己的应用或网站中,构建个性化的文档处理解决方案。 8. **安全与隐私**: 由于涉及到用户数据,163在线编辑器必须重视数据安全和...
该资源名为“仿网易163门户模板”,是一款设计风格模仿网易163门户网站的网页模板。这款模板旨在为用户提供一个类似网易163门户的网站布局和视觉体验,适用于那些希望创建新闻、资讯类网站或者个人博客的用户。通过...
基于HTML+CSS的静态网页设计仿网易云音乐静态页面项目源码.zip 亲测95分以上高分必过项目,下载即用无需修改。 基于HTML+CSS的静态网页设计仿网易云音乐静态页面项目源码.zip 亲测95分以上高分必过项目,下载即用...
总的来说,这个“HTML作业-仿网易云音乐项目”不仅涵盖了HTML的基本结构和语义化元素的使用,还展示了HTML5的多媒体特性,以及CSS和JavaScript在实现网页交互性上的重要性。它是一个很好的实战练习,帮助学习者将...
【网易126邮箱HTML文本编辑器】是一个在126邮箱服务中广泛使用的网页编辑工具,它提供了用户友好的界面和高效的文本编辑功能。这个编辑器的设计目标是让用户能够轻松地创建和编辑HTML格式的邮件,使得非编程背景的...
【标题】"仿网易163大型门户网站"是一款基于PHP和MySQL构建的综合性网站平台,其设计灵感来源于知名的网易163网站。该资源提供了一套完整的网站源码,允许用户自行搭建类似网易163的多功能门户站点。 【描述】在...
6. **双鱼文本编辑器PiscesTextEditor**:这是一款基于Web的轻量级编辑器,可能专注于基本的文本编辑功能,如字体、字号调整,段落排版等。它的优点在于简洁、快速,适合对编辑需求不那么复杂的情况。 7. **在线...
- 数据展示:可能涉及到数据可视化,如播放量、评论数等,可以通过CSS美化数字和进度条。 4. 学习价值: - 提升布局技巧:通过模仿实际网站,开发者能更好地理解如何组织复杂的网页结构,掌握各种布局方法。 - ...
这个“HTML作业-仿网易云音乐项目”是一个学习项目,旨在帮助学生或者自学者掌握HTML的基本语法和实际应用,通过模仿网易云音乐的界面设计来提升网页布局和交互设计能力。 在HTML中,我们首先会接触到基本的元素...
5. **163Editor.rar**:这可能是网易163邮箱的编辑器组件,用户可以研究其内部实现,学习或集成到自己的项目中。 6. **chinaz.com.txt**:可能来自站长之家(Chinaz.com)的文本文件,可能包含编辑器的使用心得、...
HTML允许开发者构建结构化的文档,通过标签来定义文本、图像和其他元素的样式和功能。在登录页面中,`input`标签扮演着至关重要的角色,它用于创建用户输入的交互元素。例如,在网易163邮箱的登录界面,`input`标签...
总的来说,网易邮箱、新浪邮箱和QQ邮箱的HTML在线编辑器都是为了提升用户体验而设计的,它们通过提供便捷的文本编辑和格式化功能,使得用户能够轻松创建和分享内容。这些编辑器的开发和优化体现了Web开发中的最佳...
在线文本编辑器是网页应用程序中常见的一种工具,它允许用户在浏览器环境中进行文字编辑、格式化和内容创作,类似于桌面端的文字处理软件。本话题主要聚焦于网易、QQ和新浪博客所采用的在线编辑器,这些编辑器因其...
总的来说,163网易编辑器是一个高效、稳定且兼容性强的在线编辑工具,尤其适合那些需要跨浏览器工作的网站。它简化了内容创建的过程,提高了工作效率,同时通过开放源代码,为开发者提供了丰富的自定义选项,使其...
微信小程序 仿网易云音乐 (源码)微信小程序 仿网易云音乐 (源码)微信小程序 仿网易云音乐 (源码)微信小程序 仿网易云音乐 (源码)微信小程序 仿网易云音乐 (源码)微信小程序 仿网易云音乐 (源码)微信小程序 仿网易云...
【163文本编辑器】是一款由网易公司推出的高效便捷的文本编辑工具,以其简洁的界面、丰富的功能和良好的用户体验赢得了用户的青睐。这款编辑器专为日常文本处理和写作需求设计,尤其适合需要大量文字输入的用户,如...
类163邮件的HTML编辑器是用于创建和编辑电子邮件的一种工具,它的设计灵感来源于网易163邮箱的内置编辑功能。HTML编辑器允许用户在撰写邮件时添加丰富的格式,如字体、颜色、图片、链接等,使得邮件内容更加生动且...
此外,编辑器还支持插入图片、链接、表格、列表等元素,这样的多样化支持让编辑器能够满足各种复杂的编辑需求,无论是在编写博客、论坛帖子,还是在处理在线文档时。 从技术层面讲,基于HTML技术的网易邮箱文本编辑...
【网易编辑器与JS编辑器概述】 网易编辑器是一款基于JavaScript技术开发的富文本编辑器,主要用于网页内容的创建和编辑。它集成了多种编辑功能,如文本格式化、图片上传、链接插入等,为用户提供了一个简洁而强大的...