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

📄 editor.js

📁 OBPM是一个开源
💻 JS
📖 第 1 页 / 共 3 页
字号:
			}

			allRows = allTables[i].rows
			for (y=0; y < allRows.length; y++) {
			 	allCellsInRow = allRows[y].cells
					for (x=0; x < allCellsInRow.length; x++) {
						if (borderShown == "no") {
							allCellsInRow[x].runtimeStyle.border = "1px dotted #BFBFBF"
						} else {
							allCellsInRow[x].runtimeStyle.cssText = ""
						}
					}
			}
	}

	// ???? A
	for (a=0; a < allLinks.length; a++) {
		if (borderShown == "no") {
			if (allLinks[a].href.toUpperCase() == "") {
				allLinks[a].runtimeStyle.border = "1px dashed #000000"
				allLinks[a].runtimeStyle.width = "20px"
				allLinks[a].runtimeStyle.height = "16px"
				allLinks[a].runtimeStyle.backgroundColor = "#FFFFCC"
				allLinks[a].runtimeStyle.color = "#FFFFCC"					
			}
		} else {
			allLinks[a].runtimeStyle.cssText = ""		
		}
	}

	if (borderShown == "no") {
		borderShown = "yes"
	} else {
		borderShown = "no"
	}

	scrollUp()
}

// ??????????????
function scrollUp() {
	eWebEditor.scrollBy(0,0);
}

// ????????
var nCurrZoomSize = 100;
var aZoomSize = new Array(10, 25, 50, 75, 100, 150, 200, 500);
function doZoom(size) {
	eWebEditor.document.body.runtimeStyle.zoom = size + "%";
	nCurrZoomSize = size;
}

// ????????
function spellCheck(){
	ShowDialog('dialog/spellcheck.htm', 300, 220, true)
}

// ????????
function findReplace(){
	ShowDialog('dialog/findreplace.htm', 320, 165, true)
}

// ????(absolute)??????????(static)
function absolutePosition(){
	var objReference	= null;
	var RangeType		= eWebEditor.document.selection.type;
	if (RangeType != "Control") return;
	var selectedRange	= eWebEditor.document.selection.createRange();
	for (var i=0; i<selectedRange.length; i++){
		objReference = selectedRange.item(i);
		if (objReference.style.position != 'absolute') {
			objReference.style.position='absolute';
		}else{
			objReference.style.position='static';
		}
	}
	eWebEditor.content = false;
	eWebEditor.setActive();
}

// ????(forward)??????(backward)????
function zIndex(action){
	var objReference	= null;
	var RangeType		= eWebEditor.document.selection.type;
	if (RangeType != "Control") return;
	var selectedRange	= eWebEditor.document.selection.createRange();
	for (var i=0; i<selectedRange.length; i++){
		objReference = selectedRange.item(i);
		if (action=='forward'){
			objReference.style.zIndex  +=1;
		}else{
			objReference.style.zIndex  -=1;
		}
		objReference.style.position='absolute';
	}
	eWebEditor.content = false;
	eWebEditor.setActive();
}

// ??????????????????????
function isControlSelected(tag){
	if (eWebEditor.document.selection.type == "Control") {
		var oControlRange = eWebEditor.document.selection.createRange();
		if (oControlRange(0).tagName.toUpperCase() == tag) {
			return true;
		}	
	}
	return false;
}

// ??????????????
function sizeChange(size){
	for (var i=0; i<parent.frames.length; i++){
		if (parent.frames[i].document==self.document){
			var obj=parent.frames[i].frameElement;
			var height = parseInt(obj.offsetHeight);
			if (height+size>=300){
				obj.height=height+size;
			}
			break;
		}
	}
}
// ??????????????????
function splitTextField(objField, html) { 
	var strFieldName = objField.name;
	var objForm = objField.form;
	var objDocument = objField.document;
	objField.value = html;

	//????????????????????????102399????????????????????
	var FormLimit = 100000 ;

	// ????????????????????
	for (var i=1;i<objDocument.getElementsByName(strFieldName).length;i++) {
		objDocument.getElementsByName(strFieldName)[i].value = "";
	}

	//????????????????????????????????
	if (html.length > FormLimit) { 
		objField.value = html.substr(0, FormLimit) ;
		html = html.substr(FormLimit) ;
		while (html.length > 0) { 
			var objTEXTAREA = objDocument.createElement("TEXTAREA") ;
			objTEXTAREA.name = strFieldName ;
			objTEXTAREA.style.display = "none" ;
			objTEXTAREA.value = html.substr(0, FormLimit) ;
			objForm.appendChild(objTEXTAREA) ;

			html = html.substr(FormLimit) ;
		} 
	} 
} 

// ????????
function remoteUpload() { 
	if (sCurrMode=="TEXT") return;
	
	var objField = document.getElementsByName("eWebEditor_UploadText")[0];
	splitTextField(objField, getHTML());

	divProcessing.style.top = (document.body.clientHeight-parseFloat(divProcessing.style.height))/2;
	divProcessing.style.left = (document.body.clientWidth-parseFloat(divProcessing.style.width))/2;
	divProcessing.style.display = "";
	eWebEditor_UploadForm.submit();
} 

// ????????????
function remoteUploadOK() {
	divProcessing.style.display = "none";
	if (bDoneAutoRemote){
		doSubmit();
	}
}

// ????????????
function HTMLEncode2(text){
	text = text.replace(/&/g, "@amp;") ;
	text = text.replace(/"/g, "@quot;") ;
	text = text.replace(/</g, "@lt;") ;
	text = text.replace(/>/g, "@gt;") ;
	text = text.replace(/'/g, "@#146;") ;
	text = text.replace(/\ /g,"@nbsp;");
//	text = text.replace(/\n/g,"&#10;");
	return text;
}

// ????????????
function HTMLDencode2(text){
	var textold;
	do {
		textold = text;
		text = text.replace("@amp;","&") ;
		text = text.replace('@quot;','"') ;
		text = text.replace("@lt;","<") ;
		text = text.replace("@gt;",">") ;
		text = text.replace("@#146;","'") ;
		text = text.replace("@nbsp;"," ");
		text = text.replace("&#10;","\r");
		text = text.replace("&#13;","\n");
        }
        while(textold != text);
	return text;
}


function changeContentTextStyle(content, newStyle) {
//	alert("NEWSTYLE->" + newStyle);
//	alert("CONTENT step1->" + content);

//	alert(newStyle);
	var newContent;
	// ??????
	switch (newStyle){
	case "CODE":
/*
		var re = /(<IMG){1}(.*)valueScript=\"<!--{\[(.*)\]}-->(.*)(><\/\IMG>){1}/ig
		var c1 = content.replace(re,"<%$1%>");
		alert(c1);
		var c2 = content.replace(re,"<%$2%>");
		alert(c2);
		var c3 = content.replace(re,"<%$3%>");
		alert(c3);
		var c4 = content.replace(re,"<%$3%>");
		alert(c4);

		content = content.replace(re,"<%$3%>");
*/
/*
		var re1 = /<IMG(.*)valueScript=\"<!--{\[/ig
		var re2 = /\]}-->\" hint=\"\" className=\"com.cyberway.dynaform.form.ejb.CalctextField\"><\/IMG>/ig
		content = content.replace(re1,"<%");
		alert("1->"+content);
		content = content.replace(re2,"%>");
		alert("2->"+content);
//		alert(content);
//		re = /<img(.*)valueScript=\"<!--{\[(.*)\]}-->(.*)>/ig
//		content = content.replace(re,"<%$2%>");

		newContent = HTMLDencode2(content);
		*/
		content = content.replace("<img","<IMG");
		content = content.replace("</img>","");
		content = content.replace("></IMG","");
		var ready="", pos1, pos2, left="", right="", str="";

		do {
			pos1 = content.indexOf("<!--{\[");
			pos2 = content.indexOf("]}-->");
			
			if (pos1<pos2) {
				left = content.substring(0,pos1);
				var p = left.lastIndexOf("<IMG");
				if (p>=0) {
					left = left.substring(0,p);
				}
				ready += left;
				str = content.substring(pos1 + 6, pos2);
				str = HTMLDencode2(str);
				ready += "<%"+ str +"%>";

				right = content.substring(pos2+5);
				p = right.indexOf(">");
				if (p>=0 ) {
					right = right.substring(p+1);
				}
				content = right;
			}
			else {
				ready += content.substring(0, pos2);
				content = content.substring(pos2, content.length);
			}

		}
		while(pos1>=0 && pos2>=0);

		ready += content;
		
		newContent = ready;
//		alert("step1" + ready);
		break;

	case "EDIT":
//		alert("CONTENT step2->" + content);
		
		var ready,str;
		ready = "";
		str = "";
		var pos1,pos2;
		
		do{
			pos1 = content.indexOf("<%");
			pos2 = content.indexOf("%>");

			if (pos1<pos2) {
				ready += content.substring(0, pos1);
				str = content.substring(pos1+2, pos2);
				ready += '<IMG src="./buttonimage/standard/calctext.gif" type="calctextfield" valueScript="<!--{['+HTMLEncode2(str)+']}-->" hint="" className="cn.myapps.core.dynaform.form.ejb.CalctextField"></IMG>';
				content = content.substring(pos2+2, content.length);
			}
			else {
				if (pos2>0)
				{
					ready += content.substring(0, pos2);
					content = content.substring(pos2, content.length);
				}
			}
		}
		while (pos1>=0 && pos2>=0)
		
		ready += content;

		newContent = ready;

		break;

	case "VIEW":
		var ready,str;
		ready = "";
		str = "";
		var pos1,pos2;
		do{
			pos1 = content.indexOf("<%");
			pos2 = content.indexOf("%>");

			if (pos1<pos2) {
				ready += content.substring(0, pos1);
				str = content.substring(pos1+2, pos2);
				ready += '<IMG src="/dynaform/form/formeditor/buttonimage/standard/calctext.gif" type="calctextfield" valueScript="<!--{['+HTMLEncode2(str)+']}-->" hint="" className="cn.myapps.core.dynaform.form.ejb.CalctextField"></IMG>';
				content = content.substring(pos2+2, content.length);
			}
			else {
				if (pos2>0)
				{
					ready += content.substring(0, pos2);
					content = content.substring(pos2, content.length);
				}
			}
		}
		while (pos1>0 && pos2>0)
		ready += content;

		newContent = ready;

		break;

	}


	return newContent;

}

⌨️ 快捷键说明

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