📄 editor.js
字号:
/***********************************************************
InnovaStudio WYSIWYG Editor 2.2
Copyright 2003-2005, INNOVA STUDIO (www.InnovaStudio.com). All rights reserved.
************************************************************/
/*** UTILITY OBJECT ***/
var oUtil=new InnovaEditorUtil();
function InnovaEditorUtil()
{
/*** Localization ***/
this.langDir="schi";
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=="schi")
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=true;
this.arrEditor=[];
this.onSelectionChanged=function(){return true;};
this.activeElement;
}
/*** 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.getHTMLBody=getHTMLBody;
this.getXHTMLBody=getXHTMLBody;
this.getHTML=getHTML;
this.getXHTML=getXHTML;
this.putHTML=putHTML;//source dialog
this.css="";
this.initialRefresh=false;
this.bInside=bInside;
this.checkFocus=checkFocus;
this.focus=iwe_focus;
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.spellcheckDialogShow=spellcheckDialogShow;
this.insertCustomTag=insertCustomTag;
this.selectParagraph=selectParagraph;
this.doOnPaste=doOnPaste;
this.isAfterPaste=false;
this.doClean=doClean;
this.hide=hide;
this.dropShow=dropShow;
this.width="710";
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=sSrc.replace(/editor.js/,"");
}
this.iconPath="icons/";
this.iconWidth=25;this.iconHeight=24;
this.writeIconToggle=writeIconToggle;
this.writeIconStandard=writeIconStandard;
this.writeDropDown=writeDropDown;
this.writeBreakSpace=writeBreakSpace;
this.dropTopAdjustment=1;
this.runtimeBorder=runtimeBorder;
this.runtimeBorderOn=runtimeBorderOn;
this.runtimeBorderOff=runtimeBorderOff;
this.IsRuntimeBorderOn=true;
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","|",
"Table","Guidelines","Absolute","|","Form","Characters","Line",
"Clean","ClearAll","HTMLFullSource","HTMLSource","XHTMLFullSource",
"XHTMLSource","BRK",
"StyleAndFormatting","|","Paragraph","FontName","FontSize","|",
"Bold","Italic","Underline","Strikethrough","Superscript","Subscript","|",
"JustifyLeft","JustifyCenter","JustifyRight","JustifyFull","|",
"Numbering","Bullets","|","Indent","Outdent","LTR","RTL","|","CustomObject","CustomTag"];//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.btnStyles=false;
this.btnParagraph=true;
this.btnFontName=true;
this.btnFontSize=true;
this.btnCut=true;
this.btnCopy=true;
this.btnPaste=true;
this.btnPasteText=false;//Editor By Moocrun
this.btnUndo=true;
this.btnRedo=true;
this.btnBold=true;
this.btnItalic=true;
this.btnUnderline=true;
this.btnStrikethrough=true;//Editor By Moocrun
this.btnSuperscript=true;//Editor By Moocrun
this.btnSubscript=true;//Editor By Moocrun
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;//Editor By Moocrun
this.btnCharacters=true;
this.btnCustomTag=false;
this.btnImage=true;
this.btnFlash=false;
this.btnMedia=false;
this.btnTable=true;
this.btnGuidelines=true;
this.btnAbsolute=true;
this.btnPasteWord=true;
this.btnLine=true;
this.btnForm=true;
this.btnClean=true;
this.btnClearAll=true; //Editor By Moocrun *** CMS Features ***
this.btnHTMLFullSource=false;
this.btnHTMLSource=false;
this.btnXHTMLFullSource=false;
this.btnXHTMLSource=true;
this.cmdAssetManager="";
this.btnContentBlock=false;
this.cmdContentBlock=";";//needs ;
this.btnInternalLink=false;
this.cmdInternalLink=";";//needs ;
this.insertLink=insertLink;
this.btnCustomObject=false;
this.cmdCustomObject=";";//needs ;
//*****
this.arrStyle=[["BODY",false,"","font:12px verdana,arial,sans-serif;margin:3px;"]];
this.onCustomCssShow = new
Function("modelessDialogShow('"+this.scriptPath+"styles_cssText.htm',360,380)");
this.addonCSSBuilder=addonCSSBuilder;
this.arrParagraph=[[getText("Heading 1"),"H1"],
[getText("Heading 2"),"H2"],
[getText("Heading 3"),"H3"],
[getText("Heading 4"),"H4"],
[getText("Heading 5"),"H5"],
[getText("Heading 6"),"H6"],
[getText("Preformatted"),"PRE"],
[getText("Normal (P)"),"P"],
[getText("Normal (DIV)"),"DIV"]];
// this.arrFontName=["Arial","Arial Black","Arial Narrow",
// "Book Antiqua","Bookman Old Style",
// "Century Gothic","Comic Sans MS","Courier New",
// "Franklin Gothic Medium","Garamond","Georgia",
// "Impact","Lucida Console","Lucida Sans","Lucida Unicode",
// "Modern","Monotype Corsiva","Palatino Linotype",
// "Roman","Script","Small Fonts","Symbol",
// "Tahoma","Times New Roman","Trebuchet MS",
// "Verdana","Webdings","Wingdings","Wingdings 2","Wingdings 3",
// "serif","sans-serif","cursive","fantasy","monoscape"];
this.arrFontName=["宋体","黑体","楷体","幼圆","隶书","楷体_GB2312","仿宋_GB2312",
"Arial","Arial Black","Arial Narrow",
"Century Gothic","Comic Sans MS","Courier New",
"Georgia","Impact","Lucida Console","Lucida Sans","Lucida Unicode",
"Roman","Tahoma","Times New Roman","Trebuchet MS",
"Verdana","Webdings","Wingdings","Wingdings 2","Wingdings 3"];
this.arrFontSize=[[getText("Size 1"),"1"],
[getText("Size 2"),"2"],
[getText("Size 3"),"3"],
[getText("Size 4"),"4"],
[getText("Size 5"),"5"],
[getText("Size 6"),"6"],
[getText("Size 7"),"7"]];
this.arrCustomTag=[];//eg.[["Full Name","{%full_name%}"],["Email","{%email%}"]];
this.docType="";
this.html="<html>";
this.headContent="";
this.preloadHTML="";
this.onSave=function(){return true;};
this.useBR=true;
this.useDIV=false;
this.doUndo=doUndo;
this.doRedo=doRedo;
this.saveForUndo=saveForUndo;
this.arrUndoList=[];
this.arrRedoList=[];
this.useTagSelector=true;
this.TagSelectorPosition="bottom";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -