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.

Pasted copy with carriage returns doesn't render the carriage returns

See original GitHub issue

bug

What’s the current behavior?

When pasting existing copy with solo carriage returns \r these aren’t rendered by SlateJS

Given This has a different new line\r\r\r\rThis is the final line. in the clipboard when pasting into Slate no lines are rendered as shown below.

SlateJS vs Draft JS feb-28-2018 14-12-16

What’s the expected behavior?

That the carriage returns are correctly rendered as shown in Draft JS

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
DamareYohcommented, Feb 28, 2018

Developers can write custom deserializer rules in their paste handlers that convert ‘\r’ to newline at least as a work around.

1reaction
thalladacommented, Jan 29, 2020

It looks like this issue is also occurring with plain text with normal \n newlines in 0.57.1.

I opened a PR to fix both styles of newlines: https://github.com/ianstormtaylor/slate/pull/3472

Read more comments on GitHub >

github_iconTop Results From Across the Web

Paste as plain text, but also remove any new-line and carriage ...
This strips of all new line characters or carriage returns and works perfectly. However, I need a faster way of doing thihs. ***PureText...
Read more >
copy paste loses formatting - Carriage returns are removed ...
When I reply to email, the original message is indented and a blue bar is down the left margin.
Read more >
Why is vim stripping the carriage return when I copy a line to ...
When I yank a line that contains a carriage return and paste it into another file, the pasted line does not contain the...
Read more >
What is the purpose of "paste newlines as carriage returns" in ...
My understanding is that since many yeas ago Unix and MacOS line endings have become identical and thus there is no room for...
Read more >
Reader Question: Getting rid of hard line breaks in pasted text
I quite often copy and paste text from Adobe Acrobat documents rather than retype it, but by far the biggest hassle is having...
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