-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Block library: When pressing enter on empty line new Paragraph blocks is crated #16880
Conversation
regExp: /\n$/, | ||
transform: ( { content } ) => [ | ||
createBlock( 'core/verse', { | ||
content: content.replace( /\n$/, '' ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess, it's buggy but it's enough to get feedback :)
To me, this makes a ton of sense on a high level. I'm pinging @ellatrix because I know she has tonnes of thoughts on this also. I recall her mentioning that there was a good reason why the caption didn't work this way — perhaps because you should be able to create a multi-paragraph caption? |
I think something like this would be good. I once started a PR (#14143) that looked to do something similar. In general, I like the idea that you should be able to For paragraphs and headings, |
👍 👍👌 |
It's exactly what I was thinking about myself. In particular @ellatrix - do you still think, this should be exposed as a new prop of |
Currently this is already the case though. Both the heading and list block insert a paragraph block explicitly. The way I see it, we need an extra prop, because |
This feels really good! I know I've run into this issue while in the Quote block several times. I hit But I also see the value of being able to hit |
I've implemented split for the quote block in #17121. |
I'm closing this exploration. We definitely should continue working on the changes in the experience. |
I've been working towards achieving this with |
Description
This is an experiment. I have no idea if the solution is the most expected but it does what I want.
This PR mirrors the behavior of List block where pressing enter on empty line removes it and it creates new Paragraph block and moves focus there. I'd love to have it replicated for the following blocks:
This is how List block works in
master
:How has this been tested?
enter
key, a new line should be created.enter
key again, this new line should be removed, new Paragraph block added and focus should move there.Screenshots
Types of changes
Checklist: