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

Paste not working in IE #84

Open
mdanielcristian opened this issue Apr 10, 2018 · 5 comments
Open

Paste not working in IE #84

mdanielcristian opened this issue Apr 10, 2018 · 5 comments

Comments

@mdanielcristian
Copy link

mdanielcristian commented Apr 10, 2018

Paste is not working in IE.
The onCellsChanged and parsePaste handlers are not triggered

Repro even on official site: https://nadbm.github.io/react-datasheet/

@mdanielcristian
Copy link
Author

After a bit more digging I found why it isn't working.
On chrome, the paste event is triggered every time you paste on the document. In ie, it first checks if the focus is on an input element and if so, it triggers the event, if not the event is not triggered. Since when you first click on a cell you are on a div (not an input) the paste event is not triggered.
I have a quick fix, not the best, but it seems to work from the limited testing I had time to do:

line 507 in DataSheet.js, replace the document.addEventListener('paste', this.handlePaste); with
image

this checks if is ie, then use the on key down event and if the key combination is Ctrl + V that call the paste function with the clipboard data that you can take from the window.

If there is a better solution, please let me know.

@nadbm
Copy link
Owner

nadbm commented Apr 13, 2018

Ideally I would love to avoid detectIE in the code, truth be told, I did not test with IE.
I will keep this open for anyone looking to make this work in IE .

@souppower
Copy link

👍

@SapiensTechnology
Copy link

@mdanielcristian, thanks for your solution. I have tried your solution but unfortunately, this does not seem to be working anymore. I am thinking that changing in version would be one reason. I will try to edit some of my DataSheet.js to get copy and paste works in ie. However, if you have already done it, can you share?

@tmreay
Copy link

tmreay commented Mar 24, 2020

@nadbm I was checking in on the status of this issue, and saw #162. I think I speak for many people when I say thank you for getting this resolved! Can this issue be closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants