Draft-js: Unable to delete blockquote if its the top element

Created on 23 Feb 2016  路  7Comments  路  Source: facebook/draft-js

screen shot 2016-02-22 at 9 54 16 pm

Video reproducing the issue

Steps to reproduce

I am using node v4.3.1

  1. Build the project and open examples/rich.html
  2. Click Blockquote
  3. Hit Enter to create another blockquote
  4. Use the arrow keys (or mouse) to go up one line to the top blockquote
  5. Hit Delete

Results

Expected:

The blockquote would delete allowing you to add new text type(s) to the line

Actual:

The blockquote does not delete if there are other blockquotes below it, making it difficult to
go back and add lines above it.


The issue only occurs if the topmost line is a blockquote.

bug

All 7 comments

I was just looking at this yesterday! I think this if statement should move inside the one that follows it so it only applies if we're after a media block:

https://github.com/facebook/draft-js/blob/f5e6cf50558f5797b079db80fcda706664c74e14/src/model/modifier/RichTextEditorUtil.js#L115-L118

We might also want to check that the block is unstyled so that when backspacing a blockquote/heading following a media block, the style is stripped when backspacing once (and the block is completely deleted the second time).

@spicyj interesting, I'd like to give fixing it a shot! I'll look over the source and get a PR if I get a working fix.

Thanks @Aweary!

i have a workaround for this issue:

detect if you're backspacing,
detect if you're on the first block,
detect if you're on the first character of that block,
detect if you're in an non-unstyled block,
detect whether this block is empty

if all the conditions above are met apply unstyled blocktype

if you want the code for this, just let me know

Hi folks -
Maybe I'm missing something, but I was not able to repro this with the latest version of Draft.
deleting_blockquote

Please open a new issue if this is still happening, and thanks for reporting. I assume it was fixed sometime in the past year.

Also pretty cool to come across an issue you reported @aweary :)

@flarnie it's a small world 馃槃 I totally forgot about this issue, glad to see it got resolved!

I think 9d3da64afb2a514fc4d3117e47b05e4f87df1d25 fixed this. :)

Was this page helpful?
0 / 5 - 0 ratings