📄 latticeeditor.js
字号:
state_btn_underline=5;changebutton("btn_underline",0);
}
}
}if(document.getElementById("btn_left")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("JustifyLeft");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("JustifyLeft");
if(tempSupported==false){
changebutton("btn_left",1);
}else{
if(tempState==true){
state_btn_left=5;
changebutton("btn_left",3);
}else{
state_btn_left=5;
changebutton("btn_left",0);
}
}
}
if(document.getElementById("btn_center")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("JustifyCenter");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("JustifyCenter");
if(tempSupported==false){
changebutton("btn_center",1);
}else{
if(tempState==true){
state_btn_center=5;
changebutton("btn_center",3);
}else{
state_btn_center=5;changebutton("btn_center",0);
}
}
}
if(document.getElementById("btn_right")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("JustifyRight");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("JustifyRight");
if(tempSupported==false){
changebutton("btn_right",1);
}else{
if(tempState==true){
state_btn_right=5;changebutton("btn_right",3);
}else{
state_btn_right=5;changebutton("btn_right",0);
}
}
}
if(document.getElementById("btn_bltlist")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("InsertUnorderedList");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("InsertUnorderedList");
if(tempSupported==false){
changebutton("btn_bltlist",1);
}else{
if(tempState==true){
state_btn_bltlist=5;
changebutton("btn_bltlist",3);
}else{
state_btn_bltlist=5;
changebutton("btn_bltlist",0);
}
}
}
if(document.getElementById("btn_numlist")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("InsertOrderedList");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("InsertOrderedList");
if(tempSupported==false){
changebutton("btn_numlist",1);
}else{
if(tempState==true){
state_btn_numlist=5;changebutton("btn_numlist",3);
}else{
state_btn_numlist=5;
changebutton("btn_numlist",0);
}
}
}
if(document.getElementById("btn_cut")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("Cut");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("Cut");
if(tempSupported==false){
changebutton("btn_cut",1);
}else{
if(tempState==true){
state_btn_cut=5;changebutton("btn_cut",3);
}else{
state_btn_cut=5;changebutton("btn_cut",0);
}
}
}
if(document.getElementById("btn_copy")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("Copy");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("Copy");
if(tempSupported==false){
changebutton("btn_copy",1);
}else{
if(tempState==true){
state_btn_copy=5;
changebutton("btn_copy",3);
}else{
state_btn_copy=5;
changebutton("btn_copy",0);
}
}
}
if(document.getElementById("btn_paste")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("Paste");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("Paste");
if(tempSupported==false){
changebutton("btn_paste",1);
}else{
if(tempState==true){
state_btn_paste=5;
changebutton("btn_paste",3);
}else{
state_btn_paste=5;changebutton("btn_paste",0);
}
}
}
if(document.getElementById("btn_undo")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("Undo");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("Undo");
if(tempSupported==false){
changebutton("btn_undo",1);
}else{
if(tempState==true){
state_btn_undo=5;
changebutton("btn_undo",3);
}else{
state_btn_undo=5;
changebutton("btn_undo",0);
}
}
}
if(document.getElementById("btn_redo")){
tempSupported=document.frames("LatticeEditDocument").document.queryCommandEnabled("Redo");
tempState=document.frames("LatticeEditDocument").document.queryCommandValue("Redo");
if(tempSupported==false){
changebutton("btn_redo",1);
}else{
if(tempState==true){
state_btn_redo=5;
changebutton("btn_redo",3);
}else{
state_btn_redo=5;changebutton("btn_redo",0);
}
}
}
if(document.getElementById("FormatSelect")){
var tempformatvalue=document.frames("LatticeEditDocument").document.queryCommandValue("FormatBlock");
if(tempformatvalue!=document.myform.FormatSelect.options[0].text){
document.myform.FormatSelect.options[0].text=tempformatvalue;
document.myform.FormatSelect.options[0].selected=true;
}
}
var temprange=document.frames("LatticeEditDocument").document.selection.createRange();
var tempfontnamevalue=temprange.queryCommandValue("FontName");
if(document.getElementById("FontNameSelect")){
if(tempfontnamevalue!=document.myform.FontNameSelect.options[0].text&&tempfontnamevalue!=null&&tempfontnamevalue!=""){
document.myform.FontNameSelect.options[0].text=tempfontnamevalue;
document.myform.FontNameSelect.options[0].selected=true;
}
}
var tempfontsize=document.frames("LatticeEditDocument").document.queryCommandValue("FontSize");
if(tempfontsize=="1"){tempfontsize="1 ( 8pt)";}
if(tempfontsize=="2"){tempfontsize="1 (10pt)";}
if(tempfontsize=="3"){tempfontsize="1 (12pt)";}
if(tempfontsize=="4"){tempfontsize="1 (14pt)";}
if(tempfontsize=="5"){tempfontsize="1 (18pt)";}
if(tempfontsize=="6"){tempfontsize="1 (24pt)";}
if(tempfontsize=="7"){tempfontsize="1 (36pt)";}
if(document.getElementById("FontSizeSelect")){
if(tempfontsize!=document.myform.FontSizeSelect.options[0].text&&tempfontsize!=null&&tempfontsize!=""){
document.myform.FontSizeSelect.options[0].text=tempfontsize;
document.myform.FontSizeSelect.options[0].selected=true;
}
}
document.frames("LatticeEditDocument").focus();
}
function disableme(){
showcmenu(document.frames("LatticeEditDocument").event.screenX,document.frames("LatticeEditDocument").event.screenY);
return false;
}
function displayChangedDelayedMore(){
if(millisecondtimerflag==1){millisecondtimerflag=0;displayChanged();}
}
function displayChangedDelayed(){
var xtime=new Date();
var xmill=xtime.getTime();
if((xmill-millisecondtimer)>200){
displayChanged();
millisecondtimer=xmill;
millisecondtimerflag=0;
}else{
millisecondtimer=xmill;
millisecondtimerflag=1;
setTimeout("displayChangedDelayedMore()",205);
}
}
function initEditor(){
if(document.getElementById("line1")){document.getElementById("line1").style.width=LatticeWidth;}
if(document.getElementById("line2")){document.getElementById("line2").style.width=LatticeWidth;}
if(document.getElementById("line3")){document.getElementById("line3").style.width=LatticeWidth;}
document.getElementById("LatticeEditDocument").style.height=LatticeHeight;
document.getElementById("LatticeEditDocument").style.width=LatticeWidth;
//document.frames("LatticeEditDocument").document.open();
//document.frames("LatticeEditDocument").document.write(unescape(InitialHTML));
document.frames("LatticeEditDocument").document.body.style.backgroundColor=BackgroundColor;
document.frames("LatticeEditDocument").document.body.background=BackgroundImage;
document.frames("LatticeEditDocument").document.designMode="On";
//document.frames("LatticeEditDocument").document.onkeydown=displayChangedDelayed;
document.frames("LatticeEditDocument").document.onmouseup=displayChanged;
document.frames("LatticeEditDocument").document.oncontextmenu=disableme;
var gettables=document.frames ['LatticeEditDocument'].document.all.tags("TABLE");
//if(gettables.length>0){
//var tablecount=1;
//while(tablecount<=gettables.length){
// gettables[tablecount-1].border=parseInt(gettables[tablecount-1].border);
// tablecount++;
//}
//}
document.frames("LatticeEditDocument").document.execCommand("LiveResize","",1);
document.frames("LatticeEditDocument").document.execCommand("2D-Position",true,true);
if(document.getElementById("FontNameSelect")){
var xfonts=FontSelection;
if(xfonts!=""){
if(xfonts.indexOf("|")>0){
var fontarray=xfonts.split("|");
for(var i=1;i<=fontarray.length;i++){
if(fontarray[i-1].indexOf(";")>0){
var tempsplit=fontarray[i-1].split(";");
var fontoption=window.document.createElement("OPTION");
window.document.myform.FontNameSelect.options.add(fontoption);
fontoption.innerText=tempsplit[0];
fontoption.value=tempsplit[1];
}else{
var fontoption=window.document.createElement("OPTION");
window.document.myform.FontNameSelect.options.add(fontoption);
fontoption.innerText=fontarray[i-1];
fontoption.value=fontarray[i-1];
}
}
}else{
if(xfonts.indexOf(";")>0){
var tempsplit=xfonts.split(";");
var fontoption=window.document.createElement("OPTION");
window.document.myform.FontNameSelect.options.add(fontoption);
fontoption.innerText=tempsplit[0];
fontoption.value=tempsplit[1];
}else{
var fontoption=window.document.createElement("OPTION");
window.document.myform.FontNameSelect.options.add(fontoption);
fontoption.innerText=xfonts;
fontoption.value=xfonts;
}
}
}
}
if(document.getElementById("FormatSelect")){original_formatselect=document.myform.FormatSelect.options[0].text;}
document.frames("LatticeTemp").document.open();
document.frames("LatticeTemp").document.write("<P> </P>");
document.frames("LatticeTemp").document.oncontextmenu=disableme;
document.frames("LatticeTemp").document.execCommand("LiveResize","",1);
document.frames("LatticeTemp").document.execCommand("2D-Position",true,true);
document.frames("LatticeTemp").document.execCommand("MultipleSelection","",true);
var hanger=0;
//hidebuttons();
hiderows();
initfinished=1;
document.frames("LatticeEditDocument").focus();
}
function setStyle(){
if(StyleSheetURL!=""&&stylesheetloaded==0){
stylesheetloaded=1;
document.frames("LatticeEditDocument").document.createStyleSheet(StyleSheetURL);
}
}
function test22(){
var editBody=document.frames("LatticeEditDocument").document.body;
for(var intLoop=0;intLoop<editBody.all.length;intLoop++){
el=editBody.all[intLoop];
el.removeAttribute("className","",0);
el.removeAttribute("style","",0);
}
var html=document.frames("LatticeEditDocument").document.body.innerHTML;
html=html.replace(/<o:p> <\/o:p>/g,"");
html=html.replace(/o:/g,"");
document.frames("LatticeEditDocument").document.body.innerHTML=html;
}
function tableProp(){
var tableflag=false;
var xsel=document.frames("LatticeEditDocument").document.selection;
var xobj=document.frames("LatticeEditDocument").document.selection.createRange();
if(xsel.type=="None"||xsel.type=="Text"){
xsel=xobj.parentElement();
while(xsel.tagName!="BODY"&&tableflag==false){
if(xsel.tagName=="TABLE"){tableflag=true;}
if(tableflag==false){xsel=xsel.parentElement;}
}
}else if(xsel.type=="Control"){
xsel=xobj.item(0);
if(xsel.tagName=="TABLE"){
tableflag=true;
}else{
while(xsel.tagName!="BODY"&&tableflag==false){
if(xsel.tagName=="TABLE"){tableflag=true;}
if(tableflag==false){xsel=xsel.parentElement;}
}
}
}
if(tableflag==true){
if(xsel.className!=""&&xsel.className!=null){tableclass=xsel.className;}else{tableclass="";}
if(xsel.width!=""&&xsel.width!=null){tablewidthspecified="yes";tablewidth=xsel.width;}else{tablewidthspecified="no";tablewith="";}
if(xsel.align!=""&&xsel.align!=null){tablealign=xsel.align;}else{tablealign="";}
if(xsel.border!=""&&xsel.border!=null){tablebordersize=xsel.border;}else{tablebordersize="";}
if(xsel.cellPadding!=""&&xsel.cellPadding!=null){tablecellpadding=xsel.cellPadding;}else{tablecellpadding="";}
if(xsel.cellSpacing!=""&&xsel.cellSpacing!=null){tablecellspacing=xsel.cellSpacing;}else{tablecellspacing="";}
if(xsel.borderColor!=""&&xsel.borderColor!=null){tablebordercolor=xsel.borderColor;}else{tablebordercolor="";}
if(xsel.bgColor!=""&&xsel.bgColor!=null){tablebackgroundcolor=xsel.bgColor;}else{tablebackgroundcolor="";}
tableiscancel="";
window.showModalDialog("HtmlEditor/tableprops.htm",window,"dialogHeight: 300px; dialogWidth: 360px; help: no;scroll: no; status: no");
if(tableiscancel=="no"){
if(tablewidthspecified=="yes"){
var tw1="";
if(tablewidthtype=="percentage"){
tw1=tablewidth+"%";
}else{
tw1=tablewidth;
}
xsel.width=tw1;
}else{
xsel.removeAttribute("width",0);
}
if(tablealign!=""&&tablealign!="Default"){xsel.align=tablealign;}else{xsel.removeAttribute("align",0);}
if(tableclass!=""&&tableclass!="Default"){xsel.className=tableclass;}else{xsel.removeAttribute("className",0);}
if(tablebordersize!=""&&tablebordersize!=null){xsel.border=tablebordersize;}else{xsel.removeAttribute("border",0);}
if(tablecellpadding!=""&&tablecellpadding!=null){xsel.cellPadding=tablecellpadding;}else{xsel.removeAttribute("cellPadding",0);}
if(tablecellspacing!=""&&tablecellspacing!=null){xsel.cellSpacing=tablecellspacing;}else{xsel.removeAttribute("cellSpacing",0);}
if(tablebordercolor!=""&&tablebordercolor!="Default"){xsel.borderColor=tablebordercolor;}else{xsel.removeAttribute("borderColor",0);}
if(tablebackgroundcolor!=""&&tablebackgroundcolor!="Default"){xsel.bgColor=tablebackgroundcolor;}else{xsel.removeAttribute("bgColor",0);}
}
}
}
function cellProp(){
var cellflag=false;
var xsel=document.frames("LatticeEditDocument").document.selection;
var xobj=document.frames("LatticeEditDocument").document.selection.createRange();
if(xsel.type=="None"||xsel.type=="Text"){
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -