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

Table data copied from IE doesn't get pasted properly on chrome/firefox #4717

Closed
xtianproject opened this Issue Jan 12, 2018 · 9 comments

Comments

Projects
None yet
3 participants
@xtianproject
Copy link

xtianproject commented Jan 12, 2018

Description

Data copied from an HTML table loaded on IE browser doesn't paste the data properly on handsontable using chrome/firefox.

The data copied from IE has a different format. Every TD value is delimited by space not by tabs.

Steps to reproduce

  1. Generate an HTML table using IE: (https://www.tablesgenerator.com/html_tables#)
  2. Copy the data from the generated table then paste it on handsontable that is loaded on chrome/firefox
  3. Data only gets pasted on 1 cell.

Your environment

  • Handsontable CE 0.35.0
  • IE 10 / Chrome
@AMBudnik

This comment has been minimized.

Copy link
Contributor

AMBudnik commented Jan 12, 2018

Hi @xtianproject

Can you record it? I am not sure If I'm doing it right.

@xtianproject

This comment has been minimized.

Copy link
Author

xtianproject commented Jan 12, 2018

Hi @AMBudnik

Please see link: https://gfycat.com/SingleGorgeousIndianrockpython

  1. Copied data from HTML table on IE
  2. Pasted the data to hansdontable on Chrome
  3. Data was only pasted on 1 cell
@AMBudnik

This comment has been minimized.

Copy link
Contributor

AMBudnik commented Jan 12, 2018

Thank you very much. I can see it now.

Here we have the opposite situation #4308
We need to check the separators and change the way the data is pasted.

@swistach

This comment has been minimized.

Copy link
Member

swistach commented Jan 16, 2018

Hi @xtianproject
It is not a bug of Handsontable. Browsers parse data to text/plain value in different ways (see below screenshot).
differences between browsers

In Handsontable, the pasted data has to be in text/plain type.
Cells are separated by TAB (arrow) and rows by ENTER.

I've noticed the fact that Excel parses the pasted data in the same way as Handsontable.

@AMBudnik

This comment has been minimized.

Copy link
Contributor

AMBudnik commented Jan 17, 2018

Thanks for clarification @swistach

@xtianproject

This comment has been minimized.

Copy link
Author

xtianproject commented Jan 18, 2018

Hi @swistach,

So will this be tagged as limitation of handsontable?

I tried to copy an HTML Table data from IE to excel and it parses it correctly.

@swistach

This comment has been minimized.

Copy link
Member

swistach commented Jan 19, 2018

I’ve checked this one again, on the Excel for Windows and you were right. This works fine there.

I made small investigation and we need to add support for text/html mime type.
So, this issue is the improvement suggestion / change / feature request.

Is this a limitation? Well, yes and no.
Why? Because in IE you have an access only to window.clipboardData.getData('Text') and window.clipboardData.setData('Text', ...). That means you can read only text/plain values from the clipboard. Of course, in a modern browser, we have access to read/write values as text/html. But this is a new feature as I’ve mentioned above.
Ok, but let’s go back to text/plain.
In our SheetClip library we trying to parse plain text into an array of values. There is a rule that we looking for two defined whitespaces. \t is a column separator. \n is a row separator.
In your case, IE saves selected text as text/html, as something like that:

<TABLE><TBODY><TR><TD>Column 1</TD><TD>Column 2</TD></TR></TBODY></TABLE>

and as text/plain:

Column 1 Column 2

Currently, we can read only text/plain. But inside the clipboard is no \t whitespace.
If you copy the same table in a modern browser you will get something like below:

Column 1	Column 2

@swistach swistach added the Copy-paste label Aug 22, 2018

@swistach swistach self-assigned this Sep 5, 2018

@swistach

This comment has been minimized.

Copy link
Member

swistach commented Sep 12, 2018

This issue should be solved within #4931

@swistach swistach closed this Sep 12, 2018

@AMBudnik

This comment has been minimized.

Copy link
Contributor

AMBudnik commented Oct 18, 2018

Hi @xtianproject

Please update to 6.1.0 we have fixed this bug there

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.