adavia
adavia

Reputation: 423

Draft js codeblock text overflow

I am having a hard time trying to prevent the overflowing text inside a codeblock. The problem seem to be only with codeblocks, which ignores its parent container width. As per the example below, when editing using a codeblock the text is not breaking into new lines when reaching the end of the container.

https://codesandbox.io/s/1oqr4xyy6j

Upvotes: 0

Views: 1742

Answers (2)

dysfunc
dysfunc

Reputation: 2008

Demo - https://codesandbox.io/s/r4qx32m8wm

I made this change in rich-editor.css

CSS

.RichEditor-editor .public-DraftStyleDefault-pre pre {
  white-space: normal;
}

Upvotes: 1

Colin Ricardo
Colin Ricardo

Reputation: 17249

You can add the following to your CSS:

pre {
  overflow: hidden;
}

Working example here.

Upvotes: 0

Related Questions