DraftEditorBlock's `pre-wrap` overrides any white-space style returned from `blockStyleFn`
See original GitHub issueBug
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 apre
. 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:
- Created 6 years ago
- Reactions:2
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
ah! sorry shoulda been more specific. horizontally scrollable. will update title
been running a custom fork for years now