" var oDoc=idPreview.document.open("text/html", "replace"); if(obj.publishingPath!="") oDoc.write("" + sHTML); else oDoc.write(sHTML); oDoc.close(); realTime(); } function realTime() { if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff var oEditor=dialogArguments.oUtil.oEditor; var oSel=oEditor.document.selection.createRange(); if(dialogArguments.oUtil.activeElement) { oElement=dialogArguments.oUtil.activeElement } else { if (oSel.parentElement) oElement=oSel.parentElement(); else oElement=oSel.item(0); } var tagName=oElement.tagName; if(tagName=="TD") idPreview.document.all.idPreviewTarget.innerHTML="" + oElement.outerHTML + "
" else idPreview.document.all.idPreviewTarget.innerHTML=oElement.outerHTML inpCssText.value=oElement.style.cssText inpClassName.value=oElement.className; } function doApply() { if(!dialogArguments.oUtil.obj.checkFocus()){return;}//Focus stuff var oEditor=dialogArguments.oUtil.oEditor; var oSel=oEditor.document.selection.createRange(); var sType=oEditor.document.selection.type; var obj=dialogArguments.oUtil.obj; dialogArguments.oUtil.obj.saveForUndo(); if(inpCssText.value=="" && inpClassName.value=="")//Selalu berarti me-remove style & class di CURRENT TAG! { if (oSel.parentElement) oElement=oSel.parentElement(); else oElement=oSel.item(0); if(oElement) { if(oElement.tagName!="BODY") { oElement.removeAttribute("style",0); oElement.removeAttribute("className",0); if(oElement.tagName=="FONT" && oElement.color=="" && oElement.face=="" && oElement.size=="" && oElement.id=="") obj.doCmd('RemoveFormat'); } else { alert(getTxt("You're selecting BODY element.")); return; } } } else if(dialogArguments.oUtil.activeElement) { oElement=dialogArguments.oUtil.activeElement if(inpCssText.value=="") oElement.removeAttribute("style",0); else oElement.style.cssText=inpCssText.value; if(inpClassName.value=="") oElement.removeAttribute("className",0); else oElement.className=inpClassName.value; } else { if (oSel.parentElement) { if(oSel.text=="") { oElement=oSel.parentElement(); if(oElement) { if(oElement.tagName!="BODY") { if(inpCssText.value=="") oElement.removeAttribute("style",0); else oElement.style.cssText=inpCssText.value; if(inpClassName.value=="") oElement.removeAttribute("className",0); else oElement.className=inpClassName.value; } } } else { var idNewSpan=obj.applySpan(); if(idNewSpan)//if there is selected text { if(inpCssText.value=="") idNewSpan.removeAttribute("style",0);//jadi kalo CSS Text input dibuat empty, tetap akan melakukan remove else idNewSpan.style.cssText=inpCssText.value; if(inpClassName.value=="") idNewSpan.removeAttribute("className",0); else idNewSpan.className=inpClassName.value; } } } else { oElement=oSel.item(0); if(oElement) { if(inpCssText.value=="") oElement.removeAttribute("style",0); else oElement.style.cssText=inpCssText.value; if(inpClassName.value=="") oElement.removeAttribute("className",0); else oElement.className=inpClassName.value; } } } realTime() //*** RUNTIME BORDERS *** obj.runtimeBorder(false); //*********************** } function doCssTextChange() { if(idPreview.document.all.idPreviewTarget.innerHTML.substring(0,1)=="<")//means there is a tag for the style to be applied. Kalau tdk ada berarti BODY. { if(idPreview.document.all.idPreviewTarget.innerHTML.substring(0,6)==" BODY // idPreview.document.all.idPreviewTarget.style.cssText=inpCssText.value; }
CSS Text:
Class Name: