");
sBodyFooter=arrTmp[1];
s=oEditor.document.documentElement.outerHTML;
s=s.substr(s.indexOf("
")+1);
sBodyTag=s;
var sHTML="";
sHTML = oEditor.document.body.innerHTML;
sHTML = jsReplace(sHTML," contentEditable=true","");
idSource.document.body.innerText=sHTML;
idSource.document.body.style.cssText="overflow-x:scroll;overflow-y:scroll;white-space:nowrap";
idSource.document.body.contentEditable=true;
idSource.document.body.clearAttributes;
idSource.document.body.style.marginTop='4';
idSource.document.body.style.marginLeft='10';
idSource.document.body.style.fontFamily='Tahoma';
idSource.document.body.style.fontSize='11px';
idSource.document.body.style.color='black';
idSource.document.body.style.background='white';
idSource.document.body.onkeydown = new Function("doKeyPress(idSource.event)");
doWrap()
}
function doKeyPress(evt)
{
if (evt.keyCode==13)
{
var thisSel = document.selection.createRange();
thisSel.pasteHTML('
');
evt.cancelBubble = true;
evt.returnValue = false;
thisSel.select();
thisSel.moveEnd("character", 1);
thisSel.moveStart("character", 1);
thisSel.collapse(false);
return false;
idSource.focus();
}
if (evt.ctrlKey)
{
if(evt.keyCode==65)doCmd("SelectAll");
}
}
function doUpdate()
{
dialogArguments.oUtil.obj.saveForUndo();
var obj = dialogArguments.oUtil.obj;
sBodyContent = idSource.document.body.innerText;
var sHTML = obj.docType + sBodyHeader + sBodyTag + sBodyContent + "" + sBodyFooter;
obj.putHTML(sHTML);//tdk menggunakan loadHTML() krn loadHTML() hanya utk first load.
//*** RUNTIME STYLES ***
obj.runtimeBorder(false);
obj.runtimeStyles();
//***********************
}
function doWrap()
{
if(inpWrap.checked==true)
{
//Wrap Text
idSource.document.body.style.whiteSpace="normal";
}
else
{
idSource.document.body.style.whiteSpace="nowrap";
}
}
//*******************
var buttonArrays=[];
var buttonArraysCount=0;
function writeIconStandard(id,command,img,title)
{
var oEditor=dialogArguments.oUtil.oEditor;
var oSel=oEditor.document.selection.createRange();
var obj = dialogArguments.oUtil.obj;
w=obj.iconWidth;
h=obj.iconHeight;
imgPath=obj.iconPath+img;
sHTML=""+
""+
""+
" "+
" | ";
sHTML="";
buttonArrays.push(["inactive"]);
buttonArraysCount++;
return sHTML;
}
function writeBreakSpace()
{
var oEditor=dialogArguments.oUtil.oEditor;
var oSel=oEditor.document.selection.createRange();
var obj = dialogArguments.oUtil.obj;
w=obj.iconWidth;
h=obj.iconHeight;
imgPath=obj.iconPath+"brkspace.gif";
sHTML=""+
""+
" | ";
sHTML="";
return sHTML;
}
function setupToolbar()
{
var sHTMLIcons="";
sHTMLIcons+=writeIconStandard("btnCut","doCmd('Cut')","btnCut.gif",getText("Cut"));
sHTMLIcons+=writeIconStandard("btnCopy","doCmd('Copy')","btnCopy.gif",getText("Copy"));
sHTMLIcons+=writeIconStandard("btnPaste","doCmd('Paste')","btnPaste.gif",getText("Paste"));
sHTMLIcons+=writeBreakSpace();
sHTMLIcons+=writeIconStandard("btnUndo","doCmd('Undo')","btnUndo.gif",getText("Undo"));
sHTMLIcons+=writeIconStandard("btnRedo","doCmd('Redo')","btnRedo.gif",getText("Redo"));
sHTMLIcons+=writeBreakSpace();
sHTMLIcons+=writeIconStandard("btnSearch","modelessDialogShow('search2.htm',375,163)","btnSearch.gif",getText("Search"));
sHTML="";
idToolbar.innerHTML=sHTML;
}
function doOver(btn)
{
btnArr=buttonArrays[btn.btnIndex];
if(btnArr[0]=="inactive")btn.style.top=-24;//no.2
}
function doDown(btn)
{
btnArr=buttonArrays[btn.btnIndex];
if(btnArr[0]!="disabled")btn.style.top=-48;//no.3
}
var bCancel=false;
function doOut(btn)
{
if(btn.style.top=="-48px")
{
//lagi pushed tapi mouseout (cancel)
bCancel=true;
}
btnArr=buttonArrays[btn.btnIndex];
if(btnArr[0]=="active")btn.style.top=-72;//no.4 (remain active/pushed)
if(btnArr[0]=="inactive")btn.style.top=0;//no.1 (remain inactive)
}
function doUp(btn)//return true/false
{
if(bCancel)
{
//lagi pushed tapi mouseout (cancel)
bCancel=false;btn.style.top=0;
return false;
}
btnArr=buttonArrays[btn.btnIndex];
if(btnArr[0]=="disabled") return false;
btn.style.top=-24;//no.2
return true;
}
//*******************
function modelessDialogShow(url,width,height)
{
window.showModelessDialog(url,window,
"dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge:Raised;center:1;help:0;resizable:1;");
}