Skip to content

Commit

Permalink
Clear block type when pressing backspace
Browse files Browse the repository at this point in the history
Summary:
This is closer to how most editors work.
Closes facebookarchive#1659

Reviewed By: sophiebits

Differential Revision: D7073440

Pulled By: sophiebits

fbshipit-source-id: 3f6ab214282878dd7dccf7709fc261ffe350f485
  • Loading branch information
sophiebits authored and facebook-github-bot committed Feb 27, 2018
1 parent 1ef4044 commit 6a1e2b0
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions src/model/modifier/RichTextEditorUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,8 @@ const RichTextEditorUtil = {
},

/**
* When a collapsed cursor is at the start of the first styled block, or
* an empty styled block, changes block to 'unstyled'. Returns null if
* block or selection does not meet that criteria.
* When a collapsed cursor is at the start of a styled block, changes block
* type to 'unstyled'. Returns null if selection does not meet that criteria.
*/
tryToRemoveBlockStyle: function(editorState: EditorState): ?ContentState {
var selection = editorState.getSelection();
Expand All @@ -379,11 +378,6 @@ const RichTextEditorUtil = {
var content = editorState.getCurrentContent();
var block = content.getBlockForKey(key);

var firstBlock = content.getFirstBlock();
if (block.getLength() > 0 && block !== firstBlock) {
return null;
}

var type = block.getType();
var blockBefore = content.getBlockBefore(key);
if (
Expand Down

0 comments on commit 6a1e2b0

Please sign in to comment.