draft-js icon indicating copy to clipboard operation
draft-js copied to clipboard

the endKey selected block not included in "hasAtomicBlock" analysis in the function "toggleBlockType" in "RichTextEditorUtil.js"

Open mferranti opened this issue 10 years ago • 1 comments

Do you want to request a feature or report a bug?

This seems like a bug

What is the current behavior?

When i make a selection when the last block is an atomic block and put an H2 style, it broke the block because "hasAtomicBlock" evaluates to false.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar.

1 - write some text "this is a text block" 2 - add atomic block 3 - push shift and up arrow key to select the atomic block and the text "this is a text block" 4 - select H2 or another blockType. 5 - atomic block brokes

What is the expected behavior? atomic block not broken

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? Draft 0.8.1 Chrome 52.0.2743.116 (64-bit) OS X 10.11.6

mferranti avatar Sep 13 '16 15:09 mferranti

Hey @mferranti

Great catch. hasAtomicBlock indeed didn't consider the endKey. I see you have a PR in development. Ping it in and we will merge

stopachka avatar Sep 13 '16 21:09 stopachka