Strange error after taking the focus out of the CuteEditor

Last post 03-04-2008, 10:50 AM by CoffeeGuy. 6 replies.
Sort Posts: Previous Next
  •  02-14-2008, 4:40 PM 37062

    Strange error after taking the focus out of the CuteEditor

    Hello.
     I'm using this function to programmatically   set the focus on the cute editor.
     
    focusEditor= function (){
                        editor.FocusDocument();
                        return false;
                        }
     
    We have attached a function to the onkeydown event as follows:
     
    var editdoc=editor.GetDocument();
    editdoc.attachEvent('onkeydown',onkeyDown);
     
     Here is the function:
     function onkeyDown(e)
        {
            if (event) e = event;                
            if (e.ctrlKey && e.keyCode != 17)
            {            
                switch(e.keyCode)
                {                    
                    case keyCodes.closeKeyLower: //e --close
                        close();
                        break;
                    case 84 : // T --Email settings
                        changeEmailSettings();
                        break;
                    case keyCodes.keyTab:
                         focusToNextField();
                        break;
                    
                }
                
            }
        }
     
     
    And here is what I want to do when the user press the Crtl+Tab on the cuteeditor
     
        function focusToNextField()
        {
            document.getElementById("EmailEditor_Subject_textbox").focus();
        }
     
    Basically, I want to get the focus into one of our controls. After getting the focus, I get an strange error. This seems to be
    runned by the eval function.
     
    I get this code:
     
     
    var OxO5799=[""x0D"x0A","document","length","element "x27",""x27 not found","removeNode","parentNode","firstChild","selection","type","None","Control","text","body","",""x26amp;",""x26lt;",""x26gt;",""x26#39;",""x26quot;",""x3Cbr/"x3E",""x26nbsp;","applyElement","nodeName","INPUT","TEXTAREA","BUTTON","IMG","SELECT","TABLE","position","style","absolute","relative","|H1|H2|H3|H4|H5|H6|P|PRE|LI|TD|DIV|BLOCKQUOTE|DT|DD|TABLE|HR|IMG|","|","all","nodeType","value","textContent","childNodes","nodeValue","*","rowSpan","cellIndex","colSpan","Can"x27t Get The Position ?","Map","RowCount","ColCount","rows","cells","Unknown Error ,

    ... (tons and tons of stuff)

    Ox878=htmlcode[OxO5799[0x2]] ;<- //The error raises here
    if(Ox878>Ox66a){ alert(OxO5799[0x49b]+Ox66a+OxO5799[0x49a]) ;return false;} ;} ;return true;}  ;}  ;
     
     
    Can you help me? What's the problem?
  •  02-18-2008, 8:21 AM 37105 in reply to 37062

    Re: Strange error after taking the focus out of the CuteEditor

    Please use the following javascript API to set the focus to the editor.
     
    FocusDocument()
    This method is used for setting input focus to CuteEditor
    Example:
    // get the cute editor instance
    var editor1 = document.getElementById('<% = Editor1.ClientID%>');

    // setting input focus to Cute Editor
    editor1.FocusDocument();

     
    Demo:
     
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  02-19-2008, 10:15 AM 37152 in reply to 37105

    Re: Strange error after taking the focus out of the CuteEditor

    Thanks for your reply Adam. I'm already using that function 
     
    I talked with support and they told me to reproduce the error in an example page.
    Here is a simple test page showing the error, I want to focus on the editor after a tab on the textfield (not working well in this example, use "S" instead), and after the user press ctrl+tab on the cute editor I want the focus back into the text editor.
     
    When you press control tab inside the  cute editor I get an exception. I want just to get the focus back in the text field.
    Thanks for your help.
     
    Here is the test case, please give it a try.
     
     
    <%@ Page Language="C#" AutoEventWireup="true" %>
    <%@ Register TagPrefix="ce" Namespace="CuteEditor" Assembly="CuteEditor" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
        <title>Untitled Page</title>



    <script type="text/jscript">
    var editor = null;



    function onBodyLoad(){

        document.getElementById("Text1").focus();
        window.setTimeout("iniCuteEditor()",1000);

    }
     

     function iniCuteEditor()
        {  
           editor = document.getElementById('<% = Editor.ClientID%>');     
           var editdoc=editor.GetDocument();
                // attach Event
            editdoc.attachEvent('onkeydown',cuteEditorOnkeyDown);
             document.getElementById("Text1").focus();
        }


    function cuteEditorOnkeyDown(e)
        {
                        
            if (event) e = event;    
            
            if (e.ctrlKey && e.keyCode == 9) //Tab+Ctrl?
            {    
             document.getElementById("Text1").focus();
            }    
                
            
        }

    function textKeyDown(){

        //debugger;
        if(event.keyCode == 9 || event.keyCode==83) //tab? or S
            {
                 editor = document.getElementById('<%=Editor.ClientID%>');
                editor.FocusDocument();
                event.cancelBubble =true;
                return false;
        
            }


    }

    </script>

    </head>

    <body onkeydown="" onload="onBodyLoad()">
        <form id="form1" runat="server">
        <div>
        
        test &nbsp;<input id="Text1" type="text" onkeydown="textKeyDown();" />
        <br/><br/>
        
        <CE:Editor id="Editor" runat="server" Width="720px" Height="250px" ShowBottomBar="false" UseHTMLEntities="true">
                </CE:Editor>
            <br />
            </div>
        </form>
    </body>
    </html>

     
  •  02-21-2008, 5:35 PM 37263 in reply to 37062

    Re: Strange error after taking the focus out of the CuteEditor


    I think this is a bug. Any news?
  •  02-29-2008, 11:13 AM 37470 in reply to 37263

    Re: Strange error after taking the focus out of the CuteEditor

    I just want to know if there is a possibility of a fix on this, I cant find a way of do it myself.
  •  02-29-2008, 12:23 PM 37476 in reply to 37470

    Re: Strange error after taking the focus out of the CuteEditor

    CoffeeGuy,
     
    I've asked our developers put more thoughts on this issue. If it's a bug, we will fix it in the version 6.1. Right now, if you have a workaround, just use it.
     
    I will let you know the result when the version 6.1 is out.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  03-04-2008, 10:50 AM 37538 in reply to 37476

    Re: Strange error after taking the focus out of the CuteEditor


    Ok, this is the workaround I used:
     
    I just went  to the file ...CuteSoft_Client/CuteEditor/Scripts/IE_Implementation/CuteEditorImplementation.js
     
    and I modified the function Window_PasteHTMLAndCollapseToEnd. I just added a try/catch statement around the problematic code.
     
    function Window_PasteHTMLAndCollapseToEnd(Ox1a5,Ox92)
    {
      var range=Ox1a5[OxO5799[0x1]][OxO5799[0x8]].createRange();
      try{ range.pasteHTML(Ox92) ;
             range.collapse(false) ;
             range.select();}
       catch(ex){}
    }

    However this just hides the problem (which I don't really know what is) and I had to modify cutesoft internal code. If I want to upgrade later and you have not solved this issue I will have to modify it again.
    Please cutesoft, take a look at this bug for your new version.
     
    Regards.
     
View as RSS news feed in XML