📄 editor.js
字号:
break;
}
}
var sHTML="";
sHTML+="<iframe name=idFixZIndex"+this.oName+" id=idFixZIndex"+this.oName+" frameBorder=0 style='display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0);' src='"+this.scriptPath+"blank.gif' ></iframe>"; //src='javascript:;'
sHTML+="<table id=idArea"+this.oName+" name=idArea"+this.oName+" border=0 "+
"cellpadding=0 cellspacing=0 width='"+this.width+"' height='"+this.height+"'>"+
"<tr><td colspan=2 style=\"position:relative;padding:0px;padding-left:1;border:#cfcfcf 1px solid;border-bottom:none;background:url('"+this.scriptPath+"icons/bg.gif')\">"+
"<table cellpadding=0 cellspacing=0><tr><td dir=ltr style='padding:0px'>"+
sHTMLIcons+
"</td></tr></table>"+
"</td></tr>"+
"<tr id=idTagSelTopRow"+this.oName+" style='display:none'><td colspan=2 id=idTagSelTop"+this.oName+" height=0 style='padding:0px'></td></tr>";
sHTML+="<tr><td colspan=2 valign=top height=100% style='padding:0px;background:white'>";
sHTML+="<table cellpadding=0 cellspacing=0 width=100% height=100%><tr><td width=100% height=100% style='padding:0px;border:1px #cfcfcf solid'>";//StyleSelect
if(this.IsSecurityRestricted)
sHTML+="<iframe security='restricted' style='width:100%;height:100%;' src='"+this.scriptPath+"blank.gif'"+
" name=idContent"+ this.oName + " id=idContent"+this.oName+
" contentEditable=true></iframe>";//prohibit running ActiveX controls
else
sHTML+="<iframe style='width:100%;height:100%;' frameborder='0' src='"+this.scriptPath+"blank.gif'"+
" name=idContent"+ this.oName + " id=idContent"+this.oName+
" contentEditable=true></iframe>";
//Paste From Word
sHTML+="<iframe style='width:0px;height:0px;overflow:auto;' src='"+this.scriptPath+"blank.gif'"+
" name=idContentWord"+ this.oName +" id=idContentWord"+ this.oName+
" contentEditable=true onfocus='"+this.oName+".hide()'></iframe>";
sHTML+="</td><td id=idStyles"+this.oName+" style='padding:0px;background:#E9E8F2' valign=top></td></tr></table>"//StyleSelect
sHTML+="</td></tr>";
sHTML+="<tr id=idTagSelBottomRow"+this.oName+"><td colspan=2 id=idTagSelBottom"+this.oName+" style='padding:0px;'></td></tr>";
sHTML+="</table>";
sHTML+=sHTMLDropMenus;//dropdown
sHTML+="<input type=submit name=iwe_btnSubmit"+this.oName+" id=iwe_btnSubmit"+this.oName+" value=SUBMIT style='display:none' >";//hidden submit button
document.getElementById("loadedit").innerHTML=sHTML;
// document.write(sHTML);
// alert(sHTML);
//window.clipboardData.setData('Text',sHTML);
//Render Color Picker (forecolor)
this.oColor1.url=this.scriptPath+"color_picker_fg.htm";
this.oColor1.onShow = new Function(this.oName+".hide()");
this.oColor1.onMoreColor = new Function(this.oName+".hide()");
this.oColor1.onPickColor = new Function(this.oName+".applyColor('ForeColor',eval('"+this.oName+"').oColor1.color)");
this.oColor1.onRemoveColor = new Function(this.oName+".applyColor('ForeColor','')");
this.oColor1.txtCustomColors=getTxt("Custom Colors");
this.oColor1.txtMoreColors=getTxt("More Colors...");
this.oColor1.RENDER();
//Render Color Picker (backcolor)
this.oColor2.url=this.scriptPath+"color_picker_bg.htm";
this.oColor2.onShow = new Function(this.oName+".hide()");
this.oColor2.onMoreColor = new Function(this.oName+".hide()");
this.oColor2.onPickColor = new Function(this.oName+".applyColor('BackColor',eval('"+this.oName+"').oColor2.color)");
this.oColor2.onRemoveColor = new Function(this.oName+".applyColor('BackColor','')");
this.oColor2.txtCustomColors=getTxt("Custom Colors");
this.oColor2.txtMoreColors=getTxt("More Colors...");
this.oColor2.RENDER();
if(this.useTagSelector)
{
if(this.TagSelectorPosition=="bottom")this.TagSelectorPosition="top";
else this.TagSelectorPosition="bottom";
this.moveTagSelector()
}
//paste from word temp storage
/*var oWord=eval("idContentWord"+this.oName);
oWord.document.designMode="on";
oWord.document.open("text/html","replace");
oWord.document.write("<html><head></head><body></body></html>");
oWord.document.close();
oWord.document.body.contentEditable=true;*/
oUtil.oName=this.oName;//default active editor
oUtil.oEditor=eval("idContent"+this.oName);
oUtil.oEditor.document.designMode="on";
oUtil.obj=eval(this.oName);
oUtil.arrEditor.push(this.oName);
if(this.btnTable)
{
this.arrElm[0]=this.getElm("btnTableEdit");
this.arrElm[1]=this.getElm("mnuTableSize");
this.arrElm[2]=this.getElm("mnuTableEdit");
this.arrElm[3]=this.getElm("mnuCellEdit");
}
if(this.btnParagraph)this.arrElm[4]=this.getElm("btnParagraph");
if(this.btnFontName)this.arrElm[5]=this.getElm("btnFontName");
if(this.btnFontSize)this.arrElm[6]=this.getElm("btnFontSize");
if(this.btnCut)this.arrElm[7]=this.getElm("btnCut");
if(this.btnCopy)this.arrElm[8]=this.getElm("btnCopy");
if(this.btnPaste)this.arrElm[9]=this.getElm("btnPaste");
if(this.btnPasteWord)this.arrElm[10]=this.getElm("btnPasteWord");
if(this.btnPasteText)this.arrElm[11]=this.getElm("btnPasteText");
if(this.btnUndo)this.arrElm[12]=this.getElm("btnUndo");
if(this.btnRedo)this.arrElm[13]=this.getElm("btnRedo");
if(this.btnBold)this.arrElm[14]=this.getElm("btnBold");
if(this.btnItalic)this.arrElm[15]=this.getElm("btnItalic");
if(this.btnUnderline)this.arrElm[16]=this.getElm("btnUnderline");
if(this.btnStrikethrough)this.arrElm[17]=this.getElm("btnStrikethrough");
if(this.btnSuperscript)this.arrElm[18]=this.getElm("btnSuperscript");
if(this.btnSubscript)this.arrElm[19]=this.getElm("btnSubscript");
if(this.btnNumbering)this.arrElm[20]=this.getElm("btnNumbering");
if(this.btnBullets)this.arrElm[21]=this.getElm("btnBullets");
if(this.btnJustifyLeft)this.arrElm[22]=this.getElm("btnJustifyLeft");
if(this.btnJustifyCenter)this.arrElm[23]=this.getElm("btnJustifyCenter");
if(this.btnJustifyRight)this.arrElm[24]=this.getElm("btnJustifyRight");
if(this.btnJustifyFull)this.arrElm[25]=this.getElm("btnJustifyFull");
if(this.btnIndent)this.arrElm[26]=this.getElm("btnIndent");
if(this.btnOutdent)this.arrElm[27]=this.getElm("btnOutdent");
if(this.btnLTR)this.arrElm[28]=this.getElm("btnLTR");
if(this.btnRTL)this.arrElm[29]=this.getElm("btnRTL");
if(this.btnForeColor)this.arrElm[30]=this.getElm("btnForeColor");
if(this.btnBackColor)this.arrElm[31]=this.getElm("btnBackColor");
if(this.btnLine)this.arrElm[32]=this.getElm("btnLine");
//Normalize button position if the editor is placed in relative positioned element
eval("idArea"+this.oName).style.position="absolute";
window.setTimeout("eval('idArea"+this.oName+"').style.position='';",1);
var arrA = String(this.preloadHTML).match(/<HTML[^>]*>/ig);
if(arrA)
{//full html
this.loadHTML("");
//this.preloadHTML is required here. Can't use sPreloadHTML as in:
//window.setTimeout(this.oName+".putHTML("+sPreloadHTML+")",0);
window.setTimeout(this.oName+".putHTML("+this.oName+".preloadHTML)",0);
//window.setTimeout utk fix swf loading.
//Utk loadHTML & putHTML yg di SourceEditor tdk masalah
}
else
{
this.loadHTML(sPreloadHTML)
}
}
function iwe_getElm(s)
{
return document.getElementById(s+this.oName)
}
/*** COLOR PICKER ***/
var arrColorPickerObjects=[];
function ColorPicker(sName,sParent)
{
this.oParent=sParent;
if(sParent)
{
this.oName=sParent+"."+sName;
this.oRenderName=sName+sParent;
}
else
{
this.oName=sName;
this.oRenderName=sName;
}
arrColorPickerObjects.push(this.oName);
this.url="color_picker.htm";
this.onShow=function(){return true;};
this.onHide=function(){return true;};
this.onPickColor=function(){return true;};
this.onRemoveColor=function(){return true;};
this.onMoreColor=function(){return true;};
this.show=showColorPicker;
this.hide=hideColorPicker;
this.hideAll=hideColorPickerAll;
this.color;
this.customColors=[];
this.refreshCustomColor=refreshCustomColor;
this.isActive=false;
this.txtCustomColors="Custom Colors";
this.txtMoreColors="More Colors...";
this.align="left";
this.currColor="#ffffff";//default current color
this.RENDER=drawColorPicker;
}
function drawColorPicker()
{
var arrColors=[["#800000","#8b4513","#006400","#2f4f4f","#000080","#4b0082","#800080","#000000"],
["#ff0000","#daa520","#6b8e23","#708090","#0000cd","#483d8b","#c71585","#696969"],
["#ff4500","#ffa500","#808000","#4682b4","#1e90ff","#9400d3","#ff1493","#a9a9a9"],
["#ff6347","#ffd700","#32cd32","#87ceeb","#00bfff","#9370db","#ff69b4","#dcdcdc"],
["#ffdab9","#ffffe0","#98fb98","#e0ffff","#87cefa","#e6e6fa","#dda0dd","#ffffff"]];
var sHTMLColor="<table id=dropColor"+this.oRenderName+" style=\"z-index:1;display:none;position:absolute;border:#9b95a6 1px solid;cursor:default;background-color:#E9E8F2;padding:2px\" unselectable=on cellpadding=0 cellspacing=0 width=143 height=109><tr><td unselectable=on style='padding:0px;'>";
sHTMLColor+="<table align=center cellpadding=0 cellspacing=0 border=0 unselectable=on>";
for(var i=0;i<arrColors.length;i++)
{
sHTMLColor+="<tr>";
for(var j=0;j<arrColors[i].length;j++)
sHTMLColor+="<td onclick=\""+this.oName+".color='"+arrColors[i][j]+"';"+this.oName+".onPickColor();"+this.oName+".currColor='"+arrColors[i][j]+"';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#E9E8F2 1px solid'\" style=\"cursor:default;padding:1px;border:#E9E8F2 1px solid;\" unselectable=on>"+
"<table style='margin:0;width:13px;height:13px;background:"+arrColors[i][j]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td unselectable=on></td></tr>"+
"</table></td>";
sHTMLColor+="</tr>";
}
//~~~ custom colors ~~~~
sHTMLColor+="<tr><td colspan=8 id=idCustomColor"+this.oRenderName+" style='padding:0px;'></td></tr>";
//~~~ remove color & more colors ~~~~
sHTMLColor+= "<tr>";
sHTMLColor+= "<td unselectable=on style='padding:0px;'>"+
"<table style='margin-left:1px;width:14px;height:14px;background:#E9E8F2;' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td onclick=\""+this.oName+".onRemoveColor();"+this.oName+".currColor='';"+this.oName+".hideAll()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='white 1px solid'\" style=\"cursor:default;padding:1px;border:white 1px solid;font-family:verdana;font-size:10px;font-color:black;line-height:9px;\" align=center valign=top unselectable=on>x</td></tr>"+
"</table></td>";
sHTMLColor+= "<td colspan=7 unselectable=on style='padding:0px;'>"+
"<table style='margin:1px;width:117px;height:16px;background:#E9E8F2;border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
"<tr><td onclick=\""+this.oName+".onMoreColor();"+this.oName+".hideAll();window.showModalDialog('"+this.url+"',[window,'"+this.oName+"'],'dialogWidth:432px;dialogHeight:427px;edge:Raised;center:1;help:0;resizable:1;')\" onmouseover=\"this.style.border='#777777 1px solid';this.style.background='#8d9aa7';this.style.color='#ffffff'\" onmouseout=\"this.style.border='#E9E8F2 1px solid';this.style.background='#E9E8F2';this.style.color='#000000'\" style=\"cursor:default;padding:1px;border:#efefef 1px solid\" style=\"font-family:verdana;font-size:9px;font-color:black;line-height:9px;padding:1px\" align=center valign=top nowrap unselectable=on>"+this.txtMoreColors+"</td></tr>"+
"</table></td>";
sHTMLColor+= "</tr>";
sHTMLColor+= "</table>";
sHTMLColor+="</td></tr></table>";
document.write(sHTMLColor);
}
function refreshCustomColor()
{
this.customColors=eval(this.oParent).customColors;//[CUSTOM] (Get from public definition)
if(this.customColors.length==0)
{
eval("idCustomColor"+this.oRenderName).innerHTML="";
return;
}
sHTML="<table cellpadding=0 cellspacing=0 width=100%><tr><td colspan=8 style=\"font-family:verdana;font-size:9px;font-color:black;line-height:9px;padding:1\">"+this.txtCustomColors+":</td></tr></table>";
sHTML+="<table cellpadding=0 cellspacing=0><tr>";
for(var i=0;i<this.customColors.length;i++)
{
if(i<22)
{
if(i==8||i==16||i==24||i==32)sHTML+="</tr></table><table cellpadding=0 cellspacing=0><tr>";
sHTML+="<td onclick=\""+this.oName+".color='"+this.customColors[i]+"';"+this.oName+".onPickColor()\" onmouseover=\"this.style.border='#777777 1px solid'\" onmouseout=\"this.style.border='#E9E8F2 1px solid'\" style=\"cursor:default;padding:1px;border:#E9E8F2 1px solid;\" unselectable=on>"+
" <table style='margin:0;width:13;height:13;background:"+this.customColors[i]+";border:white 1px solid' cellpadding=0 cellspacing=0 unselectable=on>"+
" <tr><td unselectable=on></td></tr>"+
" </table>"+
"</td>";
}
}
sHTML+="</tr></table>";
eval("idCustomColor"+this.oRenderName).innerHTML=sHTML;
}
f
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -