📄 ace.js
字号:
{
boxTable2.setInpValue("inpCellWidth",oTD.width);
boxTable2.document.body.document.all.inpCellWidthMe.value = "";//dropdown
}
var st4 = oTD.height;//HTML : height
if(st4.indexOf("%")!=-1)
{
boxTable2.setInpValue("inpCellHeight",st4.substring(0,st4.indexOf("%")));//remove last %
boxTable2.document.body.document.all.inpCellHeightMe.value = "%";//dropdown
}
else
{
boxTable2.setInpValue("inpCellHeight",oTD.height);
boxTable2.document.body.document.all.inpCellHeightMe.value = "";//dropdown
}
boxTable2.document.body.document.all.inpCellAlign.value = oTD.align;//dropdown
boxTable2.document.body.document.all.inpCellVAlign.value = oTD.vAlign;//dropdown
boxTable2.setInpValue("inpCellBgImage",oTD.background);//HTML : background
boxTable2.objColor5.setColor(oTD.bgColor);//HTML : bgColor
boxTable2.document.body.document.all.inpCellWrap.checked = !oTD.noWrap;
}
else
{
//Init Colors
divBgColor2Pick.style.display = "none";
divBorderColor2Pick.style.display = "none";
//Init Tabs
boxTable2.TabEditTable();
//Init Values - For EDIT Tab
//Already done [##]
}
}
else
{
//Init Colors
divBorderColorPick.style.display = "none";
divBgColorPick.style.display = "none";
//Init Tabs
boxTable2.TabInsertTable();
//Init Values - For INSERT Tab
//Already done [#]
}
this.boxDimension("boxTable2");
this.boxPosition("boxTable2");
document.all.boxTable2.style.zIndex = 2;
document.all.boxTable2.style.visibility = "";
document.all.boxTable2.focus();
}
function showBorder()
{
this.boxHide();
var oEditor = eval("idContent"+this.oName);
var oTables = oEditor.document.getElementsByTagName("TABLE");
if(this.IsBorderShow)
{
for (i=0;i<oTables.length;i++)
{
if(oTables[i].border == 0)
{
oTables[i].runtimeStyle.borderWidth = "";
oTables[i].runtimeStyle.borderColor = "";
oTables[i].runtimeStyle.borderStyle = "";
oTables[i].runtimeStyle.borderCollapse = "";
for(j=0;j<oTables[i].getElementsByTagName("TD").length;j++)
{
oTables[i].getElementsByTagName("TD")[j].runtimeStyle.borderWidth = "";
oTables[i].getElementsByTagName("TD")[j].runtimeStyle.borderColor = "";
oTables[i].getElementsByTagName("TD")[j].runtimeStyle.borderStyle = "";
}
}
}
this.IsBorderShow = false;
}
else
{
for (i=0;i<oTables.length;i++)
{
if(oTables[i].border == 0)
{
oTables[i].runtimeStyle.borderWidth = 1;
oTables[i].runtimeStyle.borderColor = "#BCBCBC";
oTables[i].runtimeStyle.borderStyle = "dotted";
oTables[i].runtimeStyle.borderCollapse = "separate";
for(j=0;j<oTables[i].getElementsByTagName("TD").length;j++)
oTables[i].getElementsByTagName("TD")[j].runtimeStyle.border = "#BCBCBC 1 dotted";
}
}
this.IsBorderShow = true;
}
}
/*** 混合函数 ***/
function pasteFromWord()
{
this.boxHide();
var oEditor = eval("idContent"+this.oName);
var oEditorTmp = eval("idContentTmp"+this.oName);
oEditor.focus();
var oSel = oEditor.document.selection.createRange();
if(oSel.parentElement)
{
oEditorTmp.focus();
oEditorTmp.document.execCommand("SelectAll");
oEditorTmp.document.execCommand("Paste");
oSel.pasteHTML(this.cleanFromWord());
}
}
function cleanFromWord()
{
var oEditorTmp = eval("idContentTmp"+this.oName);
for (var i = 0; i < oEditorTmp.document.body.all.length; i++)
{
oEditorTmp.document.body.all[i].removeAttribute("className","",0);
oEditorTmp.document.body.all[i].removeAttribute("style","",0);
}
var sHTML = oEditorTmp.document.body.innerHTML;
var str = sHTML;
var arrTmp = str.split('<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />');
if (arrTmp.length > 1) str = arrTmp.join("");
var arrTmp = str.split("<o:p>");
if (arrTmp.length > 1) str = arrTmp.join("");
var arrTmp = str.split("</o:p>");
if (arrTmp.length > 1) str = arrTmp.join("");
var arrTmp = str.split("<o:p> </o:p>");
if (arrTmp.length > 1) str = arrTmp.join("");
return str;
}
function InsertText()
{
this.boxHide();
var oEditor = eval("idContent"+this.oName);
oEditor.focus();
var oSel = oEditor.document.selection.createRange();
oSel.pasteHTML("<div style='position:absolute;'>插入文字</div>");
if (oSel.parentElement)
{
oEl = oSel.parentElement();
if(oEl)oEl.setActive();
}
}
function setDisplayMode()
{
this.boxHide();
this.saveSelection();
var oEditor = eval("idContent"+this.oName);
if(this.displayMode=='RICH')
{
//~~~~~
var sTmp = this.getContent();
this.tmp = this.getPageCSSText();
if(!this.isFullHTML)
{
sTmp=sTmp.substr(sTmp.indexOf("<BODY")+1);
sTmp=sTmp.substr(sTmp.indexOf(">")+1);//">\r\n"
if(sTmp.substr(0,2)=="\r\n") sTmp=sTmp.substr(2);
var arrTmp = sTmp.split("</BODY>");
sTmp = arrTmp[0];
}
oEditor.document.body.innerText = sTmp;//this.getContent();
//~~~~~
//RED color for additional codes
var sContent = oEditor.document.body.innerHTML;
var arrTmp = sContent.split('<LINK href="' + this.getEditorPreviewPath(this.PageStylePath_RelativeTo_EditorPath + this.PageStyle) + '" type=text/css rel=stylesheet>');
if (arrTmp.length > 1) sContent = arrTmp.join('<br><font color=green><link href="' + this.getEditorPreviewPath(this.PageStylePath_RelativeTo_EditorPath + this.PageStyle) + '" type=text/css rel=stylesheet></font>');
var arrTmp = sContent.split('<LINK href="' + this.getEditorPreviewPath(this.StyleSelectionPath_RelativeTo_EditorPath + this.StyleSelection) + '" type=text/css rel=stylesheet>');
if (arrTmp.length > 1) sContent = arrTmp.join('<br><font color=green><link href="' + this.getEditorPreviewPath(this.StyleSelectionPath_RelativeTo_EditorPath + this.StyleSelection) + '" type=text/css rel=stylesheet></font>');
oEditor.document.body.innerHTML = sContent;
//HTML view style
oEditor.document.body.clearAttributes;
oEditor.document.body.style.fontFamily = 'Courier New';
oEditor.document.body.style.fontSize = '12px';
oEditor.document.body.style.color = 'black';
oEditor.document.body.style.background = 'white';
//change status (displayMode)
this.displayMode = 'HTML';
eval("idToolbar"+this.oName).style.display = "none";
}
else
{
this.putContent(oEditor.document.body.innerText);
//~~~~~~~~~~~~~~~~~~
if(!this.isFullHTML)
{
this.setPageCSSText(this.tmp);
}
//~~~~~~~~~~~~~~~~~~
//change status (displayMode)
this.displayMode = 'RICH';
eval("idToolbar"+this.oName).style.display = "block";
document.body.focus();
}
}
function GetElement(oElement,sMatchTag)
{
while (oElement!=null && oElement.tagName!=sMatchTag)
{
if(oElement.id=="idContent"+this.oName) return null;
oElement = oElement.parentElement;
}
return oElement;
}
function doOnKeyPress()
{
var oName = oUtil.oName;
var oEditor = eval("idContent"+oName);
if(document.getElementById("chkBreakMode"+oName).checked)
{
if (oEditor.event.keyCode==13)
{
if (oEditor.event.shiftKey==false)
{
var oSel = oEditor.document.selection.createRange();
oSel.pasteHTML('<br>');
oEditor.event.cancelBubble = true;
oEditor.event.returnValue = false;
oSel.select();
oSel.moveEnd("character", 1);
oSel.moveStart("character", 1);
oSel.collapse(false);
return false;
}
else
return event.keyCode=13;
}
}
}
/*** GET& PUT CONTENT ***/
function getContentBody()
{
var sTmp = this.getContent();
if(!this.isFullHTML)
{
sTmp=sTmp.substr(sTmp.indexOf("<BODY")+1);
sTmp=sTmp.substr(sTmp.indexOf(">")+1);//">\r\n"
var arrTmp = sTmp.split("</BODY>");
sTmp = arrTmp[0];
}
return sTmp;
}
function getContent()
{
if(this.displayMode != "RICH")
{
alert("Please uncheck HTML view");
return;
}
var oEditor = eval("idContent"+this.oName);
var oEditorTmp = eval("idContentTmp"+this.oName);
var oDoc = oEditorTmp.document.open("text/html", "replace");
oDoc.write(oEditor.document.documentElement.outerHTML);
oDoc.close();
//REMOVE UNUSED
oEditorTmp.document.body.style.border = "";
oEditorTmp.document.body.removeAttribute("contentEditable",0);
//~~~ ANCHOR ~~~
for(var i=0;i<oEditorTmp.document.all.length;i++)
{
if(oEditorTmp.document.all[i].tagName=="A")
{
for(var j=0;j<oEditorTmp.document.all[i].childNodes.length;j++)
{
if(oEditorTmp.document.all[i].childNodes[j].tagName=="IMG")
{
sSrc = oEditorTmp.document.all[i].childNodes[j].src;
if(sSrc.indexOf("yusasp_anchor.gif")!=-1)
oEditorTmp.document.all[i].removeChild(oEditorTmp.document.all[i].childNodes[j]);
}
}
}
}
//~~~
var str = oEditorTmp.document.documentElement.outerHTML;
var arrTmp = str.split("<BASE href="+this.base+">");
if (arrTmp.length > 1) str = arrTmp.join("");
var arrTmp = str.split('<PARAM NAME="Play" VALUE="0">');
if (arrTmp.length > 1) str = arrTmp.join('<PARAM NAME="Play" VALUE="-1">');
str = str.replace("<STYLE><\/STYLE>","");
str = str.replace("BORDER-RIGHT: medium none; ","");
str = str.replace("BORDER-TOP: medium none; ","");
str = str.replace("BORDER-BOTTOM: medium none; ","");
str = str.replace("BORDER-LEFT: medium none; ","");
str = str.replace("BORDER-RIGHT: medium none","");
str = str.replace("BORDER-TOP: medium none","");
str = str.replace("BORDER-BOTTOM: medium none","");
str = str.replace("BORDER-LEFT: medium none","");
str = str.replace(" style=\"\"","");
//Fix & Bug
myregexp = /&/g;
str = str.replace(myregexp,"&");
return str;
}
function putContent(sContent)
{
var oEditor = eval("idContent"+this.oName);
var oEditorTmp = eval("idContentTmp"+this.oName);
//LOAD CONTENT ***/
var oDoc = oEditorTmp.document.open("text/html", "replace");
oDoc.write(sContent);
oDoc.close();
var oDoc = oEditor.document.open("text/html", "replace");
if(this.base!="")
oDoc.write("<BASE HREF=\""+this.base+"\"/>" + oEditorTmp.document.documentElement.outerHTML);
else
oDoc.write(oEditorTmp.document.documentElement.outerHTML);
oDoc.close();
//set Title to the "Page Properties" dialog
if(this.usePageProperties)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -