fbjs
fbjs copied to clipboard
DataTransfer.getHTML() should not return text
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 https://github.com/facebook/draft-js/issues/656.
Do you agree this is something that should be fixed?
@zpao, maybe you could find the time to comment on this?
I just hit this today.
There's already getText()
for a reason.
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.