React-draft-wysiwyg: Text alignment for multiline

Created on 17 Aug 2017  路  11Comments  路  Source: jpuri/react-draft-wysiwyg

If text is one line, center and right text alignment works great.
But if text is more then one line, text alignment is always left.

image

It happends because of .public-DraftStyleDefault-ltr which is inside of .rdw-center-aligned-block or .rdw-right-aligned-block and has text-align:left.

Result text is aligned well, but this styles doesn't appear in editor.

Most helpful comment

Still reproduced. 1.12.11
react draft wysiwyg

All 11 comments

@masquel : I will check this soon.

Hi, any news on that?

I have added some styles in my custom css for wysiwyg for now and it seems to work:
.rdw-center-aligned-block > .public-DraftStyleDefault-block { text-align: center; }
.rdw-right-aligned-block > .public-DraftStyleDefault-block { text-align: right; }

@dadepl it's necessary to set width: 100% in the public-DraftStyleDefault-blockclass as well

Having an issue here, hope it will fix.

also got an temporary fix. Hope will address in the future

.rdw-center-aligned-block > .public-DraftStyleDefault-block > span { 
  text-align: center;
  width: 100%; 
  display: block;
}

.rdw-right-aligned-block > .public-DraftStyleDefault-block > span {
  text-align: right;
  width: 100%;
  display: block;
}

Release 1.12.9 has the fix.

Still having this issue with 1.12.9. Creating an empty editor, typing several lines of text into it and none of the alignment buttons do anything.

I see that there's a .rdw-justify-aligned-block div wrapping around the paragraph containing another one with .public-DraftStyleDefault-ltr defining text-align: left;. If I remove the attribute everything works as expected.

If I save and reload the text after e.g. right aligning it then it reverts to left aligned.

@codeaid: Can you plz check that you are using new css file also.

@jpuri - I'm pretty sure it was. I saw the display: block-inline in the styles when I inspected some elements. I'm afraid I've switched to using react-quill since I posted the message.

Still reproduced. 1.12.11
react draft wysiwyg

@jpuri - Still exists in 1.12.13
Resorted to CSS workaround from @justinlazaro-ubidy
Something that you're working on?

@jpuri Facing issue for multiline long paragraph. It is not getting center aligned. Any necessary cautions for CSS or any other workaround? Please help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fireprufe15 picture Fireprufe15  路  4Comments

Satherial picture Satherial  路  4Comments

dahudson88 picture dahudson88  路  3Comments

jpuri picture jpuri  路  4Comments

gyarasu picture gyarasu  路  4Comments