Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RichText multiline paragraph and line-break #13788

Closed
buhlahkay opened this issue Feb 8, 2019 · 5 comments
Closed

RichText multiline paragraph and line-break #13788

buhlahkay opened this issue Feb 8, 2019 · 5 comments
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.

Comments

@buhlahkay
Copy link

Is there a way to enable multiline and also line-break in a RichText component? For example, if you press enter it wraps that line in a p tag, but if you press shift+enter it inserts a br tag.

@youknowriad youknowriad added the [Type] Help Request Help with setup, implementation, or "How do I?" questions. label Feb 8, 2019
@danicholls
Copy link

I take it you mean you want to do this (i.e., add a line break on shift+enter) but it does not work right now.

I can't find the issue, but this should work and is broken, unless there was a very recent fix. It's a bug.

@buhlahkay
Copy link
Author

I'm not sure if that's how it's supposed to function or not. Currently I don't think it allows me to do both. I can set multiline to paragraph but shift+enter does not insert line breaks.

@Ziyad-web
Copy link

Same here, is there a way or a patch for that problem ?, as in the List item we can not add a break line while staying in the same Item, once you hit shift+enter it creates a new list Item instead of adding a break-line.

@davidyeiser
Copy link

Looks like this same issue was present in Lists (#11215) and was fixed in this pull request: #13546

For me, shift + enter works as expected (creates manual line break) when using the standard Paragraph block in a new post or page. However, when I import RichText for a custom block and then implement like so:

<RichText
  className="custom-block-body"
  value={attributes.body}
  onChange={value => setAttributes({ body: value })}
  tagName="div"
  multiline="p"
/>

The shift + enter no longer creates a manual line break (<br/>) but creates a new paragraph (<p>).

@youknowriad
Copy link
Contributor

I just tried the solution proposed by @davidyeiser and it seems to work for both (Enter and shift+Enter). It might have been completely fixed in the last versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Help Request Help with setup, implementation, or "How do I?" questions.
Projects
None yet
Development

No branches or pull requests

5 participants