📄 ace.js
字号:
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
return oSel.item(0).src;
else
return "";
}
function imgAlt()
{
oEditor=eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
return oSel.item(0).alt;
else
return "";
}
function imgAlign()
{
oEditor=eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
return oSel.item(0).align;
else
return "";
}
function imgBorder()
{
oEditor=eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
return oSel.item(0).border;
else
return "";
}
function imgWidth()
{
oEditor=eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
return oSel.item(0).width;
else
return "";
}
function imgHeight()
{
oEditor=eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
return oSel.item(0).height;
else
return "";
}
function imgHspace()
{
oEditor=eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
return oSel.item(0).hspace;
else
return "";
}
function imgVspace()
{
oEditor=eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
return oSel.item(0).vspace;
else
return "";
}
function UpdateImage(inpImgURL,inpImgAlt,inpImgAlign,inpImgBorder,inpImgWidth,inpImgHeight,inpHSpace,inpVSpace)
{
var oEditor = eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
var sType = oEditor.document.selection.type;
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
{
oSel.item(0).style.width="";
oSel.item(0).style.height="";
oSel.item(0).src = this.getEditorPreviewPath(inpImgURL);
if(inpImgAlt!="")
oSel.item(0).alt = inpImgAlt;
else
oSel.item(0).removeAttribute("alt",0);
oSel.item(0).align = inpImgAlign;
oSel.item(0).border = inpImgBorder;
if(inpImgWidth!="")
oSel.item(0).width = inpImgWidth;
else
oSel.item(0).removeAttribute("width",0);
if(inpImgHeight!="")
oSel.item(0).height = inpImgHeight;
else
oSel.item(0).removeAttribute("height",0);
if(inpHSpace!="")
oSel.item(0).hspace = inpHSpace;
else
oSel.item(0).removeAttribute("hspace",0);
if(inpVSpace!="")
oSel.item(0).vspace = inpVSpace;
else
oSel.item(0).removeAttribute("vspace",0);
}
}
function InsertImage(inpImgURL,inpImgAlt,inpImgAlign,inpImgBorder,inpImgWidth,inpImgHeight,inpHSpace,inpVSpace)
{
this.doCmd("InsertImage",this.getEditorPreviewPath(inpImgURL));
var oEditor = eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
var sType = oEditor.document.selection.type;
if ((oSel.item) && (oSel.item(0).tagName=="IMG"))
{
if(inpImgAlt!="")
oSel.item(0).alt = inpImgAlt;
oSel.item(0).align = inpImgAlign;
oSel.item(0).border = inpImgBorder;
if(inpImgWidth!="")
oSel.item(0).width = inpImgWidth;
if(inpImgHeight!="")
oSel.item(0).height = inpImgHeight;
if(inpHSpace!="")
oSel.item(0).hspace = inpHSpace;
if(inpVSpace!="")
oSel.item(0).vspace = inpVSpace;
}
}
/*** 自定义编辑区(有用的部分) ***/
function boxShow_Asset()
{
var oEditor = eval("idContent"+this.oName);
oEditor.focus();//Why ?
//Because:focus akan men-set oUtil.oNamem shg bisa dipakai di default_Asset.htm
this.boxHide();
this.saveSelection();
if(this.AssetPageURL=="")return;
var popleft=((document.body.clientWidth - this.AssetPageWidth) / 2)+window.screenLeft;
var poptop=(((document.body.clientHeight - this.AssetPageHeight) / 2))+window.screenTop-40;
window.open(this.AssetPageURL,"NewWindow","scrollbars=NO,width="+this.AssetPageWidth+",height="+this.AssetPageHeight+",left="+popleft+",top="+poptop);
}
function InsertAsset_Hyperlink(inpURL,inpLinkText)
{
var oEditor = eval("idContent"+this.oName);
var oSel = oEditor.document.selection.createRange();
var sType = oEditor.document.selection.type;
if(inpURL!="")
{
if (oSel.parentElement)
{
if(oSel.text!="")
{
//noop
}
else
{
var oSelTmp = oSel.duplicate();
if(inpLinkText=="") inpLinkText = inpURL;
oSel.text = inpLinkText;//displayed text
oSel.setEndPoint("StartToStart",oSelTmp);
oSel.select();
sType="Text";
}
}
oSel.execCommand("CreateLink",false,this.getEditorPreviewPath(inpURL));
oEditor.focus();
oSel.select();//tambahan
}
}
function InsertAsset_Flash(inpURL, inpFlashWidth, inpFlashHeight)
{
/*inpURL is seen from this.baseEditor (where editor is located), since
default_Asset is located the same as editor.
Because of the production is at this.base, the we need to adjust inpURL.
For example :
this.baseEditor = "http://localhost/ACE/AdvContentEditor55_StaticFiles/"
this.base = "http://localhost/ACE/AdvContentEditor55_StaticFiles/Files/Files2/"
inpURL (APPLIED_LINK) = "files/tes.gif" (seen from this.baseEditor)
or => http://localhost/ACE/AdvContentEditor55_StaticFiles/files/tes.gif
OUTPUT of getEditorPreviewPath => "../../images/tes.gif"
*/
inpURL = this.getEditorPreviewPath(inpURL);
var sHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' VIEWASTEXT width='"+inpFlashWidth+"' height='"+inpFlashHeight+"'>" +
"<param name=movie value='"+inpURL+"'><param name=quality value=high>" +
"<embed src='"+inpURL+"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+inpFlashWidth+"' height='"+inpFlashHeight+"'>" +
"</embed></object>";
var oEditor = eval("idContent"+this.oName);
oEditor.focus();
var oSel = oEditor.document.selection.createRange();
//oSel = fixSel(inpActiveEditor.value,oSel)//a must => tdk perlu => sama dgn kasus InsertAsset_Hyperlink
if(oSel.parentElement)
oSel.pasteHTML(sHTML);
else
oSel.item(0).outerHTML = sHTML;
}
function InsertAsset_Video(inpURL)
{
inpURL = this.getEditorPreviewPath(inpURL);
var sHTML = "<embed src='"+inpURL+"' hidden=false autostart='true' type='video/avi' loop='true'></embed>";
var oEditor = eval("idContent"+this.oName);
oEditor.focus();
var oSel = oEditor.document.selection.createRange();
//oSel = fixSel(inpActiveEditor.value,oSel)//a must => tdk perlu => sama dgn kasus InsertAsset_Hyperlink
if(oSel.parentElement)
oSel.pasteHTML(sHTML);
else
oSel.item(0).outerHTML = sHTML;
}
function InsertAsset_Image(inpURL)
{
inpURL = this.getEditorPreviewPath(inpURL);
var sHTML = "<img src='"+inpURL+"'>";
var oEditor = eval("idContent"+this.oName);
oEditor.focus();
var oSel = oEditor.document.selection.createRange();
//oSel = fixSel(inpActiveEditor.value,oSel)//a must => tdk perlu => sama dgn kasus InsertAsset_Hyperlink
if(oSel.parentElement)
oSel.pasteHTML(sHTML);
else
oSel.item(0).outerHTML = sHTML;
}
function InsertAsset_Sound(inpURL)
{
inpURL = this.getEditorPreviewPath(inpURL);
var sHTML = "<embed src='"+inpURL+"' hidden=false autostart='true' type='audio/wav' loop='true'></embed>";
var oEditor = eval("idContent"+this.oName);
oEditor.focus();
var oSel = oEditor.document.selection.createRange();
//oSel = fixSel(inpActiveEditor.value,oSel)//a must => tdk perlu => sama dgn kasus InsertAsset_Hyperlink
if(oSel.parentElement)
oSel.pasteHTML(sHTML);
else
oSel.item(0).outerHTML = sHTML;
}
function InsertCustomHTML(sHTML)
{
var oEditor = eval("idContent"+this.oName);
oEditor.focus();
var oSel = oEditor.document.selection.createRange();
//oSel = fixSel(inpActiveEditor.value,oSel)//a must => tdk perlu => sama dgn kasus InsertAsset_Hyperlink
if(oSel.parentElement)
oSel.pasteHTML(sHTML);
else
oSel.item(0).outerHTML = sHTML;
}
/*** 表格 ***/
function boxShow_Table()
{
this.boxHide();
this.saveSelection();
boxTable2.document.body.document.all.inpActiveEditor.innerText = this.oName;
boxTable2.document.body.document.all.popup_ContentBorder.style.cssText= this.style_popup_ContentBorder;
boxTable2.document.body.document.all.popup_BarArea.style.cssText= "width: 100%; height: 20px;padding-left: 5px;" + this.style_popup_BarArea;
boxTable2.document.body.document.all.popup_BarArea_close.style.cssText= "width: 100%; height: 20px;" + this.style_popup_BarArea;
boxTable2.document.body.style.cssText= "border:lightgrey 0px solid;" + this.style_popup_Body;
//Additional
var divBorderColorPick = boxTable2.document.body.document.all.divBorderColorPick;
var divBgColorPick = boxTable2.document.body.document.all.divBgColorPick;
var divBgColor2Pick = boxTable2.document.body.document.all.divBgColor2Pick;
var divBorderColor2Pick = boxTable2.document.body.document.all.divBorderColor2Pick;
var divCellBgColorPick = boxTable2.document.body.document.all.divCellBgColorPick;
//Init Values - For INSERT Tab [#]
boxTable2.setInpValue("inpRows",1);
boxTable2.setInpValue("inpCols",2);
boxTable2.setInpValue("inpWidth",100);
boxTable2.setInpValue("inpHeight","");
boxTable2.objColor1.setColor("");//col obj.
boxTable2.setInpValue("inpBgImage","");
boxTable2.setInpValue("inpBorder",0);
boxTable2.objColor2.setColor("");
boxTable2.document.body.document.all.inpTblAlign.value = "";//dropdown
boxTable2.setInpValue("inpPadding",0);
boxTable2.setInpValue("inpSpacing",0);
var oSel = this.Sel;
var sType = this.SelType;
var oBlock = (oSel.parentElement != null ? this.GetElement(oSel.parentElement(),"TABLE") : this.GetElement(oSel.item(0),"TABLE"));
if (oBlock!=null)//If inside existing table
{
//Init Values - For EDIT Tab [##] => Get existing table properties
boxTable2.document.body.document.all.inpTblAlign2.value = oBlock.align;//dropdown
var st = oBlock.width;
if(st.indexOf("%")!=-1)
{
boxTable2.setInpValue("inpWidth2",st.substring(0,st.indexOf("%")));//remove last %
boxTable2.document.body.document.all.inpWidth2Me.value = "%";//dropdown
}
else
{
boxTable2.setInpValue("inpWidth2",oBlock.width);
boxTable2.document.body.document.all.inpWidth2Me.value = "";//dropdown
}
var st2 = oBlock.height;
if(st2.indexOf("%")!=-1)
{
boxTable2.setInpValue("inpHeight2",st2.substring(0,st2.indexOf("%")));//remove last %
boxTable2.document.body.document.all.inpHeight2Me.value = "%";//dropdown
}
else
{
boxTable2.setInpValue("inpHeight2",oBlock.height);
boxTable2.document.body.document.all.inpHeight2Me.value = "";//dropdown
}
boxTable2.setInpValue("inpPadding2",oBlock.cellPadding);
boxTable2.setInpValue("inpSpacing2",oBlock.cellSpacing);
boxTable2.setInpValue("inpBorder2",oBlock.border);
boxTable2.objColor4.setColor(oBlock.borderColor);//col obj.(oBlock.borderColor).substring(1)
boxTable2.setInpValue("inpBgImage2",oBlock.background);
boxTable2.objColor3.setColor(oBlock.bgColor);
if(oSel.parentElement != null)//yg dipilih text, bukan control(=table)
{
//Init Colors
divCellBgColorPick.style.display = "none";
//Init Tabs
boxTable2.TabEditCell();
//Init Values - For CELL Tab => Get existing cell properties
var oTD = GetElement(oSel.parentElement(),"TD");
if(oTD==null)return; //jika yg di select adl text tapi meliputi lebih dari satu cell
var st3 = oTD.width; //HTML : width
if(st3.indexOf("%")!=-1)
{
boxTable2.setInpValue("inpCellWidth",st3.substring(0,st3.indexOf("%")));//remove last %
boxTable2.document.body.document.all.inpCellWidthMe.value = "%";//dropdown
}
else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -