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

Pressing enter at the start of a heading block should push it down and create a paragraph above. #10326

Closed
BE-Webdesign opened this issue Oct 4, 2018 · 1 comment · Fixed by #14765
Labels
[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.

Comments

@BE-Webdesign
Copy link
Contributor

Is your feature request related to a problem? Please describe.
When editing a post and having the cursor at the first position in a heading block, pressing enter to create a new block unexpectedly keeps the current heading block where it is and moves the content into a paragraph block below it. This has been somewhat clunky for me, and I was unable to find a duplicate issue or discussion around this. Apologies in advance; I imagine this has come up before.

heading-interaction

Describe the solution you'd like
When pressing enter at the beginning of a heading block I would expect the heading to move down and create an empty paragraph block, or heading block above it.

Describe alternatives you've considered
Alternative is to leave it as is, even though I am having difficulty understanding the purpose of the current behavior.

@BE-Webdesign BE-Webdesign added [Type] Enhancement A suggestion for improvement. [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... labels Oct 4, 2018
@tofumatt
Copy link
Member

tofumatt commented Oct 4, 2018

I agree; I think creating a paragraph block above is the more appropriate result for this interaction.

@jorgefilipecosta jorgefilipecosta added the [Status] In Progress Tracking issues with work in progress label Nov 30, 2018
andrewserong added a commit to andrewserong/gutenberg that referenced this issue Feb 13, 2019
… instead of heading (WordPress#10326)

The onSplit method for the heading block will now replace an empty heading block with an empty paragraph block for the 'before' content.

This allows the ENTER key pressed at the beginning of a heading to create an empty paragraph above it. Also, when the ENTER key is pressed at the end of a heading, an empty paragraph block is created below, instead of another heading block. The RichText component now also calls event.stopImmediatePropagation() before splitContent() to prevent TinyMCE from throwing an error. This avoids a similar error as in WordPress#4580.
andrewserong added a commit to andrewserong/gutenberg that referenced this issue Feb 13, 2019
This ensures that if a user types a heading, then moves the caret to the beginning of the line and presses ENTER, that a paragraph block is created above. Also ensures that when a user presses ENTER at the end of a heading, a paragraph block is created below.
andrewserong added a commit to andrewserong/gutenberg that referenced this issue Feb 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Status] In Progress Tracking issues with work in progress [Type] Enhancement A suggestion for improvement.
Projects
None yet
3 participants