-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
fix #22550 and allow enter to insert line breaks even if template is locked #23330
Conversation
@@ -1,5 +1,23 @@ | |||
// Jest Snapshot v1, https://goo.gl/fbAQLP | |||
|
|||
exports[`cpt locking template_lock all should insert line breaks when using enter and shift-enter 1`] = ` | |||
"<!-- wp:image --> |
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.
Ideally would be best to not have content from the previous test. Not a blocker though. :)
'.block-editor-block-list__block[data-type="core/paragraph"]' | ||
); | ||
await page.keyboard.type( 'First line' ); | ||
await pressKeyTimes( 'Enter', 1 ); |
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 don't think that this should work for Enter too. Only Shift+Enter is kind of known for inserting a soft line break.
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'd disagree lots of my clients are not aware of that and silently treating Enter as a soft line break is a much nicer UX if you have an entire post type locked. This is also how it used to work before the regression.
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.
Not sure if this is the right place to post, but I would like to agree with @ocean90 and have this reverted to only apply to Shift+Enter. I'm not sure what pressing Enter did in the past, but what it should do is exit the block, like it does when pushing Enter after any other paragraph block.
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.
Just as a use case, I'm setting up a simple block which allows someone to enter one paragraph, and display an icon beside it (using the ACF plugin with InnerBlocks locked to one paragraph, and an image field).
This works fine, but I keep hitting enter after that paragraph so that I can type a normal paragraph, and instead end up with a line break inside the original block.
…locked (#23330) * fix #22550 and allow enter to insert line breaks in richtext * add e2e test * Restore isSelected condition Co-authored-by: Ella van Durpe <[email protected]>
Description
See #22550. I have no idea what I'm doing, I'm just opening up this PR for discussion and the off chance that this is actually okay. Ping @ellatrix or someone who actually knows what's happening in this flow should have a look.
Note that this is how it used to work at least some versions back.
How has this been tested?
Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: