-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix rich text utils backspace not clearing the block type at the start. #748
Conversation
Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired. Before we can review or merge your code, we need you to email cla@fb.com with your details so we can update your status. |
^ Looks like Travis might need a retry? |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
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.
@@ -59,7 +59,7 @@ describe('RichTextEditorUtil', () => { | |||
|
|||
// Remove the current text from the blockquote. | |||
const resetBlockquote = DraftModifier.removeRange( | |||
editorState.getCurrentContent(), | |||
contentState, |
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.
Nice - thanks for fixing that.
@@ -82,6 +82,27 @@ describe('RichTextEditorUtil', () => { | |||
expect(lastBlockNow.getText()).toBe(''); | |||
}); | |||
|
|||
it('resets the current block type at the start of the first 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.
I'm going to try and resolve the conflicts, ensure CI passes, and merge 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.
@flarnie is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
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.
@flarnie has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Woot! Awesome to see this get merged. Thank you! @flarnie |
Summary: **Summary** When backspacing at the start of the first block using rich text utils, the block type should be cleared. Example of me frantically trying to clear the first block type **without** this PR by pressing backspace at the beginning of the document: ![clear-first-block-type](https://cloud.githubusercontent.com/assets/424704/19821170/d3296d9a-9d11-11e6-990d-e2277bbfb833.gif) Followed by an example of me clearing the first block type **with** this PR: ![clear-first-block-type-working](https://cloud.githubusercontent.com/assets/424704/19821197/01b4826c-9d12-11e6-853b-32417ec93f10.gif) **Test Plan** - Pull master. - Open the rich text example. - Create a list. - Put your cursor at the first offset of the first block, backspace to reset the block type, notice that it doesn't work. - Pull this branch. - Open the rich text example. - Create a list. - Put your cursor at the first offset of the first block, backspace to reset the block type, rejoice in joy as the list item disappears. - Celebrate. 🎉 Closes facebookarchive/draft-js#748 Differential Revision: D6065808 fbshipit-source-id: d4b9028e255be1bdf405cf228cfd16c877872c95
Summary: **Summary** When backspacing at the start of the first block using rich text utils, the block type should be cleared. Example of me frantically trying to clear the first block type **without** this PR by pressing backspace at the beginning of the document: ![clear-first-block-type](https://cloud.githubusercontent.com/assets/424704/19821170/d3296d9a-9d11-11e6-990d-e2277bbfb833.gif) Followed by an example of me clearing the first block type **with** this PR: ![clear-first-block-type-working](https://cloud.githubusercontent.com/assets/424704/19821197/01b4826c-9d12-11e6-853b-32417ec93f10.gif) **Test Plan** - Pull master. - Open the rich text example. - Create a list. - Put your cursor at the first offset of the first block, backspace to reset the block type, notice that it doesn't work. - Pull this branch. - Open the rich text example. - Create a list. - Put your cursor at the first offset of the first block, backspace to reset the block type, rejoice in joy as the list item disappears. - Celebrate. 🎉 Closes facebookarchive/draft-js#748 Differential Revision: D6065808 fbshipit-source-id: d4b9028e255be1bdf405cf228cfd16c877872c95
Summary: **Summary** When backspacing at the start of the first block using rich text utils, the block type should be cleared. Example of me frantically trying to clear the first block type **without** this PR by pressing backspace at the beginning of the document: ![clear-first-block-type](https://cloud.githubusercontent.com/assets/424704/19821170/d3296d9a-9d11-11e6-990d-e2277bbfb833.gif) Followed by an example of me clearing the first block type **with** this PR: ![clear-first-block-type-working](https://cloud.githubusercontent.com/assets/424704/19821197/01b4826c-9d12-11e6-853b-32417ec93f10.gif) **Test Plan** - Pull master. - Open the rich text example. - Create a list. - Put your cursor at the first offset of the first block, backspace to reset the block type, notice that it doesn't work. - Pull this branch. - Open the rich text example. - Create a list. - Put your cursor at the first offset of the first block, backspace to reset the block type, rejoice in joy as the list item disappears. - Celebrate. 🎉 Closes facebookarchive/draft-js#748 Differential Revision: D6065808 fbshipit-source-id: d4b9028e255be1bdf405cf228cfd16c877872c95
Summary
When backspacing at the start of the first block using rich text utils, the block type should be cleared.
Example of me frantically trying to clear the first block type without this PR by pressing backspace at the beginning of the document:
Followed by an example of me clearing the first block type with this PR:
Test Plan