question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot paste HTML in IE

See original GitHub issue

When pasting HTML in IE, only plain text is preserved.

To reproduce:

  • Copy some HTML with formatting (such as this line) to the clipboard.
  • Go to http://facebook.github.io/draft-js/ in IE.
  • Paste the clipboard contents into the editor.
  • Expected result: the formatting is preserved.
  • Actual result: The formatting is lost.

IE does not expose text/html on the clipboardData, so this may be difficult to fix. There are working workarounds, though, such as the one described on http://stackoverflow.com/a/6804718/815176. This workaround involves:

  • temporarily stashing the current editor contents
  • allowing the browser to natively paste into the contenteditable area
  • reading the contents of the contenteditable area

Would such a workaround be considered for inclusion in the framework?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

3reactions
flarniecommented, May 2, 2018

I’m going to try and look into this. Thanks to those who have posted - please let me know if someone has a PR ready for this, otherwise will be debugging it in my spare time.

1reaction
robbertbrakcommented, Feb 6, 2017

@AnilRedshift great to hear that other people are working on this as well! My own solution, similar to yours, is implemented in https://github.com/robbertbrak/draft-js/commit/3aee43f060a745d8ff379f7b698f1d7e10d5e06b.

I ran in the same issues that you mentioned. In addition, and just for reference, I noticed that Draft adds the following CSS to the contenteditable div: -webkit-user-modify: read-write-plaintext-only (see https://github.com/facebook/draft-js/blob/master/src/component/base/DraftEditor.css#L17). I’m not sure why that attribute is necessary for Draft, but if it’s there, it prevents Edge from pasting HTML into the element.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTML copy paste not working in OWA for Exchange 2013 SP1 ...
In IE, go Tools>Internet Options>Security tab, click "Reset all zones to default" to reset your IE security settings back to their default ...
Read more >
Cannot paste text into form in IE - InfoPath Dev
The issue is that i cannot paste any text that i copied into that rich text box. I tried using ctrl+v as well...
Read more >
Copy/Paste function not working in Internet Explorer - ProZ.com
I found today that I could not paste anything from Internet Explorer. I select text in the normal way, click Edit/Copy,
Read more >
Help! I Can't Copy Paste In Internet Explorer 11 - Cyn Mackley
If you need to copy/paste something ASAP, try switching to another browser like Firefox or Google Chrome. You can download either one for...
Read more >
Fix Copy and Paste Not Working in Chrome - Technipages
If you can't use the copy-paste option in Chrome, disable your extensions, clear the cache and update the browser. On the other hand, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found