lexical icon indicating copy to clipboard operation
lexical copied to clipboard

Bug(?): New paragraph nodes do not follow the alignment of previous paragraphs.

Open michaelsoultanidis opened this issue 3 years ago • 5 comments

New paragraphs created using the Enter key do not follow the same alignment as the previous paragraph. I'm not sure if this is a bug or done intentionally.

Lexical version: Latest

Steps To Reproduce

  1. Right-align an existing paragraph.
  2. Press enter to create a new paragraph.

https://user-images.githubusercontent.com/88332746/236798633-e5e444cf-c1e4-4f3c-9931-e42d334cc3dc.mov

michaelsoultanidis avatar May 08 '23 10:05 michaelsoultanidis

I was wondering the same thing. It's worth noting though that when using an RTL language (Hebrew for example), the selected alignment is persisted.

AndreyGalchevski avatar May 22 '23 10:05 AndreyGalchevski

@michaelsoultanidis did you end up solving it? I'm experiencing the same issue.

arielyz avatar Nov 06 '23 16:11 arielyz

You can use Shift+Enter for the moment, since it adds in the same paragraph this way vs a new paragraph with default alignment of 'left'. I agree this should be amended. Not sure on what the best approach here is, looking at the previous node does seem reasonable, but should be discussed.

ivailop7 avatar Nov 07 '23 09:11 ivailop7

Thanks @ivailop7. How does copying the previous paragraph style work then (e.g. font-color)? Both text-alignment and font-color are CSS properties of the TextNode.

arielyz avatar Nov 07 '23 17:11 arielyz

I believer you are correct, yes, either it's missing a property in the place where it carries over the font style, which should be a simple fix or other logic overrides it.

ivailop7 avatar Nov 07 '23 23:11 ivailop7