To make the editor fit into our project we made some nice changes wich we would like to share with other users:
(This change adds a little loading screen to the editor, it is using javascript and is tested under IE 5.5, * * The CODE is optimized for our project * * )
fckeditor.html (somewhere document):
<script language="javascript">
// * * * Non Orrigional Code * * *
window.offscreenBuffering = true;
document.onreadystatechange=fnStartInit;
function fnStartInit()
{
if (document.readyState=="complete")
{
timerID = window.setTimeout("remLoading()", 1000); // Initial call.
}
}
function remLoading()
{
parent.document.getElementById(URLParams['FieldName'] + 'LoadingDiv').parentElement.removeChild(parent.document.getElementById(URLParams['FieldName'] + 'LoadingDiv'));
}
// * * * Non Orrigional Code End * * *
</script>
the page were the editor is located (locate a div arround the editor, and a script wich creates a div in front of it and gets the location of the orrigional div):
<DIV id="TextEditorDiv" sObjectCaption="Text">
... Jscript wich calls the editor ...
</DIV>
<script language="javascript">
// Function that gets the position of a object that doesn't had positioning absolute..
function findPos(el){
x=0; y=0; var temp
if(el.offsetParent){
temp = el
while(temp.offsetParent){ //Looping parent elements to get the offset of them as well
temp=temp.offsetParent;
x+=temp.offsetLeft
y+=temp.offsetTop;
}
}
x+=el.offsetLeft
y+=el.offsetTop
// Returning the x and y as an array
return [x,y]
}
// Get al DIV's
var aDIVs = document.getElementsByTagName("DIV") ;
// For each div wich had the sObjectCaption propery a loading DIV will be created
for ( i = 0 ; i < aDIVs.length ; i++ )
{
if(aDIVs[i].sObjectCaption){
var tempArray = findPos(aDIVs[i]);
var sWidth = document.getElementById(aDIVs[i].sObjectCaption + 'Width').value ;
if(parseInt(sWidth) < 600){
sWidth = 600;
}
document.write('<Div id="' + aDIVs[i].sObjectCaption + 'LoadingDiv" class="loading" style="width: ' + sWidth + '; height:400; display: block; position: absolute; top: ' + tempArray[1] + '; left: ' + tempArray[0] + ';"><table border=0 width="100%" height="400px"><tr><td class="Loading"><Center>Please wait while loading the editor...</center></td></tr></table></Div>');
}
}
</script>
(This change adds a little loading screen to the editor, it is using javascript and is tested under IE 5.5, * * The CODE is optimized for our project * * )
fckeditor.html (somewhere document):
<script language="javascript">
// * * * Non Orrigional Code * * *
window.offscreenBuffering = true;
document.onreadystatechange=fnStartInit;
function fnStartInit()
{
if (document.readyState=="complete")
{
timerID = window.setTimeout("remLoading()", 1000); // Initial call.
}
}
function remLoading()
{
parent.document.getElementById(URLParams['FieldName'] + 'LoadingDiv').parentElement.removeChild(parent.document.getElementById(URLParams['FieldName'] + 'LoadingDiv'));
}
// * * * Non Orrigional Code End * * *
</script>
the page were the editor is located (locate a div arround the editor, and a script wich creates a div in front of it and gets the location of the orrigional div):
<DIV id="TextEditorDiv" sObjectCaption="Text">
... Jscript wich calls the editor ...
</DIV>
<script language="javascript">
// Function that gets the position of a object that doesn't had positioning absolute..
function findPos(el){
x=0; y=0; var temp
if(el.offsetParent){
temp = el
while(temp.offsetParent){ //Looping parent elements to get the offset of them as well
temp=temp.offsetParent;
x+=temp.offsetLeft
y+=temp.offsetTop;
}
}
x+=el.offsetLeft
y+=el.offsetTop
// Returning the x and y as an array
return [x,y]
}
// Get al DIV's
var aDIVs = document.getElementsByTagName("DIV") ;
// For each div wich had the sObjectCaption propery a loading DIV will be created
for ( i = 0 ; i < aDIVs.length ; i++ )
{
if(aDIVs[i].sObjectCaption){
var tempArray = findPos(aDIVs[i]);
var sWidth = document.getElementById(aDIVs[i].sObjectCaption + 'Width').value ;
if(parseInt(sWidth) < 600){
sWidth = 600;
}
document.write('<Div id="' + aDIVs[i].sObjectCaption + 'LoadingDiv" class="loading" style="width: ' + sWidth + '; height:400; display: block; position: absolute; top: ' + tempArray[1] + '; left: ' + tempArray[0] + ';"><table border=0 width="100%" height="400px"><tr><td class="Loading"><Center>Please wait while loading the editor...</center></td></tr></table></Div>');
}
}
</script>