I am using the editor to edit the contents of some table cells.
The editor is on a panel that I display only when the cell to edit is clicked. After editing I hide the panel and update the table cell with the editors text.
Overall this works fine, but if I go to edit a cell that is blank the setHTML function will not put the blank string into the editor. Instead it acts like the setHTML did not fire and the editor has the text that was in the editor instead of placing the blank into it.
Here is the code that does not work, so you can get an idea of what I am doing.
function onClickTableCell(cellID)
{
document.getElementById('<%=panEditor2.ClientID%>').style.display = "block"; // show editor
document.getElementById("btnUpdateRow").style.display = "block"; // show update button
var editor = document.getElementById('<% = ceEditor2.ClientID%>'); //Get the editor
editor.setHTML(cellID.innerHTML);
editor.FocusDocument();
}
After editing I click the btnUpdateRow and update the cellID.innerHTML and hide the editor again.
What is odd is that this seems to be related to showing and hiding the editor. If I keep the editor visible this issue does not exist.
I can get it to work correctly by inserting a blank space into the editor.
var editor = document.getElementById('<% = ceEditor2.ClientID%>');
if (cellID.innerHTML != "") {
editor.setHTML(cellID.innerHTML);
} else {
editor.setHTML( " " );
}
editor.FocusDocument();
I can deal with the "blank" by trimming it off - but I should not need to do that, the editor should be able to place a blank string with setHTML.
Anybody else had to deal with this???
The Analytical Group