⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 editor.js

📁 很经典的Blog程序,呵呵
💻 JS
📖 第 1 页 / 共 5 页
字号:
/***********************************************************
InnovaStudio WYSIWYG Editor 2.9.7
Copyright ?2003-2005, INNOVA STUDIO (www.InnovaStudio.com). All rights reserved.
************************************************************/

var editor = new Array();

/*** 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("moz/editor.js")!=-1)
            {
            this.scriptPath=oScripts[i].src.replace(/editor.js/,"");
            }
        else if(sSrc.indexOf("scripts/innovaeditor.js")!=-1)/*optional, kalau embed innovaeditor.js (khusus firefox perlu)*/
            {
            if(!this.scriptPath)
				this.scriptPath=oScripts[i].src.replace(/innovaeditor.js/,"")+"moz/";
            }
        }
    this.scriptPathLang=this.scriptPath.replace(/\/moz/,"")+"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=true;
    this.arrEditor=[];
    this.onSelectionChanged=function(){return true;};
    this.activeElement;
    this.activeModalWin;
    this.setEdit = setEdit;
    this.bOnLoadReplaced=false;
    }

/*** Focus stuff ***/
function bInside(oElement)
    {
    while(oElement!=null)
        {
        if(oElement.designMode && oElement.designMode=="on")return true;
        oElement=oElement.parentNode;
        }
    return false;
    }

function checkFocus()
    {
    var oEditor=document.getElementById("idContent"+this.oName).contentWindow;
    var oSel=oEditor.getSelection();
    var parent = getSelectedElement(oSel);
    if(parent!=null)
        {
        if(!bInside(parent))return false;
        }
    else
        {
        if(!bInside(parent))return false;
        }
    return true;
    }

function iwe_focus()
    {
    var oEditor=document.getElementById("idContent"+this.oName);
    if(oEditor) oEditor.contentWindow.focus();
    }

/*** setEdit ***/
function setEdit(oName) 
	{
	if ((oName != null) && (oName!="")) 
		{
		try {document.getElementById("idContent"+oName).contentDocument.designMode="on";} catch(e) {}
		}
	else 
		{
		for (var i=0; i<this.arrEditor.length; i++)
			{
			try {document.getElementById("idContent"+this.arrEditor[i]).contentDocument.designMode="on";} catch(e) {}
			}
		}
	}

/*** icons related ***/
var iconHeight;
var iconHeight2;
var iconHeight3;
var iconHeight4;
var iconOffsetTop;

/*** EDITOR OBJECT ***/
function InnovaEditor(oName)
    {
    this.oName=oName;
    this.RENDER=RENDER;

    this.loadHTML=loadHTML;
    this.loadHTMLFull=loadHTMLFull;
    this.getHTMLBody=getHTMLBody;
    this.getHTML=getHTML;
    this.getXHTMLBody=getXHTMLBody;
    this.getXHTML=getXHTML;
    this.getTextBody=getTextBody;
    this.putHTML=putHTML;//source dialog
    this.css="";
    
    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.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.applySpan=applySpan;
    this.makeAbsolute=makeAbsolute;
    this.insertHTML=insertHTML;
    this.clearAll=clearAll;
    this.insertCustomTag=insertCustomTag;
    this.selectParagraph=selectParagraph;

	this.useB=false;//not used

    this.hide=hide;
    this.dropShow=dropShow;

    this.width="560";
    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("moz/editor.js")!=-1)
            {
            this.scriptPath=oScripts[i].src.replace(/editor.js/,"");
            break;
            }
        else if(sSrc.indexOf("innovaeditor.js")!=-1) //Utk mengatasi masalah di NS7.1 (NS7.2 & 8.0 tdk masalah)
			{
			this.scriptPath=oScripts[i].src.replace(/innovaeditor.js/,"moz/"); break;
			}
        }
	
	/*** icons related ***/
    this.iconPath="icons/";
    this.iconWidth=23;//25;
    this.iconHeight=25;//24;
    this.iconOffsetTop=-75;//-72;
	/*** /icons related ***/
	
    this.writeIconToggle=writeIconToggle;
    this.writeIconStandard=writeIconStandard;
    this.writeDropDown=writeDropDown;
    this.writeBreakSpace=writeBreakSpace;
    this.dropTopAdjustment_moz=0;
    this.dropLeftAdjustment_moz=0;

    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.useLastForeColor=false;
    this.useLastBackColor=false;
    this.stateForeColor="";
    this.stateBackColor="";

    this.fullScreen=fullScreen;
    this.stateFullScreen=false;

	this.arrElm=new Array(300);
	this.getElm=iwe_getElm;

    this.features=[];
    
    //diff: "Search","Cut","Copy","Paste","Guidelines" 
	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
    
    //diff: btnSearch, btnCut, btnCopy, btnPaste, btnGuidelines
  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=false;this.btnOutdent=false;
  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;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -