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

DataTransfer.getHTML() should not return text #190

Open
robbertbrak opened this issue Oct 8, 2016 · 3 comments
Open

DataTransfer.getHTML() should not return text #190

robbertbrak opened this issue Oct 8, 2016 · 3 comments

Comments

@robbertbrak
Copy link

In https://github.com/facebook/fbjs/blob/master/packages/fbjs/src/datatransfer/DataTransfer.js#L97, getHTML is returning the 'Text' data from the clipboard (dataTransfer), but this seems incorrect to me. Presumably this is done for IE, which does not support the text/html content type, but it is rather misleading to have getHTML return plain text rather than HTML.

In Draft.js, this leads to subtle bugs such as facebookarchive/draft-js#656.

Do you agree this is something that should be fixed?

@robbertbrak
Copy link
Author

@zpao, maybe you could find the time to comment on this?

@intentionally-left-nil
Copy link

I just hit this today.

There's already getText() for a reason.

@NicolaMagnabosco
Copy link

I think the problem here is that DataTransfer.getText() is not handling IE's 'text' type correctly. It's just checking on the length of the this.types array, whilst in IE11 the types array does contain the 'text' data using "Text".
So it should rather do this:

if (!this.types.length || this.types.indexOf('Text') != -1) {
    text = this.data.getData('Text');
}

I tested it only on IE11 and seems to be working fine.

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

3 participants