Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-image drag-n-drop trigger unique event #518

Closed
mattleff opened this issue May 13, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@mattleff
Copy link
Contributor

commented May 13, 2016

Currently dragging-n-dropping and pasting an image trigger the same event (here and here). While this is good for most cases I'm wanting to have a separate event for a multi-image drag-n-drop. This allows me to turn several images into a single element in the editor (i.e., for a gallery).

I've added this to our repo with this but I was wondering if this is something that you would want or be willing to have. Or is there a better way to accomplish what I'm doing with the current code?

@ipeychev

This comment has been minimized.

Copy link
Contributor

commented May 14, 2016

That is an interesting user case. So, in case of multiple files, you don't leave the editor to add them to the content, but you handle them by yourself, don't you?
Here is what I think we can do to help you:

Before to process the images, we collect them in an array which may have one or more elements and we fire another generic event, something like beforeImageAdd. It will have all the images as payload. Then, if the returned result is false, i.e. someone prevented the event, we will not process the images and the editor will not add them to the content.
In this case we will have backward compatibility and you will subscribe to this new event, will check the size, will add them as you do now and return false in the listener.

How does it sound for you?

Thanks,

@mattleff

This comment has been minimized.

Copy link
Contributor Author

commented May 16, 2016

@ipeychev I think the beforeImageAdd sounds perfect.

@ipeychev ipeychev added this to the 1.2.1 milestone May 17, 2016

@ipeychev ipeychev closed this in ae2c5d1 May 17, 2016

ipeychev added a commit that referenced this issue May 17, 2016

ipeychev added a commit that referenced this issue Jun 9, 2016

ipeychev added a commit that referenced this issue Jun 9, 2016

ipeychev added a commit that referenced this issue Jun 9, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.