📄 inedit.htm
字号:
}
oSel.select()
_CPopup_Hide()
}
/*******************************/
//方法: _CLinkPopupRenderer_PrepareHTML
//添加链接文本准备
/******************************/
function _CLinkPopupRenderer_PrepareHTML()
{
var oSel=g_state.GetSelection()
var oEl,bImg=false,szURL=sz=""
if(oSel.parentElement)
{
oEl=_CUtil_GetElement(oSel.parentElement(),"A")
}
else
{
oEl=_CUtil_GetElement(oSel.item(0),"A")
bImg=oSel.item(0).tagName=="IMG"
}
if(oEl)szURL=oEl.href
sz ="<TABLE ALIGN=center>"
var arTypes=new Array("http","ftp","mailto")
var arText=new Array("http://","ftp://","mailto:")
var szType=szURL.substring(0,szURL.indexOf(":"))
if(("http"==szType)||("ftp"==szType))
szURL=szURL.substring(szURL.indexOf("//")+2)
else
szURL=szURL.substring(szURL.indexOf(":")+1)
sz+="<BR>输入或修改一个链接地址: <NOBR><SELECT ID=urlType>"
for(var i=0;i<arTypes.length;i++){
sz+= "<OPTION VALUE='"+arTypes[i]+"' "+(arTypes[i]==szType?" SELECTED ":"")+">"+arText[i]
}
sz+="</SELECT><INPUT ID=urlValue SIZE=45 VALUE=\""+szURL+"\" TYPE=text></NOBR>"
if(bImg)
{
sz+="<BR><INPUT TYPE=checkbox ID=displayBorder "+((oSel.item(0).border!=0)?" checked ":"")+">是否显示图片链接边框?"
}
sz+="</TD></TR><TR><TD ALIGN=center><INPUT ONCLICK=\"parent._CLinkPopupRenderer_AddLink(this.document)\" TYPE=submit ID=idSave VALUE=\" "+(szURL==""?"插 入":"修 改")+" \"> <INPUT ONCLICK=\"parent._CPopup_Hide()\" TYPE=reset ID=idCancel VALUE=\" 取 消 \"></TD></TR></TABLE>"
return sz
}
/*******************************/
//方法: _CSearchPopupRenderer_PrepareHTML
//查找文本准备
/******************************/
function _CSearchPopupRenderer_PrepareHTML()
{
sz ="<TABLE ALIGN=center>"
sz+="<TABLE style='WIDTH: 400px; HEIGHT: 90px' cellSpacing=1 cellPadding=1 border=0>"
sz+="<TR>"
sz+=" <TD width='75%'>查找内容:"
sz+=" <input width='50px' id='txtSearch' maxlength='50' style='WIDTH: 219px; HEIGHT: 22px' size=26>"
sz+=" </TD>"
sz+=" <TD>"
sz+=" <input type='button' value='查找下一个' onclick='parent._CSearchPopupRenderer_Search(this.document)' style='WIDTH: 99px; HEIGHT: 24px' size=49>"
sz+=" </TD>"
sz+=" </TR>"
sz+=" <TR>"
sz+=" <TD>"
sz+=" <TABLE style='WIDTH: 100%; HEIGHT: 100%' cellSpacing=1 cellPadding=1 border=0>"
sz+=" <TR>"
sz+=" <TD width='50%'>"
sz+=" <input type='checkbox' id='_Swhole' name='_Swhole'>全字匹配"
sz+=" </TD>"
sz+=" <TD rowspan='2' valign='top'>"
sz+=" <fieldset style='WIDTH: 98%; HEIGHT: 90%'><legend>方向</legend>"
sz+=" <input type='radio' name='direction' value='-1'>向上"
sz+=" <input type='radio' name='direction' checked value='1'>向下"
sz+=" </fieldset> "
sz+=" </TD></TR>"
sz+=" <TR>"
sz+=" <TD valign='top'> <input type='checkbox' id='_Scapital' name='_Scapital'>区分大小写</TD>"
sz+=" </TR></TABLE>"
sz+=" </TD>"
sz+=" <TD valign='top'>"
sz+=" <INPUT ONCLICK=\"parent._CancelSearch()\" TYPE=reset ID=idCancel VALUE=\" 取 消 \" style='WIDTH: 99px; HEIGHT: 24px' size=49>"
sz+=" </TD></TR>"
sz+="</TABLE>"
return sz
}
function _CancelSearch()
{
strSearch='';
_CPopup_Hide();
}
/*******************************/
//方法: _CSearchPopupRenderer_Search
//查找
/******************************/
function _CSearchPopupRenderer_Search(d)
{
var iScope=1;
var iFlag=0;
if (d.all.txtSearch.value!='')
{
var ditem=null;
for(var i=0;i< d.all.direction.length;i++)
{
ditem = d.all.direction.item(i);
if (ditem.checked)
{
iScope = ditem.value;
}
}
if(iScope>=0)
{
iScope=parseInt(idEditbox.document.body.innerText.length,10);
}
else
iScope=-parseInt(idEditbox.document.body.innerText.length,10);
if (d.all._Swhole.checked==true)
{
iFlag+=2;
}
if (d.all._Scapital.checked==true)
{
iFlag+=4;
}
_Search(d.all.txtSearch.value,iScope,iFlag);
}
}
/*******************************/
//方法: _CImagePopupRenderer_AddImage
//添加图片
/******************************/
function _CImagePopupRenderer_AddImage(d)
{
var szURL=d.all.urlValue.value
var szType=d.all.urlType[d.all.urlType.selectedIndex].text
var oSel=g_state.GetSelection()
var szALT=d.all.imgAlt.value
var szALIGN=d.all.imgAlign[d.all.imgAlign.selectedIndex].value
var szBORDER=d.all.imgBorder.value
var SelImg
if(!oSel.parentElement)SelImg=oSel.item(0)
szURL=((0==szURL.indexOf("http://")||0==szURL.indexOf("ftp://"))?"":szType)+szURL
if(szURL!="")
{
if(SelImg)
{
if(SelImg.src!=szURL)SelImg.src=szURL
if(SelImg.alt!=szALT)SelImg.alt=szALT
if(SelImg.align.toLowerCase()!=szALIGN)_Format("Justify",szALIGN)
if(SelImg.border!=szBORDER)SelImg.border=szBORDER
}
else
insertHTML('<IMG SRC="'+szURL+'"'+(szALT==""?"":' ALT="'+szALT+'"')+(szALIGN==""?"":' ALIGN="'+szALIGN+'"')+(szBORDER==""?"":' BORDER="'+szBORDER+'"')+'>')
oSel.select()
_CPopup_Hide()
return
}
}
/*******************************/
//方法: _CImagePopupRenderer_PrepareHTML
//图片选择显示准备HTML文本
/******************************/
function _CImagePopupRenderer_PrepareHTML()
{
var oSel=g_state.GetSelection()
var szURL=szALT=szALIGN=szBORDER=sz=""
var SelImg
if(!oSel.parentElement)
{
SelImg=oSel.item(0)
if(SelImg.tagName=="IMG")
{
szURL=SelImg.href
szALT=SelImg.alt
szALIGN=SelImg.align.toLowerCase()
szBORDER=SelImg.border
}
}
sz ="<TABLE ALIGN=center><BR>输入或修改一个图片地址: <NOBR><SELECT ID=urlType><option value=''></option>"
var arTypes=new Array("http","ftp")
var arText=new Array("http://","ftp://")
var szType=szURL.substring(0,szURL.indexOf(":"))
if(("http"==szType)||("ftp"==szType))
szURL=szURL.substring(szURL.indexOf("//")+2)
else
szURL=szURL.substring(szURL.indexOf(":")+1)
for(var i=0;i<arTypes.length;i++){
sz+= "<OPTION VALUE='"+arTypes[i]+"' "+(arTypes[i]==szType?" SELECTED ":"")+">"+arText[i]
}
sz+="</SELECT><INPUT ID=urlValue SIZE=45 VALUE=\""+szURL+"\" TYPE=text></NOBR>"
sz+="<BR><NOBR>注释文本: <INPUT ID=imgAlt SIZE=44 VALUE=\""+szALT+"\" TYPE=text></NOBR>"
sz+="<BR><NOBR>对齐模式: <SELECT ID=imgAlign>"
var arTypes=new Array("","left","right","top","texttop","middle","absmiddle","baseline","bottom","absbottom","center")
var arText=new Array("默认","左对齐","右对齐","顶边对齐","文本上方","相对垂直居中","绝对垂直居中","基线","相对底边对齐","绝对底边对齐","水平居中")
for(var i=0;i<arTypes.length;i++){
sz+= "<OPTION VALUE='"+arTypes[i]+"' "+(arTypes[i]==szALIGN?" SELECTED ":"")+">"+arText[i]
}
sz+="</SELECT> 边框粗细: <INPUT ID=imgBorder SIZE=5 VALUE=\""+szBORDER+"\" TYPE=text></NOBR>"
sz+="</TD></TR><TR><TD ALIGN=center><INPUT ONCLICK=\"parent._CImagePopupRenderer_AddImage(this.document)\" TYPE=submit ID=idSave VALUE=\" "+(szURL==""?"插 入":"修 改")+" \"> <INPUT ONCLICK=\"parent._CPopup_Hide()\" TYPE=reset ID=idCancel VALUE=\" 取 消 \"></TD></TR></TABLE>"
return sz
}
function _CUtil_GetElement(oEl,sTag)
{
while(oEl!=null &&oEl.tagName!=sTag)
oEl=oEl.parentElement
return oEl
}
/*******************************/
//方法: _CUtil_BuildColorTable
//输出颜色选择表HTML文本
/******************************/
function _CUtil_BuildColorTable(sID,fmt,szClick)
{
var sz,cPick=new Array("00","33","66","99","CC","FF"),iCnt=2
var iColors=cPick.length,szColor=""
sz="<TABLE CELLSPACING=0 CELLPADDING=0><TR><TD VALIGN=middle><DIV CLASS=currentColor ID=\""+sID+"Current\"> </DIV></TD><TD><TABLE ONMOUSEOUT=\"document.all."+sID+"Current.style.backgroundColor=''\" ONMOUSEOVER=\"document.all."+sID+"Current.style.backgroundColor=event.srcElement.bgColor\" CLASS=colorTable CELLSPACING=0 CELLPADDING=0 ID=\""+sID+"\">"
for(var r=0;r<iColors;r++){
sz+="<TR>"
for(var g=iColors-1;g>=0;g--)
for(var b=iColors-1;b>=0;b--){
szColor=cPick[r]+cPick[g]+cPick[b]
sz+="<TD BGCOLOR=\"#"+szColor+"\"_item=\""+szColor+"\" TITLE=\"#"+szColor+"\" "+(szClick?"ONCLICK=\""+szClick+"\" ":"")+"> </TD>"
}
sz+="</TR>"
}
sz+="</TABLE></TD></TR></TABLE>"
return sz
}
/*******************************/
//方法: replace
//字符替换
/******************************/
function replace(str,replace_what,replace_with)
{
var ndx=str.indexOf(replace_what);
var delta=replace_with.length - replace_what.length;
while(ndx >= 0)
{
str=str.substring(0,ndx)+replace_with+str.substring(ndx+replace_what.length);
ndx=str.indexOf(replace_what,ndx+delta+1);
}
return str;
}
function _CUtil_TrimCR(sValue){
return replace(sValue,"\r\n"," ")
}
function _CUtil_TrimDIV(sValue){
//return replace(sValue,"<BR>","")
return replace(replace(replace(sValue,"<DIV>",""),"</DIV>",""),"<BR>","")
}
/*******************************/
//方法: _CUtil_GetBlock
//获取编辑文本块
/******************************/
function _CUtil_GetBlock(oEl)
{
var sBlocks="|H1|H2|H3|H4|H5|H6|P|PRE|LI|TD|DIV|BLOCKQUOTE|DT|DD|TABLE|HR|IMG|BODY|"
while((oEl!=null)&&(sBlocks.indexOf("|"+oEl.tagName+"|")==-1))
oEl=oEl.parentElement
return oEl
}
/*
function _CUtil_DomainSuffix(szHost){
var idx=szHost.indexOf("commun")
if(idx>=0){
idx=szHost.indexOf(".",idx)
return szHost.substring(idx+1)
}else
{
idx=szHost.lastIndexOf(".",szHost.length-5)
return szHost.substring(idx+1)
}
return szHost
}*/
/*******************************/
//方法: _CUtil_CleanHTML
//清除编辑文本
/******************************/
function _CUtil_CleanHTML(){
var bBindings=(g_state.aBindings.length>0)
var elAll=idEditbox.document.all
var iCount=elAll.length
for(var i=iCount-1;i>=0;i--){
if(elAll[i].tagName=="IMG"){
elAll[i].width=elAll[i].offsetWidth
elAll[i].height=elAll[i].offsetHeight
}
if((elAll[i].tagName=="INPUT")&&(bBindings))
elAll[i].outerHTML='['+elAll[i].name+']';
}
return idEditbox.document.body.innerHTML
}
var g_state
window.onload = _initEditor
/*******************************/
//方法: _drawIE4Focus
//IE4不支持IFRAME,故采用TEXTBOX代替
/******************************/
function _drawIE4Focus(){
if(isIE4)document.write("<INPUT TYPE=textbox STYLE=\"width:0;height:0;left:0;position:absolute\">")
}
</SCRIPT>
<STYLE>
body{border-style:none;border-width:medium;margin:0pt;padding:0pt}
#idMode{margin-top:0pt}
.tbButton{text-align:left;margin-left:0pt;margin-right:1pt;margin-top:0pt;margin-bottom:0pt;padding:0pt}
#EditBox{position:relative;}
</STYLE>
<STYLE id="skin" disabled>
#idEditRegion{margin-left:0px;margin-right:0px;margin-top:0px;margin-bottom:0px;padding:0px}
#tbUpRight,#tbUpLeft{width:13px}
#idMode{margin-left:11px;padding:0pt}
#idMode label{color:navy;text-decoration:none;font-size:14.9px}
</STYLE>
<STYLE id="defPopupSkin">
#popup body{border-top-style:none;border-top-width:medium;margin:0px;padding:0pt}
#popup .colorTable{height:91px}
#popup #header{width:100%}
#popup #close{cursor:default;font-size:12px;width:18px;text-align:center}
#popup #content{padding:0pt}
#popup table{vertical-align:top}
#popup .tabBody{border-left:1px solid black;border-right:1px solid black;border-top-style:none;border-top-width:medium;border-bottom:1px solid black}
#popup .tabItem,#popup .tabSpace{border-left:1px solid black;border-bottom:1px solid black}
#popup .tabItem{font-size:14.9px;border-top:1px solid black}
#popup .currentColor{width:20px;height:20px;border:1px solid black;margin-left:0pt;margin-right:15pt;margin-top:0pt;margin-bottom:0pt}
#popup .tabItem div{cursor:hand;margin:3px;padding:0px}
#popup .tabItem div.disabled{color:gray;cursor:default}
#customFont{font-size:14.9px}
</STYLE>
<STYLE id="popupSkin">
#popup body{background-color:#F1F1F1;border:1px solid #6699CC;background-position:0%;font-size:14.9px}
#popup #header{background-color:#6699CC;color:white;background-position:0%}
#popup #caption{text-align:left;font-size:14.9px}
#popup .ColorTable,#popup #idList td#current{border:1px solid black}
#popup #idList td{cursor:hand;border:1px solid #F1F1F1}
#popup #close{cursor:hand;color:#99CCFF;border:1px solid #99CCFF;margin-right:6px;padding-left:4px;padding-right:4px;padding-top:0px;padding-bottom:2px}
#popup #tableProps .tablePropsTitle{color:#6699CC;text-align:left;border-bottom:1px solid black;margin-left:0pt;margin-right:0pt;margin-top:0pt;margin-bottom:5pt}
#tableButtons,#tableProps{padding:5px}
#popup #tableContents{height:175px}
#popup #tableProps .tablePropsTitle,#popup #tableProps,#popup #tableProps table{font-size:14.9px}
#popup #tableOptions{font-size:14.9px;padding-left:5pt;padding-right:5pt;padding-top:15pt;padding-bottom:15pt}
#popup #puDivider{background-color:black;width:1px;background-position:0%}
#popup #content{margin:0pt;padding-left:3pt;padding-right:3pt;padding-top:5pt;padding-bottom:8pt}
#popup #ColorPopup{
width:250px;
}
#popup .ColorTable tr{height:6px}
#popup .ColorTable td{width:6px;cursor:hand}
#popup .block p,#popup .block h1,#popup .block h2,#popup .block h3,#popup .block h4,#popup .block h5,#popup .block h6,#popup .block pre{margin:0pt;padding:0pt}
</STYLE>
</style>
</HEAD>
<BODY STYLE="background-color:transparent" oncontextmenu="//return false" tabindex="-1" scroll="no" onselectstart="return false" ondragstart="return false" onscroll="return false">
<DIV id="idEditor" style="VISIBILITY:hidden">
<TABLE id="idToolbar" width="100%" cellspacing="0" cellpadding="0" onclick="_CPopup_Hide()">
<TR><TD bgColor=menu><SCRIPT>_drawToolbar()</SCRIPT></TD></TR>
<TR><TD bgColor=#000000 HEIGHT=1></TD></TR>
</TABLE>
<IFRAME id="idPopup" NAME="idPopup" STYLE="HEIGHT:200px;LEFT:25px;MARGIN-TOP:8px;POSITION:absolute;VISIBILITY:hidden;WIDTH:200px;Z-INDEX:-1"></IFRAME>
<DIV id="idEditRegion">
<IFRAME TABINDEX=1 ID="idEditbox" NAME="idEditbox" WIDTH="100%" HEIGHT="100%" MARGINHEIGHT="1" MARGINWIDTH="1" ONFOCUS="_CPopup_Hide();"></IFRAME>
</DIV>
<SCRIPT>_drawIE4Focus()</SCRIPT>
<DIV id="tbmode">
<SCRIPT>_drawModeSelect()</SCRIPT>
</DIV>
</DIV>
</BODY>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -