Resolved: Changed event firing on click in FireFox

Last post 09-09-2008, 1:09 AM by MarkHolden. 13 replies.
Sort Posts: Previous Next
  •  08-29-2007, 12:08 PM 33044

    Resolved: Changed event firing on click in FireFox

    Adam,
     
    We've brought this up previously and need a fix for it in FireFox. This does not happen in IE.
     
    You need to have a page that displays an alert when the function CuteEditor_OnChange(editor) is fired. Then you can clearly see that a mouse click fires the event.
     
    What can we do to fix this nagging issue?
     
    FredD
     
     
  •  08-29-2007, 12:25 PM 33047 in reply to 33044

    Re: Changed event firing on click in FireFox

    FredD,
     
    Please check this example:
     
     
    The souce code of this example is as followings:
     

    <%@ Page Language="C#"%>
    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>

    <html>
        <head>
      <title>Test Changed event firing on click in FireFox</title>
      <link rel="stylesheet" href="../example.css" type="text/css" />
     <body>
            <form runat="server">
       <center>
        <h1>Test Changed event firing on click in FireFox </h1>
        <CE:Editor id="Editor1" ThemeType="OfficeXP" AutoConfigure="Simple" EditorWysiwygModeCss="../example.css" runat="server"></CE:Editor>
       </center>
      </form>
     </body>
    </html>

    <script language="JavaScript" type="text/javascript" >
      var editor1=document.getElementById("<%=Editor1.ClientID%>");
      if(editor1.IsReady)CuteEditor_OnInitialized(editor);

      function CuteEditor_OnChange(editor)
      { 
       //when the content be changed..
       alert(editor.id+" changed at "+ new Date().toLocaleTimeString());
      }
    </script>


    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

  •  08-29-2007, 12:31 PM 33048 in reply to 33047

    Re: Changed event firing on click in FireFox

    Adam,
     
    I ran it in FF and clicked into the editor body. It immediately displayed:
     
    CE_Editor1_ID changed at 10:28:41 AM
     
    I ran it in IE and clicked into the body and it didn't trigger the change.
     
    FF is still triggering the event.
     
    FredD
     
     
     
     
  •  08-29-2007, 1:00 PM 33049 in reply to 33048

    Re: Changed event firing on click in FireFox

  •  08-29-2007, 1:16 PM 33051 in reply to 33049

    Re: Changed event firing on click in FireFox

    But that's the problem, Adam. We carefully track the changed event and we then set up a recovery version if it's changed. Setting up the recovery version overwrites the previous recovery version.
     
    So here's the scenario: during processing, our background operation automatically saves a recovery version at periodic intervals. If the user shuts down his/her browser without saving, or if the power goes off, the user can easily get that recovery version by opening CE and selecting a menu option we provide.
     
    However, if the user first clicks into the editor before selecting the recovery version menu item, the Changed event assumes a change has been made and saves the contents (which are empty) as the recovery version. When the user then tries to get the recovery version that s/he expects, it's not there because it's been overridden by the "changed" document.
     
    So it's very important that the click event does not trigger the Changed event..
     
    FredD
     
     
     
     
  •  08-30-2007, 2:49 PM 33110 in reply to 33051

    Re: Changed event firing on click in FireFox

    fredd,

    This issue only happen when the editor is empty. Unlike IE, when the editor is empty, firefox will insert some code automatically. Then Cute Editor cleans it up.  So CuteEditor_OnChange event is fired.

    Here is a work-around:

    <script language="JavaScript" type="text/javascript" >
      var editor1=document.getElementById("<%=Editor1.ClientID%>");
      function CuteEditor_OnChange(editor)
      {
         //when the content be changed..
           if(editor1.getHTML()!="")
           {
               alert(editor.id+" changed at "+ new Date().toLocaleTimeString());
           }
      }
    </script>

    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

  •  08-30-2007, 3:45 PM 33119 in reply to 33110

    Re: Changed event firing on click in FireFox

    Hi Adam,
     
    Thanks for the that, but the problem is that we default the HTML of a document, and that default is variable. For example, on starting a new document, we will default the HTML at:
     

    strDefaultHTML = "<html>" & vbCrLf & _

    Chr(9) & "<head>" & vbCrLf & _

    Chr(9) & "</head>" & vbCrLf & _

    Chr(9) & "<body" & _

    " bottommargin=" & Chr(34) & "50" & Chr(34) & _

    " leftmargin=" & Chr(34) & "75" & Chr(34) & _

    " topmargin=" & Chr(34) & "50" & Chr(34) & _

    " rightmargin=" & Chr(34) & "50" & Chr(34) & _

    " style='FONT-SIZE: 12px; FONT-FAMILY: Verdana' " & _

    ">" & vbCrLf & _

    Chr(9) & "</body>" & vbCrLf & _

    "</html>"

    But it could be anything, since the users can define the opening default.
     
    Do you have any thoughts on how we can handle that?
     
    FredD
     
     
  •  08-30-2007, 6:02 PM 33124 in reply to 33119

    Re: Changed event firing on click in FireFox

    One other point. You say that FF inserts code automatically if the editor is empty and CE cleans it up, which triggers the change event.
     
    In our case, the editor is not empty, since we populate it with a default setting. Therefore, there's no reason for the change event to be triggered...
     
    Another point: if we try to call getHTML via Firefox, FF throws this error:
     
    Error: [Exception... "'Permission denied to get property HTMLDocument.body' when calling method: [nsIDOMEventListener::handleEvent]"  nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)"  location: "<unknown>"  data: no]
     
    So we really need a solution that simply ignores the mouse click...
  •  09-03-2007, 11:06 AM 33186 in reply to 33124

    Resolved: Changed event firing on click in FireFox

    Adam: Any update on this, yet?
     
    FredD
  •  09-06-2007, 1:53 PM 33336 in reply to 33124

    Re: Changed event firing on click in FireFox

    fredd,

    This issue only happen when the editor is empty. Unlike IE, when the editor is empty, firefox will insert some code automatically. Then Cute Editor cleans it up.  So CuteEditor_OnChange event is fired.

    Here is a work-around:

    <script language="JavaScript" type="text/javascript" >
      var editor1=document.getElementById("<%=Editor1.ClientID%>");
      function CuteEditor_OnChange(editor)
      {
         //when the content be changed..
           if(editor1.getHTML()!="")
           {
               alert(editor.id+" changed at "+ new Date().toLocaleTimeString());
           }
      }
    </script>
     
    >>Another point: if we try to call getHTML via Firefox, FF throws this error:
     
     
    >>So we really need a solution that simply ignores the mouse click...
     
    This is by design. If you want to change this behavior, you may need to get the source and modify it.
     
     
     
     
     
     
     

    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

  •  09-06-2007, 5:35 PM 33347 in reply to 33336

    Re: Changed event firing on click in FireFox

    As I mentioned, we set defaults for the editor, so we can't just compare to "". Using innerHTML, we figured out a solution using a combination of your suggestion and some other stuff.
     
    Thanks, Adam
    FredD
  •  09-08-2008, 2:09 AM 43681 in reply to 33347

    Re: Changed event firing on click in FireFox

    Hi Fredd
     
    We have exactly the same problem, it would be great if you could tell us how you solved it. Other wise I will go through the same scenario that you have gone through with Adam and after nine days I will still not have an answer.
     
    Cheers
     
    Mark
  •  09-08-2008, 5:06 PM 43739 in reply to 43681

    Re: Changed event firing on click in FireFox

    Hi Mark,
     
    I'm not sure... it was so long ago. I'll check back on our records and see if I can find it for you.
     
    FredD
  •  09-09-2008, 1:09 AM 43748 in reply to 43739

    Re: Changed event firing on click in FireFox

    opps, sorry didn't really look at the dates,
     
    no worries, we actually figured out another way, thanks for replying though
     
    Cheers
     
    Mark
View as RSS news feed in XML