Custom drag event is not triggering for input check box.

Last post 10-16-2015, 12:18 PM by Kenneth. 1 replies.
Sort Posts: Previous Next
  •  10-16-2015, 6:49 AM 81146

    Custom drag event is not triggering for input check box.

    Hi,

     I have folowing code

     Working->editorWindow.document.addEventListener("click", function(){alert('click')});

    Not Working ->editorWindow.document.addEventListener("dragstart", function(){alert('dragging')});

    can anyone please assist on this. 

  •  10-16-2015, 12:18 PM 81147 in reply to 81146

    Re: Custom drag event is not triggering for input check box.

    Hi,

     

    you can try the example below. note that, it only work with the text content not the control, the editor has its own drop function handler for the control, so does not support to use the javascript way to catch it.

     

    1. <%@ Page Language="c#" ValidateRequest="false" %>  
    2.   
    3. <%@ Register TagPrefix="RTE" Namespace="RTE" Assembly="RichTextEditor" %>  
    4. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  
    5. <html xmlns="http://www.w3.org/1999/xhtml">  
    6. <head>  
    7.     <title>example</title>  
    8. </head>  
    9. <body>  
    10.     <form id="Form1" method="post" runat="server">  
    11.         <RTE:Editor runat="server" ID="Editor1" Height="260px" />  
    12.     </form>  
    13. </body>  
    14. </html>  
    15. <script type='text/javascript'>  
    16.     function editor_document_ondragstart(e) {  
    17.         alert(1);  
    18.     }  
    19.     function AttachEditorEvent(editor) {  
    20.         var win = editor.GetWindow();  
    21.         var doc = win.document;  
    22.         if (doc.addEventListener) {  
    23.             doc.addEventListener("dragstart", editor_document_ondragstart, false);  
    24.         }  
    25.         else {  
    26.             doc.attachEvent("ondragstart", editor_document_ondragstart);  
    27.         }  
    28.     }  
    29.   
    30.     function RichTextEditor_OnLoad(editor) {  
    31.         AttachEditorEvent(editor);  
    32.   
    33.     }  
    34. </script>  
     

    Regards,

     

    Ken 

View as RSS news feed in XML