📄 editor.js
字号:
/***********************************************************
InnovaStudio WYSIWYG Editor 2.9.7
Copyright ?2003-2005, INNOVA STUDIO (www.InnovaStudio.com). All rights reserved.
************************************************************/
var UA = navigator.userAgent.toLowerCase();
var isIE = (UA.indexOf('msie') >= 0) ? true : false;
var isNS = (UA.indexOf('mozilla') >= 0) ? true : false;
/*** UTILITY OBJECT ***/
var oUtil=new InnovaEditorUtil();
function InnovaEditorUtil()
{
/*** Localization ***/
this.langDir="english";
try{if(LanguageDirectory)this.langDir=LanguageDirectory;}catch(e){;}
var oScripts=document.getElementsByTagName("script");
for(var i=0;i<oScripts.length;i++)
{
var sSrc=oScripts[i].src.toLowerCase();
if(sSrc.indexOf("scripts/editor.js")!=-1) this.scriptPath=oScripts[i].src.replace(/editor.js/ig,"");
}
this.scriptPathLang=this.scriptPath+"language/"+this.langDir+"/";
if(this.langDir=="english")
document.write("<scr"+"ipt src='"+this.scriptPathLang+"editor_lang.js'></scr"+"ipt>");
/*** /Localization ***/
this.oName;this.oEditor;this.obj;
this.oSel;
this.sType;
this.bInside=bInside;
this.useSelection=false;
this.arrEditor=[];
this.onSelectionChanged=function(){return true;};
this.activeElement;
writeZIndexFrame();
}
function writeZIndexFrame(){
if(isIE){
document.write("<iframe id=\"zIndexFrame\" style=\"z-index:10;position:absolute;display:none;\" scrolling=\"no\" frameborder=\"0\"></iframe>");
}
}
/*** FOCUS STUFF ***/
function bInside(oElement)
{
while(oElement!=null)
{
if(oElement.contentEditable=="true")return true;
oElement=oElement.parentElement;
}
return false;
}
function checkFocus()
{
var oEditor=eval("idContent"+this.oName);
var oSel=oEditor.document.selection.createRange();
var sType=oEditor.document.selection.type;
if(oSel.parentElement!=null)
{
if(!bInside(oSel.parentElement()))return false;
}
else
{
if(!bInside(oSel.item(0)))return false;
}
return true;
}
function iwe_focus()
{
var oEditor=eval("idContent"+this.oName);
oEditor.focus()
}
/*** EDITOR OBJECT ***/
function InnovaEditor(oName)
{
this.oName=oName;
this.RENDER=RENDER;
this.IsSecurityRestricted=false;
this.loadHTML=loadHTML;
this.putHTML=putHTML;
this.getHTMLBody=getHTMLBody;
this.getXHTMLBody=getXHTMLBody;
this.getHTML=getHTML;
this.getXHTML=getXHTML;
this.getTextBody=getTextBody;
this.initialRefresh=false;
this.preserveSpace=false;
this.bInside=bInside;
this.checkFocus=checkFocus;
this.focus=iwe_focus;
this.onKeyPress=function(){return true;};
this.styleSelectionHoverBg="#acb6bf";
this.styleSelectionHoverFg="white";
//clean
this.cleanEmptySpan=cleanEmptySpan;
this.cleanFonts=cleanFonts;
this.cleanTags=cleanTags;
this.replaceTags=replaceTags;
this.cleanDeprecated=cleanDeprecated;
this.doClean=doClean;
this.applySpanStyle=applySpanStyle;
this.applyLine=applyLine;
this.applyBold=applyBold;
this.applyItalic=applyItalic;
this.doOnPaste=doOnPaste;
this.isAfterPaste=false;
this.doCmd=doCmd;
this.applyParagraph=applyParagraph;
this.applyFontName=applyFontName;
this.applyFontSize=applyFontSize;
this.applyBullets=applyBullets;
this.applyNumbering=applyNumbering;
this.applyJustifyLeft=applyJustifyLeft;
this.applyJustifyCenter=applyJustifyCenter;
this.applyJustifyRight=applyJustifyRight;
this.applyJustifyFull=applyJustifyFull;
this.applyBlockDirLTR=applyBlockDirLTR;
this.applyBlockDirRTL=applyBlockDirRTL;
this.doPaste=doPaste;
this.doPasteText=doPasteText;
this.applySpan=applySpan;
this.makeAbsolute=makeAbsolute;
this.insertHTML=insertHTML;
this.clearAll=clearAll;
this.insertCustomTag=insertCustomTag;
this.selectParagraph=selectParagraph;
this.hide=hide;
this.dropShow=dropShow;
this.width="620";
this.height="350";
this.publishingPath="";//ex."http://localhost/InnovaStudio/"
var oScripts=document.getElementsByTagName("script");
for(var i=0;i<oScripts.length;i++)
{
var sSrc=oScripts[i].src.toLowerCase();
if(sSrc.indexOf("scripts/editor.js")!=-1) this.scriptPath=oScripts[i].src.replace(/editor.js/,"");
}
this.iconPath="icons/";
this.iconWidth=23;//25;
this.iconHeight=25;//24;
this.iconOffsetTop;//not used
this.writeIconToggle=writeIconToggle;
this.writeIconStandard=writeIconStandard;
this.writeDropDown=writeDropDown;
this.writeBreakSpace=writeBreakSpace;
this.dropTopAdjustment=-1;
this.dropLeftAdjustment=0;
this.runtimeBorder=runtimeBorder;
this.runtimeBorderOn=runtimeBorderOn;
this.runtimeBorderOff=runtimeBorderOff;
this.IsRuntimeBorderOn=false;
this.runtimeStyles=runtimeStyles;
this.applyColor=applyColor;
this.customColors=[];//["#ff4500","#ffa500","#808000","#4682b4","#1e90ff","#9400d3","#ff1493","#a9a9a9"];
this.oColor1 = new ColorPicker("oColor1",this.oName);//to call: oEdit1.oColor1
this.oColor2 = new ColorPicker("oColor2",this.oName);//rendered id: ...oColor1oEdit1
this.expandSelection=expandSelection;
this.fullScreen=fullScreen;
this.stateFullScreen=false;
this.onFullScreen=function(){return true;};
this.onNormalScreen=function(){return true;};
this.arrElm=new Array(300);
this.getElm=iwe_getElm;
this.features=[];
this.buttonMap=["Save","FullScreen","Preview","Print","Search","SpellCheck","|",
"Cut","Copy","Paste","PasteWord","PasteText","|","Undo","Redo","|",
"ForeColor","BackColor","|","Bookmark","Hyperlink",
"Image","Flash","Media","ContentBlock","InternalLink","InternalImage","CustomObject","|",
"Table","Guidelines","Absolute","|","Characters","Line",
"Form","RemoveFormat","HTMLFullSource","HTMLSource","XHTMLFullSource",
"XHTMLSource",
"ClearAll","BRK",
"StyleAndFormatting","Styles","|","CustomTag","Paragraph","FontName","FontSize","|",
"Bold","Italic","Underline","Strikethrough","Superscript","Subscript","|",
"JustifyLeft","JustifyCenter","JustifyRight","JustifyFull","|",
"Numbering","Bullets","|","Indent","Outdent","LTR","RTL"];//complete, default
this.btnSave=false;this.btnPreview=true;this.btnFullScreen=true;this.btnPrint=false;this.btnSearch=true;
this.btnSpellCheck=false;this.btnTextFormatting=true;
this.btnListFormatting=true;this.btnBoxFormatting=true;this.btnParagraphFormatting=true;this.btnCssText=true;this.btnCssBuilder=false;
this.btnStyles=false;this.btnParagraph=true;this.btnFontName=true;this.btnFontSize=true;
this.btnCut=true;this.btnCopy=true;this.btnPaste=true;this.btnPasteText=false;this.btnUndo=true;this.btnRedo=true;
this.btnBold=true;this.btnItalic=true;this.btnUnderline=true;
this.btnStrikethrough=false;this.btnSuperscript=true;this.btnSubscript=true;
this.btnJustifyLeft=true;this.btnJustifyCenter=true;this.btnJustifyRight=true;this.btnJustifyFull=true;
this.btnNumbering=true;this.btnBullets=true;this.btnIndent=true;this.btnOutdent=true;
this.btnLTR=false;this.btnRTL=false;this.btnForeColor=true;this.btnBackColor=true;
this.btnHyperlink=true;this.btnBookmark=false;this.btnCharacters=true;this.btnCustomTag=false;
this.btnImage=true;this.btnFlash=true;this.btnMedia=true;
this.btnTable=true;this.btnGuidelines=true;
this.btnAbsolute=false;this.btnPasteWord=true;this.btnLine=true;
this.btnForm=false;this.btnRemoveFormat=true;
this.btnHTMLFullSource=false;this.btnHTMLSource=true;
this.btnXHTMLFullSource=false;this.btnXHTMLSource=false;
this.btnClearAll=false;
//*** CMS Features ***
this.cmdAssetManager="";
this.cmdFileManager="";
this.cmdImageManager="";
this.cmdMediaManager="";
this.cmdFlashManager="";
this.btnContentBlock=false;
this.cmdContentBlock=";";//needs ;
this.btnInternalLink=false;
this.cmdInternalLink=";";//needs ;
this.insertLink=insertLink;
this.btnCustomObject=false;
this.cmdCustomObject=";";//needs ;
this.btnInternalImage=false;
this.cmdInternalImage=";";//needs ;
//*****
this.css="";
this.arrStyle=[];
this.isCssLoaded=false;
this.openStyleSelect=openStyleSelect;
this.arrParagraph=[[getTxt("Heading 1"),"H1"],
[getTxt("Heading 2"),"H2"],
[getTxt("Heading 3"),"H3"],
[getTxt("Heading 4"),"H4"],
[getTxt("Heading 5"),"H5"],
[getTxt("Heading 6"),"H6"],
[getTxt("Preformatted"),"PRE"],
[getTxt("Normal (P)"),"P"],
[getTxt("Normal (DIV)"),"DIV"]];
this.arrFontName=["\u5B8B\u4F53","\u9ED1\u4F53","\u6977\u4F53_GB2312",
"\u4EFF\u5B8B_GB2312","\u96B6\u4E66","\u5E7C\u5706 ",
"Arial","Arial Black","Arial Narrow",
"Book Antiqua","Bookman Old Style",
"Century Gothic","Comic Sans MS","Courier New",
"Garamond","Georgia",
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -