-
Notifications
You must be signed in to change notification settings - Fork 4
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
How do you remove the event listener? #34
Comments
pasteImage.off('paste-image') does not work. I'm looking for essentially a way to destroy the plugin when the modal is closed (or simply detach the paste handler). |
I'm just going to attach it globally and put the conditional inside, but if you get a chance to respond, I'd love to redo this. |
Comment (l:160): |
I'm not sure what you mean by your comment, can you provide more context? My goal is to be able to instantiate the plugin when my modal opens, and then destroy it when it closes. I do not want the paste listener to be an active event listener all the time, but that's the way I had to make it work for now. It has nothing to do with focus. |
Sorry I misunderstood your request. Well here is how I do for textarea:
The event is always call when Crtl+V is press with an image in clipboard and then you check if the focus is on the textarea.
And then:
And when you close the modal, remove the focus:
|
I am already making sure the modal is open and everything. It's working fine. I just don't like that it's catching the paste event all the time (even when I don't need to). |
Well I think you cannot configure the script. The author need to update the code, but I think he doesn't work on this project anymore (last commit 3 years ago). |
I noticed that it was old. I was hoping someone would comment with the method of modifying the script to get the result I want. It wouldn't be hard to fork his repo and make the changes, but I tried a few things and couldn't get it working. Instead of investing a lot of time on it, I moved on, but it would still be nice if someone came up with the solution at some point in the future so I can improve my application. |
I had same problem and finally I fixed it with more native solution
you can easly add/remove event binding |
I want to attach when a modal is opened and detach when it's closed.
The text was updated successfully, but these errors were encountered: