Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit 6a1e2b0

Browse files
sophiebitsfacebook-github-bot
authored andcommitted
Clear block type when pressing backspace
Summary: This is closer to how most editors work. Closes #1659 Reviewed By: sophiebits Differential Revision: D7073440 Pulled By: sophiebits fbshipit-source-id: 3f6ab214282878dd7dccf7709fc261ffe350f485
1 parent 1ef4044 commit 6a1e2b0

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

src/model/modifier/RichTextEditorUtil.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,8 @@ const RichTextEditorUtil = {
367367
},
368368

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

382-
var firstBlock = content.getFirstBlock();
383-
if (block.getLength() > 0 && block !== firstBlock) {
384-
return null;
385-
}
386-
387381
var type = block.getType();
388382
var blockBefore = content.getBlockBefore(key);
389383
if (

0 commit comments

Comments
 (0)