");
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";
}
}
//*******************
function setupToolbar()
{
var obj = dialogArguments.oUtil.obj;
var tb=new ISToolbar("srcEdt");
tb.onClick=function(id) {tbAction(tb, id);};
tb.iconPath=obj.iconPath;
tb.btnWidth=obj.iconWidth;
tb.btnHeight=obj.iconHeight;
tb.addButton("btnCut","btnCut.gif",getTxt("Cut"));
tb.addButton("btnCopy","btnCopy.gif",getTxt("Copy"));
tb.addButton("btnPaste","btnPaste.gif",getTxt("Paste"));
tb.addSeparator();
tb.addButton("btnUndo","btnUndo.gif",getTxt("Uedo"));
tb.addButton("btnRedo","btnRedo.gif",getTxt("Redo"));
tb.addSeparator();
tb.addButton("btnSearch","btnSearch.gif",getTxt("Search"));
idToolbar.innerHTML=tb.render();
}
function tbAction(tb, id)
{
switch(id)
{
case "btnCut": doCmd('Cut'); break;
case "btnCopy": doCmd('Copy'); break;
case "btnPaste": doCmd('Paste'); break;
case "btnUndo": doCmd('Undo'); break;
case "btnRedo": doCmd('Redo'); break;
case "btnSearch": modelessDialogShow('search2.htm',375,163); break;
}
}
//*******************
function modelessDialogShow(url,width,height)
{
window.showModelessDialog(url,window,
"dialogWidth:"+width+"px;dialogHeight:"+height+"px;edge:Raised;center:1;help:0;resizable:1;");
}