Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Drag and Drop on Element Within HTMLPane?

    I have a Canvas that contains an HTMLPane. The iframe URL for the HTMLPane is set to a .html file in the same domain as the module .html. I'm adding a drop listener to the HTMLPane to see if I can detect the exact element within the .html when something is dropped on it, but EventHandler.getTarget() always returns the HTMLPane (which makes sense). Is there any way to get the element (via ID) within the iFrame that it was dropped on? If so, what about if the iFrame URL was not in the same domain as the hosting URL? My listener looks something like this:

    Code:
            emailTemplateHtmlPane = new HTMLPane();
            emailTemplateHtmlPane.setWidth100();
            emailTemplateHtmlPane.setHeight("*");
            emailTemplateHtmlPane.setPadding(new Integer(0));
            emailTemplateHtmlPane.setMargin(new Integer(10));
            emailTemplateHtmlPane.setIFrameURL("emptyEmailTemplate.html");
            emailTemplateHtmlPane.setOverflow(Overflow.AUTO);  
            emailTemplateHtmlPane.setDropTypes("digitalAsset");
            emailTemplateHtmlPane.setCanAcceptDrop(Boolean.TRUE);
    
            emailTemplateHtmlPane.addDropHandler(new DropHandler()
            {
                public void onDrop(DropEvent event)
                {
                    Canvas target = EventHandler.getTarget();
                    
                    if (target != null)
                    {
                        System.out.println("target ID =" + target.getID());
                    }
                }
            }
Working...
X