Justified text is not possible in Firefox
See original GitHub issueDo you want to request a feature or report a bug? Bug
What is the current behavior?
Applying text-align: justify;
on a block via a class name returned from the blockStyleFn
function has no effect in Firefox.
It looks like this is because the white-space: pre-wrap;
rule applied to .public-DraftStyleDefault-block
, which is preventing the justified alignment in Firefox 50.1.0. The same problem does not exist in Chrome 55.0.2883.87.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You can use this jsfiddle to get started: https://jsfiddle.net/stopachka/m6z0xn4r/.
Apply text-align: justify;
to a block type class name. See example https://jsfiddle.net/rxycutze/2/
What is the expected behavior?
It should be possible to apply the text-align: justify;
CSS rule to a block without side effects.
Perhaps Draft.js should investigate the substitution of white-space with
and <br/>
to avoid the need to apply white-space: pre-wrap;
.
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? Draft.JS 0.9.1 Firefox 50.1.0
Issue Analytics
- State:
- Created 7 years ago
- Comments:13
Top GitHub Comments
Thanks @Okazari , that workaround seems to work, although I don’t understand why as it seems to be still preserving the white-space (
white-space: pre-wrap
), despite usingwhite-space: normal;
. It could even be a bug in Firefox.@PeterDekkers
I am currently facing the same issue, having to choose between ‘allowing justified text’ and ‘allowing typing a space at the end of a paragraph (otherwise the cursor jumps at the beginning of the paragraph)’… I haven’t found any way to achieve both yet. Did anyone find a solution for this?