📄 editjs.js
字号:
thisContentItem.value=DHTMLSafe.DOM.body.innerHTML;
DHTMLSafe.DOM.body.innerHTML = "";
DHTMLSafe.DOM.body.createTextRange().text = thisContentItem.value.replace(re, "$1\n");
ae_HTMLMode[num] = true;
}
}
function ae_specialchars() {
var szURL = inc + "../editor/specialchars.htm";
ae_specialwin = window.showModalDialog(szURL,window,"dialogHeight: 275px; dialogWidth: 390px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
}
function ae_quickfont(num) {
if (ae_HTMLMode[num]) { return; }
DHTMLSafe=aeObjects[num];
oSel=eval('document.all.oQuickFont'+num);
DHTMLSafe.ExecCommand(DECMD_SETFONTNAME, OLECMDEXECOPT_DODEFAULT, oSel.options[oSel.selectedIndex].name);
DHTMLSafe.focus();
DHTMLSafe.DOM.body.focus();
replaceFontsWithSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
condenseSpans(DHTMLSafe, DHTMLSafe.DOM.body, null);
}
function ae_quickfontsize(num) {
if (ae_HTMLMode[num]) { return; }
DHTMLSafe=aeObjects[num];
oSel=eval('document.all.oQuickFontSize'+num);
DHTMLSafe.ExecCommand(DECMD_SETFONTSIZE, OLECMDEXECOPT_DODEFAULT, oSel.options[oSel.selectedIndex].value);
DHTMLSafe.focus();
}
function ae_quickformat(num) {
if (ae_HTMLMode[num]) { return; }
DHTMLSafe=aeObjects[num];
oSel=eval('document.all.oQuickFormat'+num);
DHTMLSafe.ExecCommand(DECMD_SETBLOCKFMT, OLECMDEXECOPT_DODEFAULT, oSel.options[oSel.selectedIndex].name);
DHTMLSafe.focus();
}
function ae_hyperlinkwin(num) {
ae_hot=num;
DHTMLSafe=aeObjects[num];
DHTMLSafe.focus();
if(DHTMLSafe.DOM.selection.type=="Control") {
var el=DHTMLSafe.DOM.selection.createRange().commonParentElement();
var tr = DHTMLSafe.DOM.body.createTextRange();
tr.moveToElementText(el);
tr.select();
}
if (typeof(ae_linkwin) == "undefined" || ae_linkwin.closed) { //short circuit eval
var szURL=inc + "../editor/hyperlink.htm";
ae_linkwin = window.showModalDialog(szURL,window,"dialogHeight: 240px; dialogWidth: 400px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
}
}
//加
function ae_imagepropertywin(num) {
ae_imgpropertywin =window.showModalDialog(inc + "../editor/imgproperties.htm",window,"dialogHeight: 350px; dialogWidth: 490px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
}
function ae_imageproperty(num, aWidth, aHeight, aBorder, aSrc, aAlt, aAlign) {
DHTMLSafe=aeObjects[num];
var oSel=DHTMLSafe.DOM.selection.createRange().commonParentElement();
var tr = DHTMLSafe.DOM.body.createTextRange();
hs=oSel.getAttribute("STYLE",0).height;
ws=oSel.getAttribute("STYLE",0).width;
if (hs.length) {
oSel.getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
}
if (ws.length) {
oSel.getAttribute("STYLE",0).removeAttribute("WIDTH",0);
}
oSel.width=aWidth;
oSel.height=aHeight;
oSel.border=aBorder;
oSel.src=aSrc;
oSel.alt=aAlt;
oSel.align=aAlign;
DHTMLSafe.focus();
DHTMLSafe.DOM.body.focus();
tr.moveToElementText(oSel);
tr.collapse(false);
tr.select();
}
//至此
function ae_hyperlink(num, iHref, iTarget, iStyle, iClass, iName) {
DHTMLSafe=aeObjects[num];
var uid="ae"+Math.random().toString();
if(iHref=="" && !iName.length) { // Unlink
if(DHTMLSafe.QueryStatus(DECMD_UNLINK)==DECMDF_ENABLED)
DHTMLSafe.ExecCommand(DECMD_UNLINK);
}
else {
var trSel=DHTMLSafe.DOM.selection.createRange();
if(trSel.compareEndPoints("StartToEnd",trSel)==0) { // Need a brand new link
txtHTML="<A href=\""+iHref+"\" ";
if(iTarget.length)
txtHTML+="target=\""+iTarget+"\" ";
if(iStyle.length)
txtHTML+="style=\""+iStyle+"\" ";
if(iClass.length)
txtHTML+="class=\""+iClass+"\" ";
if(iName.length)
txtHTML+="name=\""+iName+"\" ";
txtHTML+=">"+iHref+"</a>";
trSel.pasteHTML(txtHTML);
}
else {
DHTMLSafe.ExecCommand(DECMD_HYPERLINK,OLECMDEXECOPT_DONTPROMPTUSER,uid);
var coll=DHTMLSafe.DOM.all.tags("A");
for(i=0;i<coll.length;i++) {
if(coll[i].href==uid) {
coll[i].href=iHref;
if(iTarget.length) coll[i].target=iTarget;
else coll[i].removeAttribute("TARGET",0);
if(iStyle.length) coll[i].style.cssText=iStyle;
else {
coll[i].style.cssText="";
}
if(iClass.length) coll[i].className=iClass;
else {
coll[i].className="";
}
}
}
}
}
DHTMLSafe.focus();
}
function ae_spellcheckwin(num) {
if (typeof(ae_spellwin) == "undefined" || ae_spellwin.closed) { //short circuit eval
var szURL=inc + "spellchecker/window.cfm?jsvar=aeObjects["+num+"].DOM.body.innerHTML";
//window.showModalDialog(inc + "editsource.htm",window,"dialogHeight: 490px; dialogWidth: 485px; dialogTop: 70px; dialogLeft: 150px; center: Yes; help: No; resizable: No; status: No;");
ae_spellwin = window.open(szURL, null, "height=230,width=450,status=no,toolbar=no,menubar=no,location=no");
}
ae_spellwin.focus();
}
function ShowMenu(num) {
var menuStrings = new Array();
var menuStates = new Array();
var state;
var i;
var idx = 0;
ae_hot=num;
DHTMLSafe=aeObjects[num];
ContextMenu.length = 0;
if(alloweditsource[num]) i=0;
else i=2;
for (;i<GeneralContextMenu.length; i++) {
ContextMenu[idx++] = GeneralContextMenu[i];
}
if (DHTMLSafe.QueryStatus(DECMD_INSERTROW) != DECMDF_DISABLED) {
for (i=0; i<TableContextMenu.length; i++) {
ContextMenu[idx++] = TableContextMenu[i];
}
}
var tr = DHTMLSafe.DOM.selection.createRange();
if (DHTMLSafe.DOM.selection.type == "Control") {
for (i=0; i<ImageContextMenu.length; i++) {
ContextMenu[idx++] = ImageContextMenu[i];
}
}
for (i=0; i<ContextMenu.length; i++) {
menuStrings[i] = ContextMenu[i].string;
if ((menuStrings[i] != MENU_SEPARATOR) && (ContextMenu[i].cmdId < 6000)) {
state = DHTMLSafe.QueryStatus(ContextMenu[i].cmdId);
}
else {
state = DECMDF_ENABLED;
}
if (state == DECMDF_DISABLED || state == DECMDF_NOTSUPPORTED) {
menuStates[i] = OLE_TRISTATE_GRAY;
}
else if (state == DECMDF_ENABLED || state == DECMDF_NINCHED) {
menuStates[i] = OLE_TRISTATE_UNCHECKED;
}
else {
menuStates[i] = OLE_TRISTATE_CHECKED;
}
if (ContextMenu[i].cmdId == DECMD_TOGGLE_DETAILS) {
if (DHTMLSafe.ShowDetails) {
menuStates[i] = OLE_TRISTATE_CHECKED;
}
else {
menuStates[i] = OLE_TRISTATE_UNCHECKED;
}
}
if(ContextMenu[i].cmdId == DECMD_EDITSOURCE) {
if(ae_sourceview) {
menuStates[i] = OLE_TRISTATE_CHECKED;
}
else {
menuStates[i] = OLE_TRISTATE_UNCHECKED;
}
}
}
DHTMLSafe.SetContextMenu(menuStrings, menuStates);
}
function ContextMenuItem(string, cmdId) {
this.string = string;
this.cmdId = cmdId;
}
function QueryStatusItem(command, element) {
this.command = command;
this.element = element;
}
var MENU_SEPARATOR = "";
var ContextMenu = new Array();
var GeneralContextMenu = new Array();
var TableContextMenu = new Array();
var ImageContextMenu = new Array();
var genId = 0;
var tblId = 0;
var imgId = 0;
GeneralContextMenu[genId++] = new ContextMenuItem("编辑源代码", DECMD_EDITSOURCE);
GeneralContextMenu[genId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
if (!is_ie4) {
TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
TableContextMenu[tblId++] = new ContextMenuItem("表格属性", DECMD_EDITTABLE);
}
TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
TableContextMenu[tblId++] = new ContextMenuItem("插入行", DECMD_INSERTROW);
TableContextMenu[tblId++] = new ContextMenuItem("删除行", DECMD_DELETEROWS);
TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
TableContextMenu[tblId++] = new ContextMenuItem("插入列", DECMD_INSERTCOL);
TableContextMenu[tblId++] = new ContextMenuItem("删除列", DECMD_DELETECOLS);
TableContextMenu[tblId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
TableContextMenu[tblId++] = new ContextMenuItem("插入单元格", DECMD_INSERTCELL);
TableContextMenu[tblId++] = new ContextMenuItem("删除单元格", DECMD_DELETECELLS);
TableContextMenu[tblId++] = new ContextMenuItem("合并单元格", DECMD_MERGECELLS);
TableContextMenu[tblId++] = new ContextMenuItem("拆分单元格", DECMD_SPLITCELL);
ImageContextMenu[imgId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
ImageContextMenu[imgId++] = new ContextMenuItem("图片属性", DECMD_IMAGE_PROPERTIES);
GeneralContextMenu[genId++] = new ContextMenuItem("查找", DECMD_FINDTEXT);
GeneralContextMenu[genId++] = new ContextMenuItem("全部显示", DECMD_TOGGLE_DETAILS);
GeneralContextMenu[genId++] = new ContextMenuItem(MENU_SEPARATOR, 0);
GeneralContextMenu[genId++] = new ContextMenuItem("关于", DECMD_ABOUT);
function ae_m_out(src) {
if(src.state==0) return;
if(src.state==2) { src.className="latched"; return; }
if(src.type=="btn") {
window.status="";
src.className="flat";
}
}
function ae_m_over(src) {
if(src.state==0) return;
if(src.state==2) return;
if(src.type=="btn") {
window.status=src.alt;
src.className="outset";
}
}
function ae_m_down(src) {
if(src.state==0) return;
if(src.type=="btn") {
src.className="inset";
}
}
function ae_m_up(src) {
if(src.state==0) return;
if(src.state==2) { src.className="latched"; return; }
if(src.type=="btn") {
src.className="outset";
}
}
function set_tbstates(num) {
var pbtn;
var cid;
var state;
DHTMLSafe=aeObjects[num];
ae_tbar=eval("ae_tbar"+num);
if(DHTMLSafe.QueryStatus(5002)!=DHTMLSafe.QueryStatus(5003)) return;
for(var i=0;i<ae_tbar.all.length;i++) {
pbtn= ae_tbar.all(i);
cid=pbtn.cid;
if(cid < 6000&&cid!=DECMD_HYPERLINK) {
if (!is_ie4) pbtn.style.visibility="visible";
state=DHTMLSafe.QueryStatus(cid)
if(state == DECMDF_DISABLED || state == DECMDF_NOTSUPPORTED) {
if(pbtn.state!=0) {
pbtn.className = "disabled";
pbtn.state = 0;
}
}
else if(state == DECMDF_ENABLED || state == DECMDF_NINCHED){
if(pbtn.state!=1) {
pbtn.className = "flat";
pbtn.state = 1;
}
}
else {
if(pbtn.state!=2) {
pbtn.className = "latched";
pbtn.state = 2;
}
}
}
else if(cid==6004) {
if(DHTMLSafe.ShowDetails) {
if(pbtn.state!=2) {
pbtn.className = "latched";
pbtn.state = 2;
}
}
else {
if(pbtn.state!=1) {
pbtn.className = "flat";
pbtn.state = 1;
}
}
}
}
if(oSel=eval('document.all.oQuickFont'+num)){
if(DHTMLSafe.QueryStatus(DECMD_SETFONTNAME)!=DECMDF_DISABLED&&DHTMLSafe.DOM.selection.type!="control") {
if(oSel.disabled) oSel.disabled=false;
fontname=DHTMLSafe.ExecCommand(DECMD_GETFONTNAME);
if(fontname!=""&&fontname!=null) {
fCreateNew=true;
window.status="MoonDowner";
for(i=0;i<oSel.options.length;i++) {
if(oSel.options[i].name==fontname) {
if(!oSel.options[i].selected)
oSel.options[i].selected=true;
fCreateNew=false;
}
}
if(fCreateNew) {
var oOption = document.createElement("OPTION");
oSel.options.add(oOption,0);
oOption.text = fontname;
oOption.name = fontname;
oOption.selected=true;
}
}
else {
oSel.selectedIndex=-1;
}
}
else {
if(!oSel.disabled) oSel.disabled=true;
}
}
if(oSel=eval('document.all.oQuickFontSize'+num)){
if(DHTMLSafe.QueryStatus(DECMD_SETFONTSIZE)!=DECMDF_DISABLED&&DHTMLSafe.DOM.selection.type!="control") {
if(oSel.disabled) oSel.disabled=false;
fs=DHTMLSafe.ExecCommand(DECMD_GETFONTSIZE);
if(fs!=null&&fs!="") {
for(i=0;i<oSel.options.length;i++) {
if(oSel.options[i].name=="ae_fs"+fs&&!oSel.options[i].selected)
oSel.options[i].selected=true;
}
}
else {
oSel.selectedIndex=-1;
}
}
else {
if(!oSel.disabled) oSel.disabled=true;
}
}
if(oSel=eval('document.all.oQuickFormat'+num)){
if(DHTMLSafe.QueryStatus(DECMD_SETBLOCKFMT)!=DECMDF_DISABLED&&DHTMLSafe.DOM.selection.type!="control") {
if(oSel.disabled) oSel.disabled=false;
fmt=DHTMLSafe.ExecCommand(DECMD_GETBLOCKFMT);
if(fmt!=""&&fmt!=null) {
for(i=0;i<oSel.options.length;i++) {
if(oSel.options[i].name==fmt&&!oSel.options[i].selected)
oSel.options[i].selected=true;
}
}
else {
oSel.selectedIndex=-1;
}
}
else {
if(!oSel.disabled) oSel.disabled=true;
}
}
}
function aeapi_onLoad(aeObject) {
aeObject.ShowBorders = true;
}
function aeapi_onBeforeSave(aeObject) {
for (var i=0;i<aeObject.DOM.images.length;i++) {
hs=aeObject.DOM.images[i].getAttribute("STYLE",0).height;
ws=aeObject.DOM.images[i].getAttribute("STYLE",0).width;
if(hs.length) {
aeObject.DOM.images[i].removeAttribute("HEIGHT", 0);
aeObject.DOM.images[i].setAttribute("HEIGHT", replaceString("px", "", hs),0);
aeObject.DOM.images[i].getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
}
if(ws.length) {
aeObject.DOM.images[i].removeAttribute("WIDTH", 0);
aeObject.DOM.images[i].setAttribute("WIDTH", replaceString("px", "", ws),0);
aeObject.DOM.images[i].getAttribute("STYLE",0).removeAttribute("WIDTH",0);
}
}
for (var k=0;k<aeObject.DOM.all.tags("TABLE").length;k++) {
hs=aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).height;
ws=aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).width;
if(hs.length) {
aeObject.DOM.all.tags("TABLE").item(k).removeAttribute("HEIGHT", 0);
aeObject.DOM.all.tags("TABLE").item(k).setAttribute("HEIGHT", replaceString("px", "", hs),0);
aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).removeAttribute("HEIGHT",0);
}
if(ws.length) {
aeObject.DOM.all.tags("TABLE").item(k).removeAttribute("WIDTH", 0);
aeObject.DOM.all.tags("TABLE").item(k).setAttribute("WIDTH", replaceString("px", "", ws),0);
aeObject.DOM.all.tags("TABLE").item(k).getAttribute("STYLE",0).removeAttribute("WIDTH",0);
}
}
var content = aeObject.DOM.body.innerHTML;
if(content.length) {
content = aeObject.FilterSourceCode(content);
}
replaceString("", " ", content);
return content;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -