This is a migrated thread and some comments may be shown as answers.

Drag & Drop - addExternalHandler doesn't work for Safari 5

3 Answers 64 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Brian Garson
Top achievements
Rank 2
Brian Garson asked on 03 Sep 2010, 06:55 PM
Hello,

we're trying to support Safari 5 on Windows / Mac for our product using the rad editor.  I'm using some custom code to add the event Drop to the editor which will run anytime the user drag and drops something into the editor.  Works great in all browsers except Safari.  Any ideas?

Using Telerik build: 2009.3.1314.35

var element = document.all ? editor.get_document().body : editor.get_document();
    var eventHandler = "drop";
 
    $telerik.addExternalHandler(element, eventHandler, function(e) {
        setTimeout(function() {
            alert("i worked");
        }, 300);
    });

thanks

3 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 06 Sep 2010, 02:35 PM
Hi Brian,

You should use the dragend event in Chrome and Safari to achieve your goal:

<telerik:RadEditor ID="RadEditor1" runat="server" OnClientLoad="OnClientLoad">
</telerik:RadEditor>
<script type="text/javascript">
    function OnClientLoad(editor, args) {
        var element = document.all ? editor.get_document().body : editor.get_document();
        var eventHandler = $telerik.isSafari ? "dragend" : "drop";
 
        $telerik.addExternalHandler(element, eventHandler, function (e) {
            setTimeout(function () {
                alert("i worked");
            }, 300);
        });
    }
 
</script>



All the best,
Rumen
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Brian Garson
Top achievements
Rank 2
answered on 08 Sep 2010, 02:36 PM
Hi Rumen,

Is the dragend a new feature supported by a newer build of Telerik?

We're running Telerik build: 2009.3.1314.35  and Safari 5.0.1 and your code doesn't seem to fire in Safari.

any ideas?

thanks,


0
Dobromir
Telerik team
answered on 14 Sep 2010, 09:38 AM
Hi Brian,

DragEnd is not a feature provided by RadEditor but a standard DOM event fired when a mouse drag ends.

Could you please describe in more details what you are trying to achieve? If you want to handle the event when user is dragging and dropping content inside content area, you need to attach event to the OnDragEnd event of the content area's document. If you want to handle the event when user drags content from the page and drops it inside RadEditor's content area you need to handle OnDragEnd event of the Page's document.

For your convenience I have attached a sample page demonstrating both scenarios.

Please note that, this is not a RadEditor's limitation but is the default browser behavior. I have attached simple HTML page with editable <iframe> and editable <div> to verify this behavior.

Best wishes,
Dobromir
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Editor
Asked by
Brian Garson
Top achievements
Rank 2
Answers by
Rumen
Telerik team
Brian Garson
Top achievements
Rank 2
Dobromir
Telerik team
Share this question
or