Inevio / Gmail

0 stars 1 forks source link

Implement drag & drop attachment from Files to Gmail #3

Closed jorge9200 closed 6 years ago

burhan-project-manager commented 6 years ago

I am afraid if that enhancement can be implemented. We are using a third party WYSIWYG editor. We will need to customize it in order to enable drag & drop.

jorge9200 commented 6 years ago

It would be wonderful, look if it's to complicated and we will decide.

burhan-project-manager commented 6 years ago

Need to tweek thrid party plugin, Yes it is complicated!

jorge9200 commented 6 years ago

@javiergarmon told me that maybe can be an easier way to do it. He will write it here and we'll comment it.

burhan-project-manager commented 6 years ago

Yes please suggest me if we can do it without touching third party plugin.

javiergarmon commented 6 years ago

Hi @burhan-project-manager !

Good news! horbito has an event in the hole platform. Here is an example:

// Item where the event will be catch. In your case this is a good start point.
var domItem = $('.hrgmail_newMessage_popup')

domItem.on( 'wz-dropenter', function( e, item ){
  // Use this event to highlight the UI
})

domItem.on( 'wz-dropleave', function( e, item ){
  // Use this event to remove the highlight the UI
})

domItem.on( 'wz-drop', function( e, item, list ){
  // list is an array of objects. Each object has an attribute fsnode
})

Here is everything you need to continue. The logic inside 'wz-drop' event should be very similar to the selectSource() callback logic that you have implemented.

burhan-project-manager commented 6 years ago

@javiergarmon i have tried it but those events are not triggering when we drag & drop files over any element. Even wz-dropenter and wz-dropleave are not triggering.

Do we need some permission in info.json in order to make it work?

javiergarmon commented 6 years ago

I forgot one detail. The element where you want to drop the file must have the class wz-drop-area.

burhan-project-manager commented 6 years ago

@javiergarmon thanks for it. But it is still not working. I can trigger other events on that element like "mousemove" but wz-dropenter and wz-dropleave are not working.

Tested it with completely new elements also.

javiergarmon commented 6 years ago

Hmmm.. That's weird. Please, leave that class in your code, I will check it as soon as possible

javiergarmon commented 6 years ago

Done. Closed!