Hi
We are using cute editor for asp.net web application with two options on a screen viz. one with full toolbar() and other with custom toolbar which is controlled by following code snippet:
private void GetEditorSettings()
{
if (rdoToolbarFullCustom.SelectedValue == "Full")
{
Editor1.AutoConfigure = CuteEditor.AutoConfigure.Full;
Editor1.DisableItemList = "ImageGalleryByBrowsing, InsertImage, Zoom";
}
else if (rdoToolbarFullCustom.SelectedValue == "Custom")
{
Editor1.AutoConfigure = CuteEditor.AutoConfigure.Minimal;
}
CuteEditor.ToolControl tc = Editor1.ToolControls["insertcustombutonhere"];
if (tc != null)
{
System.Web.UI.WebControls.Label btnImageGallery = new System.Web.UI.WebControls.Label();
btnImageGallery.Text = "Image Gallery";
btnImageGallery.CssClass = "bluebutton";
// btnImageGallery.Attributes["onclick"] = "CuteEditor_GetEditor(this).ExecCommand('ImageGalleryByBrowsing')";
btnImageGallery.Attributes["onclick"] = "ShowMyDialog(this, '" + sourceassociatedfolder + "')";
tc.Control.Controls.Add(btnImageGallery);
}
}
In the aspx we are controlling the height of the editor by the following code snippet:
<script type="text/javascript">
function CuteEditor_OnInitialized(editor) {
var editor1 = document.getElementById("<%= Editor1.ClientID %>");
var txtEditorId = document.getElementById("<%= txtEditorId.ClientID %>");
var previouspageEditorId = "ContentPlaceHolder1_" + txtEditorId.value;
var EditorText = window.opener.document.getElementById(previouspageEditorId).innerHTML;
EditorText = EditorText.replace(/\s{2,}/g, ' ');
editor1.PasteHTML(EditorText);
var editdoc = editor.GetDocument();
editdoc.body.style.overflow = "hidden";
adjustHeight();
// setTimeout(adjustHeight, 10);
}
function adjustHeight() {
var editor = document.getElementById('<%= Editor1.ClientID%>');
if (editor.getHTML() != "") {
if (editor.GetDocument().body.scrollHeight < getDocHeight()) {
editor.SetHeight(getDocHeight() - 150);
}
else {
editor.SetHeight(editor.GetDocument().body.scrollHeight + 150);
}
}
else { editor.SetHeight(getDocHeight() - 150);
}
}
function getDocHeight() {
var D = document;
return Math.max(
D.body.scrollHeight, D.documentElement.scrollHeight,
D.body.offsetHeight, D.documentElement.offsetHeight,
D.body.clientHeight, D.documentElement.clientHeight
);
}
function CuteEditor_OnCommand(editor, command, ui, value) {
if (command == "TabEdit") {
var editdoc = editor.GetDocument();
editdoc.body.style.overflow = "hidden";
// setTimeout(adjustHeight, 10);
adjustHeight();
}
}
</script>
<CE:Editor ID="Editor1" runat="server" ThemeType="Office2007">
</CE:Editor>
The problem which we are facing is editor do not gets load on the server and after some time it gives a javascript popup displaying "? error". Sometimes it loads fine on the screen. Also when we switch the editor from full toolbar to custom or vice-versa then it didn't loads correctly and the browser displays loader image for an indefinite time. This problem persists on'y on the server whereas on our local machine it works fine.
Please let us know how to resolve it asap as now we are in a critical phase right now and have to rethink about the editor replacement in our application.