📄 editor.js
字号:
{
sButtonName=this.buttonMap[i];
switch(sButtonName)
{
case "|":
sHTMLIcons+=this.writeBreakSpace();
break;
case "BRK":
sHTMLIcons+="</td></tr></table><table cellpadding=0 cellspacing=0><tr><td dir=ltr>";
break;
case "Save":
if(this.btnSave)sHTMLIcons+=this.writeIconStandard("btnSave"+this.oName,this.oName+".onSave()","btnSave.gif",getText("Save"));
break;
case "Preview":
if(this.btnPreview)
{
sHTMLIcons+=this.writeIconStandard("btnPreview"+this.oName,this.oName+".dropShow(this,dropPreview"+this.oName+")","btnPreview.gif",getText("Preview"));
var arrPreviewSize=[[640,480],[800,600],[1024,768]];
sTmp="";
for(var j=0;j<arrPreviewSize.length;j++)
{
sTmp+= "<tr><td onclick=\"dropPreview"+this.oName+".style.display='none';setActiveEditor('"+this.oName+"');modalDialogShow('"+this.scriptPath+"preview.htm',"+arrPreviewSize[j][0]+","+arrPreviewSize[j][1]+");\" "+
"style=\"padding:2px;padding-top:1px;font-family:Tahoma;font-size:11px;color:black;\" "+
"onmouseover=\"this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"this.style.backgroundColor='';this.style.color='#000000';\" unselectable=on>"+arrPreviewSize[j][0]+"x"+arrPreviewSize[j][1]+"</td></tr>";
}
sHTMLDropMenus+="<table id=dropPreview"+this.oName+" cellpadding=0 cellspacing=0 "+
"style='z-index:1;display:none;position:absolute;border:#716F64 1px solid;"+
"cursor:default;background-color:#fdfdfd;' unselectable=on>"+
sTmp+"</table>";
}
break;
case "FullScreen":
if(this.btnFullScreen)sHTMLIcons+=this.writeIconStandard("btnFullScreen"+this.oName,this.oName+".fullScreen()","btnFullScreen.gif",getText("Full Screen"));
break;
case "Print":
if(this.btnPrint)sHTMLIcons+=this.writeIconStandard("btnPrint"+this.oName,this.oName+".focus();"+this.oName+".doCmd('Print')","btnPrint.gif",getText("Print"));
break;
case "Search":
if(this.btnSearch)sHTMLIcons+=this.writeIconStandard("btnSearch"+this.oName,this.oName+".hide();modelessDialogShow('"+this.scriptPath+"search.htm',375,163)","btnSearch.gif",getText("Search"));
break;
case "SpellCheck":
if(this.btnSpellCheck)sHTMLIcons+=this.writeIconStandard("btnSpellCheck"+this.oName,this.oName+".hide();"+this.oName+".spellcheckDialogShow()","btnSpellCheck.gif",getText("Check Spelling"));
break;
case "StyleAndFormatting":
sTmp="";
if(this.btnTextFormatting)
sTmp+="<tr><td onclick=\"modelessDialogShow('"+this.scriptPath+"text1.htm',511,534);"+
"dropStyle"+this.oName+".style.display='none'\""+
" style=\"padding:2px;padding-top:1px;font-family:Tahoma;font-size:11px;color:black;\" "+
"onmouseover=\"this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"this.style.backgroundColor='';this.style.color='#000000';\" unselectable=on>"+getText("Text Formatting")+"</td></tr>";
if(this.btnParagraphFormatting)
sTmp+="<tr><td onclick=\"modelessDialogShow('"+this.scriptPath+"paragraph.htm',440,284);"+
"dropStyle"+this.oName+".style.display='none'\""+
" style=\"padding:2px;padding-top:1px;font-family:Tahoma;font-size:11px;color:black;\" "+
"onmouseover=\"this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"this.style.backgroundColor='';this.style.color='#000000';\" unselectable=on>"+getText("Paragraph Formatting")+"</td></tr>";
if(this.btnListFormatting)
sTmp+="<tr><td onclick=\"modelessDialogShow('"+this.scriptPath+"list.htm',270,335);"+
"dropStyle"+this.oName+".style.display='none'\""+
" style=\"padding:2px;padding-top:1px;font-family:Tahoma;font-size:11px;color:black;\" "+
"onmouseover=\"this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"this.style.backgroundColor='';this.style.color='#000000';\" unselectable=on>"+getText("List Formatting")+"</td></tr>";
if(this.btnBoxFormatting)
sTmp+="<tr><td onclick=\"modelessDialogShow('"+this.scriptPath+"box.htm',438,380);"+
"dropStyle"+this.oName+".style.display='none'\""+
" style=\"padding:2px;padding-top:1px;font-family:Tahoma;font-size:11px;color:black;\" "+
"onmouseover=\"this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"this.style.backgroundColor='';this.style.color='#000000';\" unselectable=on>"+getText("Box Formatting")+"</td></tr>";
if(this.btnStyles)
sTmp+="<tr><td onclick=\"modelessDialogShow('"+this.scriptPath+"styles.htm',360,347);"+
"dropStyle"+this.oName+".style.display='none'\""+
" style=\"padding:2px;padding-top:1px;font-family:Tahoma;font-size:11px;color:black;\" "+
"onmouseover=\"this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"this.style.backgroundColor='';this.style.color='#000000';\" unselectable=on>"+getText("Styles")+"</td></tr>";
if(this.btnCssText)
sTmp+= "<tr><td onclick=\""+this.oName+".onCustomCssShow();"+
"dropStyle"+this.oName+".style.display='none'\""+
" style=\"padding:2px;padding-top:1px;font-family:Tahoma;font-size:11px;color:black;\" "+
"onmouseover=\"this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"this.style.backgroundColor='';this.style.color='#000000';\" unselectable=on>"+getText("Custom CSS")+"</td></tr>";
if(this.btnTextFormatting||this.btnParagraphFormatting||this.btnListFormatting||this.btnBoxFormatting||this.btnStyles||this.btnCssText)
{
sHTMLIcons+=this.writeIconStandard("btnStyleAndFormat"+this.oName,this.oName+".dropShow(this,dropStyle"+this.oName+")","btnStyle.gif",getText("Styles & Formatting"));
sHTMLDropMenus+="<table id=dropStyle"+this.oName+" cellpadding=0 cellspacing=0 "+
"style='z-index:1;display:none;position:absolute;border:#716F64 1px solid;"+
"cursor:default;background-color:#fdfdfd;' unselectable=on>"+
sTmp+"</table>";
}
break;
case "Paragraph":
if(this.btnParagraph)
{
sHTMLDropMenus+="<table id=dropParagraph"+this.oName+" cellpadding=0 cellspacing=0 "+
"style='z-index:1;display:none;position:absolute;border:#716F64 1px solid;"+
"cursor:default;background-color:#fdfdfd;' unselectable=on>";
for(var j=0;j<this.arrParagraph.length;j++)
{
sHTMLDropMenus+="<tr><td onclick=\""+this.oName+".applyParagraph('<"+this.arrParagraph[j][1]+">')\" "+
"style=\"padding:0;padding-left:5px;padding-right:5px;font-family:tahoma;color:black;\" "+
"onmouseover=\"this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"this.style.backgroundColor='';this.style.color='#000000';\" unselectable=on align=center>"+
"<"+this.arrParagraph[j][1]+" style=\"\margin-bottom:4px\" unselectable=on> "+
this.arrParagraph[j][0]+"</"+this.arrParagraph[j][1]+"></td></tr>";
}
sHTMLDropMenus+="</table>";
sHTMLIcons+=this.writeDropDown("btnParagraph"+this.oName,this.oName+".selectParagraph();"+this.oName+".dropShow(this,dropParagraph"+this.oName+")","btnParagraph.gif",getText("Paragraph"),77);
}
break;
case "FontName":
if(this.btnFontName)
{
sHTMLDropMenus+="<table id=dropFontName"+this.oName+" cellpadding=0 cellspacing=0 "+
"style='z-index:1;display:none;position:absolute;border:#716F64 1px solid;"+
"cursor:default;background-color:#fdfdfd;' unselectable=on><tr><td>";
//~~~~ up to 120 fonts
var numOfFonts=0;
for(var j=0;j<this.arrFontName.length;j++)
{
//if(this.arrFontName[j].length==1)
if(this.arrFontName[j].toString().indexOf(",")==-1)
{
if(this.arrFontName[j]!="serif" &&
this.arrFontName[j]!="sans-serif" &&
this.arrFontName[j]!="cursive" &&
this.arrFontName[j]!="fantasy" &&
this.arrFontName[j]!="monoscape")numOfFonts++;
}
else numOfFonts++;
}
sHTMLDropMenus+="<table cellpadding=0 cellspacing=0>";
for(var j=0;j<this.arrFontName.length;j++)
{
//if(this.arrFontName[j].length==1)
if(this.arrFontName[j].toString().indexOf(",")==-1)
{
if(this.arrFontName[j]!="serif" &&
this.arrFontName[j]!="sans-serif" &&
this.arrFontName[j]!="cursive" &&
this.arrFontName[j]!="fantasy" &&
this.arrFontName[j]!="monoscape")
sHTMLDropMenus+="<tr><td onclick=\""+this.oName+".applyFontName('"+this.arrFontName[j]+"')\" "+
"style=\"padding:2px;padding-top:1px;font-family:"+ this.arrFontName[j] +";font-size:11px;color:black;\" "+
"onmouseover=\"if(this.style.backgroundColor=='#708090')this.sel='true';this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"if(this.sel=='true'){this.sel='false'}else{this.style.backgroundColor='';this.style.color='#000000';}\" unselectable=on>"+
this.arrFontName[j]+" <span unselectable=on style='font-family:tahoma'>("+ this.arrFontName[j] +")</span></td></tr>";
}
else
{
sHTMLDropMenus+="<tr><td onclick=\""+this.oName+".applyFontName('"+this.arrFontName[j][0]+"')\" "+
"style=\"padding:2px;padding-top:1px;font-family:"+ this.arrFontName[j][0] +";font-size:11px;color:black;\" "+
"onmouseover=\"if(this.style.backgroundColor=='#708090')this.sel='true';this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"if(this.sel=='true'){this.sel='false'}else{this.style.backgroundColor='';this.style.color='#000000';}\" unselectable=on>"+
this.arrFontName[j][1]+" <span unselectable=on style='font-family:tahoma'>("+ this.arrFontName[j][1] +")</span></td></tr>";
}
if(j==14||j==29||j==44||j==59||j==74||j==89||j==104)
{
if(j!=numOfFonts-1)
{
sHTMLDropMenus+="</table>";
sHTMLDropMenus+="</td><td valign=top style='border-left:#716f64 1 solid'>";//main
sHTMLDropMenus+="<table cellpadding=0 cellspacing=0>";
}
}
}
sHTMLDropMenus+="</table>";
//~~~~
sHTMLDropMenus+="</td></tr></table>";
sHTMLIcons+=this.writeDropDown("btnFontName"+this.oName,this.oName+".expandSelection();"+this.oName+".dropShow(this,dropFontName"+this.oName+");realtimeFontSelect('"+this.oName+"')","btnFontName.gif",getText("Font Name"),77);
}
break;
case "FontSize":
if(this.btnFontSize)
{
sHTMLDropMenus+="<table id=dropFontSize"+this.oName+" cellpadding=0 cellspacing=0 "+
"style='z-index:1;display:none;position:absolute;border:#716F64 1px solid;"+
"cursor:default;background-color:#fdfdfd;' unselectable=on>";
for(var j=0;j<this.arrFontSize.length;j++)
{
sHTMLDropMenus+="<tr><td onclick=\""+this.oName+".applyFontSize('"+this.arrFontSize[j][1]+"')\" "+
"style=\"padding:0;padding-left:5px;padding-right:5px;font-family:tahoma;color:black;\" "+
"onmouseover=\"if(this.style.backgroundColor=='#708090')this.sel='true';this.style.backgroundColor='#708090';this.style.color='#FFFFFF';\" "+
"onmouseout=\"if(this.sel=='true'){this.sel='false'}else{this.style.backgroundColor='';this.style.color='#000000';}\" unselectable=on align=center>"+
"<font unselectable=on size=\""+this.arrFontSize[j][1]+"\">"+
this.arrFontSize[j][0]+"</font></td></tr>";
}
sHTMLDropMenus+="</table>";
sHTMLIcons+=this.writeDropDown("btnFontSize"+this.oName,this.oName+".expandSelection();"+this.oName+".dropShow(this,dropFontSize"+this.oName+");realtimeSizeSelect('"+this.oName+"')","btnFontSize.gif",getText("Font Size"),60);
}
break;
case "Cut":
if(this.btnCut)sHTMLIcons+=this.writeIconStandard("btnCut"+this.oName,this.oName+".doCmd('Cut')","btnCut.gif",getText("Cut"));
break;
case "Copy":
if(this.btnCopy)sHTMLIcons+=this.writeIconStandard("btnCopy"+this.oName,this.oName+".doCmd('Copy')","btnCopy.gif",getText("Copy"));
break;
case "Paste":
if(this.btnPaste)sHTMLIcons+=this.writeIconStandard("btnPaste"+this.oName,this.oName+".doPaste()","btnPaste.gif",getText("Paste"));
break;
case "PasteWord":
if(this.btnPasteWord)sHTMLIcons+=this.writeIconStandard("btnPasteWord"+this.oName,this.oName+".hide();modelessDialogShow('"+this.scriptPath+"paste_word.htm',400,280)","btnPasteWord.gif",getText("Paste from Word"));
break;
case "PasteText":
if(this.btnPasteText)sHTMLIcons+=this.writeIconStandard("btnPasteText"+this.oName,this.oName+".doPasteText()","btnPasteText.gif",getText("Paste Text"));
break;
case "Undo":
if(this.btnUndo)sHTMLIcons+=this.writeIconStandard("btnUndo"+this.oName,this.oName+".doUndo()","btnUndo.gif",getText("Undo"));
break;
case "Redo":
if(this.btnRedo)sHTMLIcons+=this.writeIconStandard("btnRedo"+this.oName,this.oName+".doRedo()","btnRedo.gif",getText("Redo"));
break;
case "Bold":
if(this.btnBold)sHTMLIcons+=this.writeIconToggle("btnBold"+this.oName,this.oName+".doCmd('Bold')","btnBold.gif",getText("Bold"));
break;
case "Italic":
if(this.btnItalic)sHTMLIcons+=this.writeIconToggle("btnItalic"+this.oName,this.oName+".doCmd('Italic')","btnItalic.gif",getText("Italic"));
break;
case "Underline":
if(this.btnUnderline)sHTMLIcons+=this.writeIconToggle("btnUnderline"+this.oName,this.oName+".doCmd('Underline')","btnUnderline.gif",getText("Underline"));
break;
case "Strikethrough":
if(this.btnStrikethrough)sHTMLIcons+=this.writeIconToggle("btnStrikethrough"+this.oName,this.oName+".doCmd('Strikethrough')","btnStrikethrough.gif",getText("Strikethrough"));
break;
case "Superscript":
if(this.btnSuperscript)sHTMLIcons+=this.writeIconToggle("btnSuperscript"+this.oName,this.oName+".doCmd('Superscript')","btnSuperscript.gif",getText("Superscript"));
break;
case "Subscript":
if(this.btnSubscript)sHTMLIcons+=this.writeIconToggle("btnSubscript"+this.oName,this.oName+".doCmd('Subscript')","btnSubscript.gif",getText("Subscript"));
break;
case "JustifyLeft":
if(this.btnJustifyLeft)sHTMLIcons+=this.writeIconToggle("btnJustifyLeft"+this.oName,this.oName+".applyJustifyLeft()","btnLeft.gif",getText("Justify Left"));
break;
case "JustifyCenter":
if(this.btnJustifyCenter)sHTMLIcons+=this.writeIconToggle("btnJustifyCenter"+this.oName,this.oName+".applyJustifyCenter()","btnCenter.gif",getText("Justify Center"));
break;
case "JustifyRight":
if(this.btnJustifyRight)sHTMLIcons+=this.writeIconToggle("btnJustifyRight"+this.oName,this.oName+".applyJustifyRight()","btnRight.gif",getText("Justify Right"));
break;
case "JustifyFull":
if(this.btnJustifyFull)sHTMLIcons+=this.writeIconToggle("btnJustifyFull"+this.oName,this.oName+".applyJustifyFull()","btnFull.gif",getText("Justify Full"));
break;
case "Numbering":
if(this.btnNumbering)sHTMLIcons+=this.writeIconToggle("btnNumbering"+this.oName,this.oName+".applyNumbering()","btnNumber.gif",getText("Numbering"));
break;
case "Bullets":
if(this.btnBullets)sHTMLIcons+=this.writeIconToggle("btnBullets"+this.oName,this.oName+".applyBullets()","btnList.gif",getText("Bullets"));
break;
case "Indent":
if(this.btnIndent)sHTMLIcons+=this.writeIconStandard("btnIndent"+this.oName,this.oName+".doCmd('Indent')","btnIndent.gif",getText("Indent"));
break;
case "Outdent":
if(this.btnOutdent)sHTMLIcons+=this.writeIconStandard("btnOutdent"+this.oName,this.oName+".doCmd('Outdent')","btnOutdent.gif",getText("Outdent"));
break;
case "LTR":
if(this.btnLTR)sHTMLIcons+=this.writeIconToggle("btnLTR"+this.oName,this.oName+".applyBlockDirLTR()","btnLTR.gif",getText("Left To Right"));
break;
case "RTL":
if(this.btnRTL)sHTMLIcons+=this.writeIconToggle("btnRTL"+this.oName,this.oName+".applyBlockDirRTL()","btnRTL.gif",getText("Right To Left"));
break;
case "ForeColor":
if(this.btnForeColor)sHTMLIcons+=this.writeIconStandard("btnForeColor"+this.oName,this.oName+".expandSelection();"+this.oName+".oColor1.show(this)","btnForeColor.gif",getText("Foreground Color"));
break;
case "BackColor":
if(this.btnBackColor)sHTMLIcons+=this.writeIconStandard("btnBackColor"+this.oName,this.oName+".expandSelection();"+this.oName+".oColor2.show(this)","btnBackColor.gif",getText("Background Color"));
break;
case "Bookmark":
if(this.btnBookmark)sHTMLIcons+=this.writeIconStandard("btnBookmark"+this.oName,this.oName+".hide();modelessDialogShow('"+this.scriptPath+"bookmark.htm',245,216)","btnBookmark.gif",getText("Bookmark"));
break;
case "Hyperlink":
if(this.btnHyperlink)sHTMLIcons+=this.writeIconStandard("btnHyperlink"+this.oName,this.oName+".hide();modelessDialogShow('"+this.scriptPath+"hyperlink.htm',380,200)","btnHyperlink.gif",getText("Hyperlink"));
break;
case "CustomTag":
if(this.btnCustomTag)
{
sHTMLDropMenus+="<table id=dropCustomTag"+this.oName+" cellpadding=0 cellspacing=0 "+
"style='z-index:1;display:none;position:absolute;border:#716F64 1px solid;"+
"cursor:default;background-color:#fdfdfd;' unselectable=on><tr><td valign=top>";
//~~~~ up to 120 tags
sHTMLDropMenus+="<table cellpadding=0 cellspacing=0>";
for(var j=0;j<this.arrCustomTag.length;j++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -