-
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
Writing flow: Backspace at beginning of first paragraph block prevents block from being deleted #56329
Conversation
ceb00fb
to
7ec534a
Compare
Size Change: +68 B (0%) Total Size: 1.72 MB
ℹ️ View Unchanged
|
7ec534a
to
a253d0c
Compare
…s block from being deleted
a253d0c
to
a8b1912
Compare
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -451,8 +451,17 @@ const applyWithDispatch = withDispatch( ( dispatch, ownProps, registry ) => { | |||
} | |||
|
|||
moveFirstItemUp( rootClientId ); | |||
} else { | |||
removeBlock( clientId ); |
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.
Should we maybe just not do anything? I'm not sure if pressing Backspace at the start of a heading should convert it to a paragraph? Are there any editors that do this?
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.
Google Docs and MS Word don't seem to transform a heading into a paragraph. Regarding Notion, it seems to transform a heading into a paragraph.
9cd90d08815c9c736a142187f7cb9fcb.mp4
Personally, I like the current behavior of the Backspace key. If the backspace key does nothing, we will need to transform the existing heading into a paragraph or delete it in order to start a new article again from a paragraph. This seems a little cumbersome to me.
…ts block from being deleted (WordPress#56329) * Writing flow: Backspace at beginning of first paragraph block prevents block from being deleted * Use replaceBlocks Co-authored-by: t-hamano <wildworks@git.wordpress.org> Co-authored-by: ellatrix <ellatrix@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org>
Fixes #56303
Related to #55134
What?
This PR fixes an issue where pressing the backspace key at the beginning of a paragraph block with content causes the block to be deleted.
Before
before.mp4
After
after.mp4
Why?
I think the current implementation deletes a block when you press the backspace key at the beginning of the first block. This is a problem if the paragraph or heading already has content.
How?
I updated the logic to have the following behavior when the BACKSPACE key is pressed in the first block. I think this is expected behavior.
Testing Instructions