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.

DraftEditorBlock's `pre-wrap` overrides any white-space style returned from `blockStyleFn`

See original GitHub issue

Bug

What is the current behavior? public-DraftStyleDefault-block is hardcoded to use white-space: pre-wrap. this means if I want a scrollable code block (<pre>), then i cannot achieve the result by using blockStyleFn because that is overwritten by the div below it.

What is the expected behavior? a code-block with white-space: pre should not be overwritten by white-space: pre-wrap.

couple ways to fix this:

  • the public-DraftStyleDefault-block could make sure that it isn’t a child of a pre. seems brittle because folks might want this functionality for things other than codeblocks
  • the white-space: pre-wrap could be applied to its parent instead
  • the parent div could apply a pre-wrap and the child could inherit whatever the parent says, allowing for an override.

i think the 3rd option is the cleanest, but there are so many issues surrounding this that i wanna get feedback before a PR because I wanna get the opinions of folks who have more than just my use case.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mattkrickcommented, Jun 12, 2017

ah! sorry shoulda been more specific. horizontally scrollable. will update title

0reactions
mattkrickcommented, Sep 27, 2019

been running a custom fork for years now

Read more comments on GitHub >

github_iconTop Results From Across the Web

white-space - CSS: Cascading Style Sheets - MDN Web Docs
The white-space CSS property sets how white space inside an element is ... The behavior is identical to that of pre-wrap , except...
Read more >
white-space - CSS-Tricks
The CSS white-space property controls how text is handled on the element it is applied to. Let's say you have HTML exactly like...
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